rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
if type(self) != TemplateDict: raise TypeError,'''A call was made to DT_Util.namespace() with an incorrect "self" argument. It could be caused by a product which is not yet compatible with this version of Zope. The traceback information may contain more details.'''
def namespace(self, **kw): """Create a tuple consisting of a single instance whos attributes are provided as keyword arguments.""" # NOTE: the self argument needs to be a TemplateDict instance. return apply(self, (), kw)
if a level > 1
if a level > 1. This fix is lame. The problem should be fixed inside STXNG
def spacestrip(txt): """ dedent text by 2 spaces ! We need this to workaround a nasty bug in STXNG. STXNG creates empty <pre>..</pre> when then text start if a level > 1 """ l = [] for x in string.split(txt,"\n"): if len(x)>2 and x[:2]==' ': l.append(x[2:]) return string.join(l,'\n')
return self.manage_workspace(self, REQUEST, update_menu=1)
return self.manage_main(self, REQUEST, update_menu=1)
def manage_addFolder(self, id, title='', createPublic=0, createUserF=0, REQUEST=None): """Add a new Folder object with id *id*. If the 'createPublic' and 'createUserF' parameters are set to any true value, an 'index_html' and a 'UserFolder' objects are created respectively in the new folder. """ ob=Folder() ob.id=id o...
Append a value to a cookie
Append a value to a header.
def appendHeader(name, value, delimiter=","): ''' Append a value to a cookie Sets an HTTP return header "name" with value "value", appending it following a comma if there was a previous value set for the header.
$Id: Publish.py,v 1.26 1996/11/26 22:06:18 jim Exp $"""
$Id: Publish.py,v 1.27 1996/12/30 14:36:12 jim Exp $"""
def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam
__version__='$Revision: 1.26 $'[11:-2]
__version__='$Revision: 1.27 $'[11:-2]
def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam
"The parameter, %s, was ommitted from the request."
"The parameter, %s, was omitted from the request."
def badRequestError(self,name):
url.append(id)
url.append(quote(id))
def absolute_url(self, relative=0): """Return an absolute url to the object. Note that the url will reflect the acquisition path of the object if the object has been acquired.""" obj=self url=[] while hasattr(obj, 'aq_parent') and hasattr(obj.aq_parent, 'id'): id=callable(obj.id) and obj.id() or str(obj.id) url.append(...
return quote(join(url, '/'))
return join(url, '/')
def absolute_url(self, relative=0): """Return an absolute url to the object. Note that the url will reflect the acquisition path of the object if the object has been acquired.""" obj=self url=[] while hasattr(obj, 'aq_parent') and hasattr(obj.aq_parent, 'id'): id=callable(obj.id) and obj.id() or str(obj.id) url.append(...
getattr(self,id).propertysheets.permissions.manage_edit( selected=['Add %ss' % id]) getattr(self,id).manage_setPermissionMapping(
Z=self._getOb(id) Z.propertysheets.permissions.manage_edit( selected=['Add %ss' % id]) Z.manage_setPermissionMapping(
def manage_addZClass(self, id, title='', baseclasses=[], meta_type='', CreateAFactory=0, REQUEST=None): """Add a Z Class """ bases=[] for b in baseclasses: if Products.meta_classes.has_key(b): bases.append(Products.meta_classes[b]) else: base=find_class(self, b) bases.append(base) Z=ZClass(id,title,bases) if meta_typ...
if sys.modules.has_key(m):
if sys.modules.has_key(m) and sys.modules[m]._m.has_key(name):
def __getattr__(self, name): p=self.__dict__['_product'] d=p.__dict__ if hasattr(p,name) and d.has_key(name): m=d[name] w=getattr(m, '_permissionMapper', None) if w is not None: m=ofWrapper(aqwrap(m, getattr(w,'aq_base',w), self)) return m
def parens(s, parens_re=re.compile(r'(\|)').search):
def parens(s, parens_re=re.compile('[\(\)]').search):
def parens(s, parens_re=re.compile(r'(\|)').search): index = open_index = paren_count = 0 while 1: index = parens_re(s, index) if index is None : break if s[index] == '(': paren_count = paren_count + 1 if open_index == 0 : open_index = index + 1 else: paren_count = paren_count - 1 if paren_count == 0: return open_i...
index = parens_re(s, index) if index is None : break
mo = parens_re(s, index) if mo is None : break index = mo.start(0)
def parens(s, parens_re=re.compile(r'(\|)').search): index = open_index = paren_count = 0 while 1: index = parens_re(s, index) if index is None : break if s[index] == '(': paren_count = paren_count + 1 if open_index == 0 : open_index = index + 1 else: paren_count = paren_count - 1 if paren_count == 0: return open_i...
def close(self, unlink=0):
def close(self, unlink=1):
def close(self, unlink=0): """Close the file.
self._fp.close() if unlink: os.unlink(self._fp.name)
if self._fp: self._fp.close() if unlink or self._unlink: os.unlink(self._fp.name) self._fp = None
def close(self, unlink=0): """Close the file.
return unittest.makeSuite(BatchTests)
return makeSuite(BatchTests)
def test_suite(): return unittest.makeSuite(BatchTests)
r.data_record_id_ = 1
r.data_record_score__ = 1
def __getitem__(self, index, ttype=type(())): """ Returns instances of self._v_brains, or whatever is passed into self.useBrains. """
if ininstance(MONITOR_PORT, IntType):
if isinstance(MONITOR_PORT, IntType):
def _warn_nobody(): zLOG.LOG("z2", zLOG.INFO, ("Running Zope as 'nobody' can compromise " "your Zope files; consider using a " "dedicated user account for Zope") )
if instance(UID, StringType):
if isinstance(UID, StringType):
def _warn_nobody(): zLOG.LOG("z2", zLOG.INFO, ("Running Zope as 'nobody' can compromise " "your Zope files; consider using a " "dedicated user account for Zope") )
elif instance(UID, IntType):
elif isinstance(UID, IntType):
def _warn_nobody(): zLOG.LOG("z2", zLOG.INFO, ("Running Zope as 'nobody' can compromise " "your Zope files; consider using a " "dedicated user account for Zope") )
if v1 == "NA" or v2 == "NA": return "I" else: return (all[i] + all[i2]) / 2
if type(v1) is type('') or type(v2) is type(''): return "I" else: return (v1 + v2) / 2
def median(self): all = self.all() l = len(all) if l == 0: return "I" else: if l == 1: return all[0] elif l % 2 != 0: i = l/2 + 1 return all[i] else: i = l/2 - 1 i2 = i + 1 v1 = all[i] v2 = all[i2] if v1 == "NA" or v2 == "NA": return "I" else: return (all[i] + all[i2]) / 2
LOG('UnIndex', ERROR, ('unindex_object tried to retrieve set %s' 'from index %s but couldn\'t. This ' 'should not happen.' % (repr(set), str(k))))
def unindex_object(self, i): """ Unindex the object with integer id 'i' and don't raise an exception if we fail """ index = self._index unindex = self._unindex
'integer id %s from index.' % str(k)))
'integer id %s from index %s. This ' 'should not happen.' % (str(i), str(k)))) else: LOG('UnIndex', ERROR, ('unindex_object tried to retrieve set %s ' 'from index %s but couldn\'t. This ' 'should not happen.' % (repr(set),str(k))))
def unindex_object(self, i): """ Unindex the object with integer id 'i' and don't raise an exception if we fail """ index = self._index unindex = self._unindex
t="<p><strong>%s</strong><p>" % strip(ctag(t))
t="<p><strong>%s</strong></p>" % strip(ctag(t))
def head(self, before, t, level, d): if level > 0 and level < 6: return ('%s<h%d>%s</h%d>\n%s\n' % (before,level,strip(ctag(t)),level,d)) t="<p><strong>%s</strong><p>" % strip(ctag(t)) return ('%s<dl><dt>%s\n</dt><dd>%s\n</dd></dl>\n' % (before,t,d))
dbtab.databases.update(getattr(DB, 'databases', {})) DB.databases = dbtab.databases
databases.update(getattr(DB, 'databases', {})) DB.databases = databases
def startup(): global app # Import products OFS.Application.import_products() configuration = getConfiguration() # Open the database dbtab = configuration.dbtab try: # Try to use custom storage try: m=imp.find_module('custom_zodb',[configuration.testinghome]) except: m=imp.find_module('custom_zodb',[configuration.in...
DB = ZODB.DB(m.Storage, databases=dbtab.databases)
DB = ZODB.DB(m.Storage, databases=databases)
def startup(): global app # Import products OFS.Application.import_products() configuration = getConfiguration() # Open the database dbtab = configuration.dbtab try: # Try to use custom storage try: m=imp.find_module('custom_zodb',[configuration.testinghome]) except: m=imp.find_module('custom_zodb',[configuration.in...
'--config-file', action="callback", type="string",
'--config-file', action="callback", type="string", dest='config_file',
def load_config_file(option, opt, config_file, *ignored): config_file = os.path.abspath(config_file) print "Parsing %s" % config_file import Zope2 Zope2.configure(config_file)
Initialize Zope with the given config file.
Initialize Zope with the given configuration file.
def load_config_file(option, opt, config_file, *ignored): config_file = os.path.abspath(config_file) print "Parsing %s" % config_file import Zope2 Zope2.configure(config_file)
data = self.conn.recv(1024)
data = self.getLine()
def _check(self, lev='250'): data = self.conn.recv(1024) if data[:3] != lev: raise smtpError, "Expected %s, got %s from SMTP"%(lev, data[:3])
('View', ['index_html','view_image_or_file','getSize','getContentType']),
('View', ['index_html','view_image_or_file','getSize','getContentType', '']),
def manage_addFile(self,id,file,title='',precondition='',REQUEST=None): """Add a new File object. Creates a new file object 'id' with the contents of 'file'""" self._setObject(id, File(id,title,file,precondition)) if REQUEST is not None: return self.manage_main(self,REQUEST)
def view_image_or_file(self,REQUEST,RESPONSE):
def view_image_or_file(self,URL1):
def view_image_or_file(self,REQUEST,RESPONSE):
return self.index_html(REQUEST,RESPONSE)
raise 'Redirect', URL1
def view_image_or_file(self,REQUEST,RESPONSE):
n=chidren[0]
n=children[0]
def getFirstChild(self, type=type, st=type('')): """ The first child of this node. If there is no such node this returns None """ children = self.getChildren()
return self.GetNodeValue(type,st)
return self.getNodeValue(type,st)
def _get_NodeValue(self, type=type, st=type('')): return self.GetNodeValue(type,st)
try: db=self._p_jar.db() except: return Globals.BobobaseName else: return db.getName()
return self._p_jar.db().getName()
def db_name(self): try: db=self._p_jar.db() except: # BoboPOS 2 return Globals.BobobaseName else: # ZODB 3 return db.getName()
def dbconnections(self): return Globals.DB.connectionDebugInfo()
def rcdeltas(self): if self._v_rcs is None: self.rcsnapshot() nc=self.refdict() rc=self._v_rcs rd=[] for n, c in nc.items(): prev=rc[n] if c > prev: rd.append( (c - prev, (c, prev, n)) ) rd.sort() rd.reverse()
try: db=self._p_jar.db() except: pass else: t=db.pack(t) if REQUEST is not None: REQUEST['RESPONSE'].redirect( REQUEST['URL1']+'/manage_workspace') return t if self._p_jar.db is not Globals.Bobobase._jar.db: raise 'Version Error', ( '''You may not pack the application database while working in a <em>version</em>''')...
db=self._p_jar.db() t=db.pack(t) if REQUEST is not None: REQUEST['RESPONSE'].redirect( REQUEST['URL1']+'/manage_workspace') return t
def manage_pack(self, days=0, REQUEST=None): """Pack the database"""
self.threshold = thresholdb
self.threshold = threshold
def manage_edit(self, RESPONSE, URL1, threshold=1000, REQUEST=None): """ edit the catalog """ self.threshold = thresholdb
if not hasattr(self, '_v_total'): self._v_total = 0
def catalog_object(self, obj, uid): """ wrapper around catalog """ if not hasattr(self, '_v_total'): self._v_total = 0 self._v_total = (self._v_total + self._catalog.catalogObject(obj, uid, self.threshold)) if self._v_total > self.threshold: get_transaction().commit(1) self._v_total = 0
try: traverse=object.__bobo_traverse__ except: traverse=None if traverse is not None:
if hasattr(object,'__bobo_traverse__'):
def publish(self, module_name, after_list, published='web_objects',
subobject=traverse(request,entry_name)
subobject=object.__bobo_traverse__(request,entry_name)
def publish(self, module_name, after_list, published='web_objects',
response.exception()
def publish_module(module_name, stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr, environ=os.environ, debug=0): must_die=0 status=200 after_list=[None] try: response=Response(stdout=stdout, stderr=stderr) publisher = ModulePublisher(stdin=stdin, stdout=stdout, stderr=stderr, environ=environ) response = publisher.r...
$Id: Publish.py,v 1.48 1997/09/08 14:47:11 jim Exp $"""
$Id: Publish.py,v 1.49 1997/09/09 20:25:21 jim Exp $"""
def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam
__version__='$Revision: 1.48 $'[11:-2]
__version__='$Revision: 1.49 $'[11:-2]
def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam
result=result or {}
if result is None: result={}
def parse_cookie(text, result=None, parmre=regex.compile( '\([\0- ]*' '\([^\0- ;,=\"]+\)=\([^\0- =\"]+\)' '\([\0- ]*[;,]\)?[\0- ]*\)' ), qparmre=regex.compile( '\([\0- ]*' '\([^\0- ;,=\"]+\)="\([^"]*\)\"' '\([\0- ]*[;,]\)?[\0- ]*\)' ), ): result=result or {} if parmre.match(text) >= 0: name=lower(parmre.group(2)) val...
index_html=HTMLFile('dtml/APIHelpView', globals())
index_html=DTMLFile('dtml/APIHelpView', globals())
def __init__(self, id, title, file): self.id=id self.title=title dict={} execfile(file, dict) self.doc=dict.get('__doc__','')
view=HTMLFile('dtml/APIView', globals())
view=DTMLFile('dtml/APIView', globals())
def SearchableText(self): """ The full text of the API, for indexing purposes. """ text="%s %s" % (self.name, self.doc) for attribute in self.attributes: text="%s %s" % (text, attribute.name) for method in self.methods: text="%s %s %s" % (text, method.name, method.doc) return text
view=HTMLFile('dtml/attributeView', globals())
view=DTMLFile('dtml/attributeView', globals())
def __init__(self, name, value): self.name=name self.value=value
view=HTMLFile('dtml/methodView', globals())
view=DTMLFile('dtml/methodView', globals())
def _createFromFunc(self, func): if hasattr(func, 'im_func'): func=func.im_func
manage=ManageHTMLFile('AqueductDA/edit')
manage=HTMLFile('AqueductDA/edit')
def test_url_(self):
self.result_names=result.names() self.report_src=custom_default_report(result,action='/manage_testForm') report=DocumentTemplate.HTML(self.report_src)
result_names=result.names() report_src=custom_default_report(result,action='/manage_testForm') if result_names != self.result_names or report_src != self.report_src: self.result_names=names self.report_src=report_src report=DocumentTemplate.HTML(report_src)
def manage_test(self,REQUEST):
for p in instance_class.__ac_permissions__: if len(p) > 2: permissions.append((p[0],p[2])) else: permissions.append(p[0])
if hasattr(instance_class, '__ac_permissions__'): for p in instance_class.__ac_permissions__: if len(p) > 2: permissions.append((p[0],p[2])) else: permissions.append(p[0])
def registerClass(self, instance_class=None, meta_type='', permission=None, constructors=(), icon=None, permissions=None, legacy=(), ): """Register a constructor
if (not hasattr(user, 'hasRole') or not user.hasRole(None, roles)):
if (not hasattr(user, 'has_role') or not user.has_role(roles, self)):
def _verifyObjectPaste(self, ob, REQUEST): if not hasattr(ob, 'meta_type'): raise CopyError, MessageDialog( title='Not Supported', message='The object <EM>%s</EM> does not support this ' \ 'operation' % absattr(ob.id), action='manage_main') mt=ob.meta_type if not hasattr(self, 'all_meta_types'): raise CopyError, Messag...
__getattr__=get=__getitem__
__getattr__=__getitem__ def get(self, key, default=None): return self.__getitem__(key, default)
def __getitem__(self,key, default=_marker, # Any special internal marker will do URLmatch=regex.compile('URL[0-9]+$').match, BASEmatch=regex.compile('BASE[0-9]+$').match, ): """Get a variable value
from CGIResponse import Response
from Response import Response
def publish_module_pm(module_name, stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr, environ=os.environ, debug=0): from CGIResponse import Response from Publish import ModulePublisher after_list=[None] request=None try: response=Response(stdout=stdout, stderr=stderr) publisher = ModulePublisher(stdin=stdin, stdo...
skip_names={'testrunner.py': None, 'test_logger.py': None, 'test_MultiMapping.py': None, 'test_Sync.py': None, 'test_ThreadLock.py': None, 'test_acquisition.py': None, 'test_add.py': None, 'test_binding.py': None, 'test_explicit_acquisition.py': None, 'test_func_attr.py': None, 'test_method_hook.py': None, 'test.py': N...
def __init__(self, basepath): # initialize python path self.basepath=path=basepath pjoin=os.path.join if sys.platform == 'win32': sys.path.insert(0, pjoin(path, 'lib/python')) sys.path.insert(1, pjoin(path, 'bin/lib')) sys.path.insert(2, pjoin(path, 'bin/lib/plat-win')) sys.path.insert(3, pjoin(path, 'bin/lib/win32')) ...
skip_name = self.skip_name
def runPath(self, pathname): """Run all tests found in the directory named by pathname and all subdirectories.""" names=os.listdir(pathname) skip_name = self.skip_name for name in names: fname, ext=os.path.splitext(name) if name[:4]=='test' and name[-3:]=='.py' and \ (not skip_name(name)): filepath=os.path.join(pathnam...
(not skip_name(name)):
name != 'testrunner.py':
def runPath(self, pathname): """Run all tests found in the directory named by pathname and all subdirectories.""" names=os.listdir(pathname) skip_name = self.skip_name for name in names: fname, ext=os.path.splitext(name) if name[:4]=='test' and name[-3:]=='.py' and \ (not skip_name(name)): filepath=os.path.join(pathnam...
self.runFile(filepath)
if self.smellsLikeATest(filepath): self.runFile(filepath)
def runPath(self, pathname): """Run all tests found in the directory named by pathname and all subdirectories.""" names=os.listdir(pathname) skip_name = self.skip_name for name in names: fname, ext=os.path.splitext(name) if name[:4]=='test' and name[-3:]=='.py' and \ (not skip_name(name)): filepath=os.path.join(pathnam...
usage_msg="""Usage: python testrunner.py [options]
usage_msg="""Usage: python testrunner.py options
def main(args): usage_msg="""Usage: python testrunner.py [options] If run without options, testrunner will run all test suites found in all subdirectories of the current working directory. options: -a Run all tests found in all subdirectories of the current working directory. This is the default if no options are ...
If run without options, testrunner will run all test suites found in all subdirectories of the current working directory.
If run without options, testrunner will display this usage message. If you want to run all test suites found in all subdirectories of the current working directory, use the -a option.
def main(args): usage_msg="""Usage: python testrunner.py [options] If run without options, testrunner will run all test suites found in all subdirectories of the current working directory. options: -a Run all tests found in all subdirectories of the current working directory. This is the default if no options are ...
should be a fully qualified path to the file to be run.\n"""
should be a fully qualified path to the file to be run. -h Display usage information.\n"""
def main(args): usage_msg="""Usage: python testrunner.py [options] If run without options, testrunner will run all test suites found in all subdirectories of the current working directory. options: -a Run all tests found in all subdirectories of the current working directory. This is the default if no options are ...
options, arg=getopt.getopt(args, 'ad:f:')
options, arg=getopt.getopt(args, 'ahd:f:') if not options: err_exit(usage_msg)
def main(args): usage_msg="""Usage: python testrunner.py [options] If run without options, testrunner will run all test suites found in all subdirectories of the current working directory. options: -a Run all tests found in all subdirectories of the current working directory. This is the default if no options are ...
if not options: test_all=1
def main(args): usage_msg="""Usage: python testrunner.py [options] If run without options, testrunner will run all test suites found in all subdirectories of the current working directory. options: -a Run all tests found in all subdirectories of the current working directory. This is the default if no options are ...
def manage_editCataloger(self, default):
def manage_editCataloger(self, default, REQUEST):
def manage_editCataloger(self, default): """ """ self.default_catalog=default message = "Your changes have been saved" return self.manage_main(self, REQUEST, manage_tabs_message=message)
except: state=[]
except: state=[] if state: md['RESPONSE'].setCookie('state',quote(str(state)[1:-1]+',')) else: md['RESPONSE'].expireCookie('state')
def tpRender(self, md, section): # Check for collapse all, expand all, and state try: collapse_all=md['collapse_all'] except: collapse_all=None if collapse_all: state=[] else: try: expand_all=md['expand_all'] except: expand_all=None if expand_all: # in case of expand all - to maintain state correctly we # have to make...
data.append('<table cellspacing=0>\n')
data.append('<TABLE CELLSPACING="0">\n')
def tpRender(self, md, section): # Check for collapse all, expand all, and state try: collapse_all=md['collapse_all'] except: collapse_all=None if collapse_all: state=[] else: try: expand_all=md['expand_all'] except: expand_all=None if expand_all: # in case of expand all - to maintain state correctly we # have to make...
data.append('</table>\n')
data.append('</TABLE>\n')
def tpRender(self, md, section): # Check for collapse all, expand all, and state try: collapse_all=md['collapse_all'] except: collapse_all=None if collapse_all: state=[] else: try: expand_all=md['expand_all'] except: expand_all=None if expand_all: # in case of expand all - to maintain state correctly we # have to make...
id=item.tpId() e=tpValuesIds(item) if e: id=[id,e] else: id=[id] r.append(id)
if item.tpValues(): id=item.tpId() e=tpValuesIds(item) if e: id=[id,e] else: id=[id] r.append(id)
def tpValuesIds(self): r=[] try: for item in self.tpValues(): try: id=item.tpId() e=tpValuesIds(item) if e: id=[id,e] else: id=[id] r.append(id) except: pass except: pass return r
output('<tr>') if level: output('<td></td>' * level)
output('<TR>\n') if level: output('<TD WIDTH="16"></TD>\n' * level)
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0): # We are being called from above try: items=self.tpValues() except: items=None tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-item-url']=url try: id=self.tpId() except: id=Non...
output('<td valign=top>')
output('<TD WIDTH="16" VALIGN="TOP">')
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0): # We are being called from above try: items=self.tpValues() except: items=None tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-item-url']=url try: id=self.tpId() except: id=Non...
output('<td>') output('</td>\n')
output('<TD WIDTH="16">') output('</TD>\n')
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0): # We are being called from above try: items=self.tpValues() except: items=None tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-item-url']=url try: id=self.tpId() except: id=Non...
output('<td colspan=%s valign=top>' % colspan)
output('<TD COLSPAN="%s" VALIGN="TOP">' % (colspan-level))
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0): # We are being called from above try: items=self.tpValues() except: items=None tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-item-url']=url try: id=self.tpId() except: id=Non...
output('</td></tr>\n')
output('</TD>\n</TR>\n')
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0): # We are being called from above try: items=self.tpValues() except: items=None tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-item-url']=url try: id=self.tpId() except: id=Non...
icoSpace='<IMG SRC="%s/TreeDisplay/Blank_icon.gif" ' \ ' BORDER="0">' % SOFTWARE_URL icoPlus ='<IMG SRC="%s/TreeDisplay/Plus_icon.gif" BORDER="0"' \ ' ALT="+">' % SOFTWARE_URL icoMinus='<IMG SRC="%s/TreeDisplay/Minus_icon.gif" BORDER="0"' \ ' ALT="-">' % SOFTWARE_URL
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0): # We are being called from above try: items=self.tpValues() except: items=None tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-item-url']=url try: id=self.tpId() except: id=Non...
for info in db.transaction_info(first_transaction, last_transaction, path):
try: trans_info=db.transaction_info(first_transaction, last_transaction,path) except: trans_info=[] for info in trans_info:
def undoable_transactions(self, AUTHENTICATION_PATH=None, first_transaction=None, last_transaction=None):
return r
return r or []
def undoable_transactions(self, AUTHENTICATION_PATH=None, first_transaction=None, last_transaction=None):
if defineMacro: self.pushProgram() self.emit("version", TAL_VERSION) self.emit("mode", self.xml and "xml" or "html") todo["defineMacro"] = defineMacro if useMacro: self.pushSlots() self.pushProgram() todo["useMacro"] = useMacro if fillSlot: self.pushProgram() todo["fillSlot"] = fillSlot if defineSlot: self.pushProgram(...
if self.inMacroUse: if fillSlot: self.pushProgram() todo["fillSlot"] = fillSlot self.inMacroUse = 0 else: if fillSlot: raise METALError, ("fill-slot must be within a use-macro", position) if not self.inMacroUse: if defineMacro: self.pushProgram() self.emit("version", TAL_VERSION) self.emit("mode", self.xml and "xml" or...
def emitStartElement(self, name, attrlist, taldict, metaldict, position=(None, None), isend=0): if not taldict and not metaldict: # Handle the simple, common case self.emitStartTag(name, attrlist, isend) self.todoPush({}) if isend: self.emitEndElement(name, isend) return
self.emitStartTag(name, attrlist)
self.emitStartTag(name, list(attrlist))
def emitStartElement(self, name, attrlist, taldict, metaldict, position=(None, None), isend=0): if not taldict and not metaldict: # Handle the simple, common case self.emitStartTag(name, attrlist, isend) self.todoPush({}) if isend: self.emitEndElement(name, isend) return
if not url:
if not url or not self.checkInstallation(REQUEST): REQUEST.set('hide_next', 0)
def tutorialShowLesson(self, id, REQUEST): """ Navigate management frame to a given lesson's screen. """ url=self.lessonURL(id, REQUEST) if not url: return """\
if k is None or k == MV: return 0
def index_object(self, i, obj, threshold=None): """ index and object 'obj' with integer id 'i'""" index = self._index unindex = self._unindex
pdb.set_trace()
def _apply_index(self, request, cid=''): """Apply the index to query parameters given in the argument, request
if hi: setlist = index.items(lo,hi) else: setlist = index.items(lo) for k,set in setlist: if r is None: r = set else: r = r.union(set) except KeyError: pass
if hi: setlist = index.items(lo,hi) else: setlist = index.items(lo) for k, set in setlist: print 'adding set %s to %s' % (tuple(set), id) if r is None: r = set else: r = r.union(set) except KeyError: pass
def _apply_index(self, request, cid=''): """Apply the index to query parameters given in the argument, request
if anyTrue: r=intSet() else: return None
if anyTrue: r=intSet() else: return None print 'UnIndex says there are %s records' % len(r)
def _apply_index(self, request, cid=''): """Apply the index to query parameters given in the argument, request
id='copy%s_of_%s' % (n and n+1 or '', id)
id='copy%s_of_%s' % (n and n+1 or '', orig_id)
def _get_id(ob, id): try: ob=ob.aq_base except: pass n=0 if (len(id) > 8) and (id[8:]=='copy_of_'): n=1 while (hasattr(ob, id)): id='copy%s_of_%s' % (n and n+1 or '', id) n=n+1 return id
if __debug__:
if Z_DEBUG_MODE:
def pt_render(self, source=0, extra_context={}): """Render this Page Template""" if self._v_errors: raise RuntimeError, 'Page Template %s has errors.' % self.id output = StringIO() c = self.pt_getContext() c.update(extra_context) if __debug__: __traceback_info__ = pprint.pformat(c)
def manage_move_objects_up(self, REQUEST, ids=None, delta=None):
def manage_move_objects_up(self, REQUEST, ids=None, delta=1):
def manage_move_objects_up(self, REQUEST, ids=None, delta=None): """ Move specified sub-objects up by delta in container. """ if ids: try: attempt = self.moveObjectsUp(ids, delta) message = '%d item%s moved up.' % ( attempt, ( (attempt!=1) and 's' or '' ) ) except ValueError, errmsg: message = 'Error: %s' % (errmsg) el...
def manage_move_objects_down(self, REQUEST, ids=None, delta=None):
def manage_move_objects_down(self, REQUEST, ids=None, delta=1):
def manage_move_objects_down(self, REQUEST, ids=None, delta=None): """ Move specified sub-objects down by delta in container. """ if ids: try: attempt = self.moveObjectsDown(ids, delta) message = '%d item%s moved down.' % ( attempt, ( (attempt!=1) and 's' or '' ) ) except ValueError, errmsg: message = 'Error: %s' % (er...
try: sm= response.setMessage except: sm= None
sm = None if response is not None: sm = getattr(response, "setMessage", None)
def publish(request, module_name, after_list, debug=0, # Optimize: call_object=call_object, missing_name=missing_name, dont_publish_class=dont_publish_class, mapply=mapply, ): (bobo_before, bobo_after, object, realm, debug_mode, err_hook, validated_hook, transactions_manager)= get_module_info(module_name) parents=Non...
object = object + 1
object += 1
def __iadd__(self, other): return self.__class__(self.value + other)
r"\s*(?:(global|local)\s+)?(%s)\s+(.*)" % NAME_RE, part)
r"(?s)\s*(?:(global|local)\s+)?(%s)\s+(.*)\Z" % NAME_RE, part)
def emitDefines(self, defines, position): for part in splitParts(defines): m = re.match( r"\s*(?:(global|local)\s+)?(%s)\s+(.*)" % NAME_RE, part) if not m: raise TALError("invalid define syntax: " + `part`, position) scope, name, expr = m.group(1, 2, 3) scope = scope or "local" cexpr = self.compileExpression(expr) if s...
m = re.match("\s*(%s)\s+(.*)" % NAME_RE, arg)
m = re.match("(?s)\s*(%s)\s+(.*)\Z" % NAME_RE, arg)
def emitRepeat(self, arg): m = re.match("\s*(%s)\s+(.*)" % NAME_RE, arg) if not m: raise TALError("invalid repeat syntax: " + `repeat`) name, expr = m.group(1, 2) cexpr = self.compileExpression(expr) program = self.popProgram() self.emit("loop", name, cexpr, program)
refer to the HTML source for this page.
refer to error log.
def _error_html(self,title,body): # XXX could this try to use standard_error_message somehow? return ("""\
p = aq_parent(aq_inner(self)
p = aq_parent(aq_inner(self))
def getPhysicalPath(self): '''Returns a path (an immutable sequence of strings) that can be used to access this object again later, for example in a copy/paste operation. getPhysicalRoot() and getPhysicalPath() are designed to operate together. ''' path = (self.getId(),) p = aq_parent(aq_inner(self) if p is not None:...
try: mtime=os.stat(self.filename)[8] except: mtime=0 if hasattr(self, '_v_program') and mtime == self._v_last_read:
try: mtime = os.path.getmtime(self.filename) except OSError: mtime = 0 if self._v_program is not None and mtime == self._v_last_read:
def _cook_check(self): if self._v_last_read and not DevelopmentMode: return __traceback_info__ = self.filename try: mtime=os.stat(self.filename)[8] except: mtime=0 if hasattr(self, '_v_program') and mtime == self._v_last_read: return self.pt_edit(open(self.filename), None) self._cook() if self._v_errors: LOG('PageTe...
try: db=self._jar.db()
try: db=self._p_jar.db()
def __bobo_traverse__(self, REQUEST, name): if name[-9:]=='__draft__': return getattr(self, name)
try: db=self._jar.db()
try: db=self._p_jar.db()
def nonempty(self): try: db=self._jar.db() except: # BoboPOS 2 return Globals.VersionBase[self._version].nonempty() else: # ZODB 3 return not db.versionEmpty(self._version)
try: db=self._jar.db()
try: db=self._p_jar.db()
def manage_Save__draft__(self, remark, REQUEST=None): """Make version changes permanent""" try: db=self._jar.db() except: # BoboPOS 2 Globals.VersionBase[self._version].commit(remark) else: # ZODB 3 s=self._version d=self._p_jar.getVersion() if d==s: d='' db.commitVersion(s, d) if REQUEST: REQUEST['RESPONSE'].redirect...
try: db=self._jar.db()
try: db=self._p_jar.db()
def manage_Discard__draft__(self, REQUEST=None): 'Discard changes made during the version' try: db=self._jar.db() except: # BoboPOS 2 Globals.VersionBase[self._version].abort() else: # ZODB 3 db.abortVersion(self._version)
if security.validate(accessed, container, name, value, roles): return 1
if roles is _noroles: if security.validate(accessed, container, name, value): return 1 else: if security.validate(accessed, container, name, value, roles): return 1
def authorize(self, user, accessed, container, name, value, roles): user = getattr(user, 'aq_base', user).__of__(self) newSecurityManager(None, user) security = getSecurityManager() try: try: if security.validate(accessed, container, name, value, roles): return 1 except: noSecurityManager() raise except Unauthorized: p...