Changeset 4956 for main/waeup.sirp/trunk/src/waeup/sirp/browser
- Timestamp:
- 1 Feb 2010, 16:18:44 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py
r4941 r4956 15 15 WAeUPDisplayFormPage, NullValidator) 16 16 from waeup.sirp.catalog import search, search_context 17 from waeup.sirp.datacenter import Import18 17 from waeup.sirp.interfaces import (IUniversity, IWAeUPObject, IUserContainer, 19 18 IUserAccount, IFacultyContainer, IDataCenter, … … 308 307 base, ext = os.path.splitext(filename) 309 308 return '%s_%s%s' % (base, filtered_username, ext.lower()) 310 311 class DataCenterImportCSVPage(WAeUPPage):312 """A view for importing things.313 314 """315 grok.require('waeup.manageUniversity')316 grok.name('importcsv')317 grok.template('datacenterimportcsvpage')318 grok.context(IDataCenter)319 title = u'Import CSV'320 pnav = 0321 322 def getImports(self):323 result = []324 imports = self.context.getPossibleImports()325 result = [Import(x, y) for x, y in imports]326 return result327 328 def update(self, csvfile=None, clear=None, overwrite=None,329 receiverid=None, CANCEL=None, SUBMIT=None):330 if CANCEL is not None:331 self.redirect(self.url(self.context))332 return333 if not csvfile:334 return335 if not SUBMIT:336 return337 try:338 self.context.doImport(csvfile, receiverid, clear=clear)339 except ValueError:340 self.flash('Could not import: %s' % os.path.basename(csvfile))341 return342 except:343 self.flash('Import failed: %s %s' % (sys.exc_info()[0],344 sys.exc_info()[1]))345 return346 self.flash('Successfully imported: %s' % os.path.basename(csvfile))347 self.redirect(self.url(self.context))348 return349 309 350 310 class DatacenterImportStep1(WAeUPPage):
Note: See TracChangeset for help on using the changeset viewer.