Changeset 5000
- Timestamp:
- 3 Feb 2010, 16:13:41 (15 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/browser
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py
r4997 r5000 381 381 mode = 'create' 382 382 importer = None 383 mode_locked = False 383 384 384 385 def getPreviewHeader(self): … … 410 411 dict(title=x.name, name=x.util_name) for x in importers] 411 412 return importers 412 413 413 414 def getModeFromFilename(self, filename): 415 """Lookup filename or path and return included mode name or None. 416 """ 417 if not filename.endswith('.pending.csv'): 418 return None 419 base = os.path.basename(filename) 420 parts = base.rsplit('.', 3) 421 if len(parts) != 4: 422 return None 423 if parts[1] not in ['create', 'update', 'remove']: 424 return None 425 return parts[1] 426 414 427 def update(self, mode=None, importer=None, 415 428 back1=None, cancel=None, proceed=None): … … 425 438 return 426 439 self.mode = mode or session.get('import_mode', self.mode) 440 filename_mode = self.getModeFromFilename(self.filename) 441 if filename_mode is not None: 442 self.mode = filename_mode 443 self.mode_locked = True 427 444 self.importer = importer or session.get('import_importer', None) 428 445 session['import_mode'] = self.mode -
main/waeup.sirp/trunk/src/waeup/sirp/browser/templates/datacenterimport2page.pt
r4858 r5000 61 61 62 62 <input type="radio" name="mode" value="create" checked="checked" 63 tal:attributes="checked python: view.mode == 'create' and 'checked' or ''" /> Create 63 tal:attributes="checked python: view.mode == 'create' and 'checked' or ''; 64 disabled python: view.mode != 'create' and view.mode_locked and 'disabled' or ''" /> Create 64 65 65 66 <input type="radio" name="mode" value="update" 66 tal:attributes="checked python: view.mode == 'update' and 'checked' or ''" /> Update 67 tal:attributes="checked python: view.mode == 'update' and 'checked' or ''; 68 disabled python: view.mode != 'update' and view.mode_locked and 'disabled' or ''" /> Update 67 69 68 70 <input type="radio" name="mode" value="remove" 69 tal:attributes="checked python: view.mode == 'remove' and 'checked' or ''" /> Remove 71 tal:attributes="checked python: view.mode == 'remove' and 'checked' or ''; 72 disabled python: view.mode != 'remove' and view.mode_locked and 'disabled' or ''" /> Remove 70 73 71 74 <p> </p>
Note: See TracChangeset for help on using the changeset viewer.