Changeset 4677 for waeup/branches/ulif-layout
- Timestamp:
- 5 Jan 2010, 11:04:30 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup/branches/ulif-layout/src/waeup/browser/pages.py
r4674 r4677 7 7 from waeup.browser import WAeUPPage, WAeUPEditFormPage, WAeUPAddFormPage 8 8 from waeup.catalog import search, search_context 9 from waeup.datacenter import Import 9 10 from waeup.interfaces import (IUniversity, IWAeUPObject, IUserContainer, 10 11 IUserAccount, IFacultyContainer, IDataCenter) … … 240 241 pnav = 0 241 242 243 class DataCenterImportCSVPage(WAeUPPage): 244 """A view for importing things. 245 246 """ 247 grok.require('waeup.manageUniversity') 248 grok.name('importcsv') 249 grok.template('datacenterimportcsvpage') 250 grok.context(IDataCenter) 251 title = u'Import CSV' 252 pnav = 0 253 254 def getImports(self): 255 result = [] 256 imports = self.context.getPossibleImports() 257 result = [Import(x, y) for x, y in imports] 258 return result 259 260 def update(self, csvfile=None, clear=None, overwrite=None, 261 receiverid=None, CANCEL=None, SUBMIT=None): 262 if CANCEL is not None: 263 self.redirect(self.url(self.context)) 264 return 265 if not csvfile: 266 return 267 if not SUBMIT: 268 return 269 try: 270 self.context.doImport(csvfile, receiverid, clear=clear) 271 except ValueError: 272 self.flash('Could not import: %s' % os.path.basename(csvfile)) 273 return 274 except: 275 self.flash('Import failed: %s %s' % (sys.exc_info()[0], 276 sys.exc_info()[1])) 277 return 278 self.flash('Successfully imported: %s' % os.path.basename(csvfile)) 279 self.redirect(self.url(self.context)) 280 return 281 242 282 243 283 #
Note: See TracChangeset for help on using the changeset viewer.