self, ), icon=self.icon) if self.icon: icon = os_path.split(self.icon)[1] else: icon = None for tool in self.tools: tool.__factory_meta_type__ = self.meta_type tool.icon = 'misc_/%s/%s' % (self.product_name, icon) InitializeClass(ToolInit) addInstanceForm = HTMLFile('dtml/addInstance', globals()) def manage_addToolForm(self, REQUEST): """ Show the add tool form. """ # self is a FactoryDispatcher. toolinit = self.toolinit tl = [] for tool in toolinit.tools: tl.append(tool.meta_type) return addInstanceForm(addInstanceForm, self, REQUEST, factory_action='manage_addTool', factory_meta_type=toolinit.meta_type,
# Sibling imports from Products.DTMLTeX import texvar # Some helper functions def join_dicts(a, b): a.update(b) return a def TrueOrFalse(x): return x not in (False, 0, 'False', 'false', '0', 'No', 'no', 'Off', 'off') # Color for the error beautifier errorcolor = "#fc6" addForm = HTMLFile('dtml/texAdd', globals()) def add(self, id, title='', file='', REQUEST=None, submit=None): """Add a DTML TeX object with the contents of file. If 'file' is empty, default document text is used.""" if type(file) is not type(''): file=file.read() ob = DTMLTeX(file, __name__=id) ob.title = title id = self._setObject(id, ob) if REQUEST is not None: try: u = self.DestinationURL() except: u = REQUEST['URL1'] if submit == " Add and Edit ": u = "%s/%s" % (u, quote(id)) REQUEST.RESPONSE.redirect(u + '/manage_main') return ''
return rval security.declareProtected(AccessContentsInformation, 'getDirPath') def getDirPath(self): return self.__dict__['_real']._dirpath security.declarePublic('getId') def getId(self): return self.id Globals.InitializeClass(DirectoryViewSurrogate) manage_addDirectoryViewForm = HTMLFile('dtml/addFSDirView', globals()) def createDirectoryView(parent, filepath, id=None): ''' Adds either a DirectoryView or a derivative object. ''' info = _dirreg.getDirectoryInfo(filepath) if dir is None: raise ValueError('Not a registered directory: %s' % filepath) if not id: id = path.split(filepath)[-1] else: id = str(id) ob = DirectoryView(id, filepath) parent._setObject(id, ob)
class ResponseCleanup: def __init__(self, resp): self.resp = resp def __del__(self): # Free the references. # # No errors of any sort may propagate, and we don't care *what* # they are, even to log them. try: del self.resp.unauthorized except: pass try: del self.resp._unauthorized except: pass try: del self.resp except: pass manage_addCCForm = HTMLFile('dtml/addCC', globals()) manage_addCCForm.__name__ = 'addCC' def manage_addCC(self, id, REQUEST=None): ' ' ob = CookieCrumbler() ob.id = id self._setObject(id, ob) if REQUEST is not None: return self.manage_main(self, REQUEST)