Changeset 4679 for waeup/branches
- Timestamp:
- 5 Jan 2010, 11:30:24 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup/branches/ulif-layout/src/waeup/browser/pages.py
r4677 r4679 3 3 """ 4 4 import grok 5 import os 6 import sys 5 7 from hurry.query import Eq 6 8 from hurry.query.query import Query, Text … … 240 242 title = u'Data Center Upload' 241 243 pnav = 0 244 245 def update(self, uploadfile=None, CANCEL=None, SUBMIT=None): 246 if CANCEL is not None: 247 self.redirect(self.url(self.context)) 248 return 249 if not uploadfile: 250 return 251 try: 252 filename = uploadfile.filename 253 target = os.path.join(self.context.storage, filename) 254 open(target, 'wb').write(uploadfile.read()) 255 except IOError: 256 self.flash('Error while uploading file. Please retry.') 257 self.flash('I/O error: %s' % sys.exc_info()[1]) 258 return 259 self.redirect(self.url(self.context)) 260 242 261 243 262 class DataCenterImportCSVPage(WAeUPPage): … … 278 297 self.flash('Successfully imported: %s' % os.path.basename(csvfile)) 279 298 self.redirect(self.url(self.context)) 299 return 300 301 class DatacenterSettings(WAeUPPage): 302 grok.context(IDataCenter) 303 grok.name('manage') 304 grok.template('datacentermanagepage') 305 grok.require('waeup.manageUniversity') 306 title = u'Data Center Settings' 307 pnav = 0 308 #grok.template('master') 309 310 def update(self, newpath=None, move=False, overwrite=False, 311 save=None, cancel=None): 312 if move: 313 move = True 314 if overwrite: 315 overwrite = True 316 if newpath is None: 317 return 318 if cancel is not None: 319 self.redirect(self.url(self.context)) 320 return 321 try: 322 not_copied = self.context.setStoragePath(newpath, move=move) 323 for name in not_copied: 324 self.flash('File already existed (not copied): %s' % name) 325 except ValueError: 326 self.flash('Given storage path cannot be used.') 327 self.flash('Error: %s' %sys.exc_info()[1]) 328 return 329 if newpath: 330 self.flash('New storage path succefully set.') 331 self.redirect(self.url(self.context)) 280 332 return 281 333
Note: See TracChangeset for help on using the changeset viewer.