Changeset 1178
- Timestamp:
- 07/25/08 05:32:59
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
qPloneTabs/branches/quintagroup.plonetabs/trunk/quintagroup/plonetabs/browser/plonetabs.py
r1177 r1178 117 117 """ Manage method to add a new action to given category, 118 118 if category doesn't exist, create it """ 119 cat_name = form['category'] 119 # extract posted data 120 id, cat_name, data = self.parseAddForm(form) 120 121 121 122 # validate posted data 122 errors = self.validateActionFields(cat_name, form)123 errors = self.validateActionFields(cat_name, data) 123 124 124 125 # if not errors find (or create) category and set action to it … … 136 137 """ Manage Method to update action """ 137 138 # extract posted data 138 id, cat_name, data = self.parse Form(form)139 id, cat_name, data = self.parseEditForm(form) 139 140 140 141 # get category and action to edit … … 158 159 """ Manage Method to delete action """ 159 160 # extract posted data 160 id, cat_name, data = self.parse Form(form)161 id, cat_name, data = self.parseEditForm(form) 161 162 162 163 # get category and action to delete … … 590 591 return result 591 592 592 def parse Form(self, form):593 """ Extract all needed fields """593 def parseEditForm(self, form): 594 """ Extract all needed fields from edit form """ 594 595 # get original id and category 595 596 info = {} … … 606 607 for attr in ACTION_ATTRS: 607 608 info[attr] = form['%s_%s' % (attr, id)] 609 610 return (id, category, info) 611 612 def parseAddForm(self, form): 613 """ Extract all needed fields from add form """ 614 info = {} 615 id = form['id'] 616 category = form['category'] 617 618 # preprocess 'visible' field (checkbox needs special checking) 619 if form.has_key('visible'): 620 form['visible'] = True 621 else: 622 form['visible'] = False 623 624 # collect all action fields 625 for attr in ACTION_ATTRS: 626 info[attr] = form[attr] 608 627 609 628 return (id, category, info)
