Changeset 4152 for waeup/branches/ulif-rewrite
- Timestamp:
- 20 May 2009, 10:52:44 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup/branches/ulif-rewrite/src/waeup/datacenter.py
r4146 r4152 10 10 from zope.interface import Interface 11 11 from waeup.interfaces import IWAeUPObject 12 from waeup.viewlets import Index, MainArea 12 from waeup.viewlets import Index, MainArea, LeftSidebar 13 13 14 14 class DataCenter(grok.Container): … … 34 34 """ 35 35 path = os.path.abspath(path) 36 if not os.path.exists(path): 37 raise ValueError('The path given does not exist: %s' % path) 36 38 self.storage = path 37 39 … … 103 105 grok.view(Upload) 104 106 107 108 class Settings(grok.View): 109 grok.context(DataCenter) 110 grok.name('settings') 111 grok.template('master') 112 113 def update(self, newpath=None, save=None, cancel=None): 114 if newpath is None: 115 return 116 if cancel is not None: 117 self.redirect(self.url(self.context)) 118 return 119 try: 120 self.context.setStoragePath(newpath) 121 except ValueError: 122 self.flash('Given storage path cannot be used.') 123 self.flash('Error: %s' %sys.exc_info()[1]) 124 return 125 if newpath: 126 self.redirect(self.url(self.context)) 127 return 128 129 class SettingsMain(grok.Viewlet): 130 grok.viewletmanager(MainArea) 131 grok.context(DataCenter) 132 grok.view(Settings) 133 134 class SettingsLink(grok.Viewlet): 135 grok.viewletmanager(LeftSidebar) 136 grok.context(DataCenter) 137 grok.view(Index) 138 grok.order(2) 139 grok.require('waeup.manageUniversity') 140 141 def render(self): 142 return u'<div class="portlet"><a href="@@settings">Settings</a></div>' 143
Note: See TracChangeset for help on using the changeset viewer.