rem
stringlengths 0
322k
| add
stringlengths 0
2.05M
| context
stringlengths 8
228k
|
---|---|---|
def __init__(self, product, dest, REQUEST): | def __init__(self, product, dest, REQUEST=None): | def __init__(self, product, dest, REQUEST): if hasattr(product,'aq_base'): product=product.aq_base self._product=product self._d=dest v=REQUEST['URL'] v=v[:rfind(v,'/')] self._u=v[:rfind(v,'/')] |
v=REQUEST['URL'] v=v[:rfind(v,'/')] self._u=v[:rfind(v,'/')] | if REQUEST is not None: v=REQUEST['URL'] v=v[:rfind(v,'/')] self._u=v[:rfind(v,'/')] | def __init__(self, product, dest, REQUEST): if hasattr(product,'aq_base'): product=product.aq_base self._product=product self._d=dest v=REQUEST['URL'] v=v[:rfind(v,'/')] self._u=v[:rfind(v,'/')] |
class ZPTMacros(unittest.TestCase): | class ZPTMacros(zope.component.testing.PlacelessSetup, unittest.TestCase): | def testAddWithRequestButNoFile(self): """Collector #596: manage_add with text but no file""" request = self.app.REQUEST self._addPT('pt1', text=self.text, REQUEST=request) # no object is returned when REQUEST is passed. pt = self.app.pt1 self.assertEqual(pt.document_src(), self.text) |
'regex': _stringInput, 'Regex': _stringInput, 'regexs': _stringInput, 'Regexs': _stringInput, 'tokens': _stringInput, | 'tokens': _tokensInput, | def _textInput(self,n,t,v): return ('<TEXTAREA NAME="%s" ROWS="10" COLS="40">%s</TEXTAREA>' |
def manage_catalogClear(self, REQUEST, RESPONSE, URL1): | def manage_catalogClear(self, REQUEST=None, RESPONSE=None, URL1=None): | def manage_catalogClear(self, REQUEST, RESPONSE, URL1): """ clears the whole enchelada """ self._catalog.clear() |
RESPONSE.redirect(URL1 + '/manage_catalogView?manage_tabs_message=Catalog%20Cleared') | if REQUEST and RESPONSE: RESPONSE.redirect(URL1 + '/manage_catalogView?manage_tabs_message=Catalog%20Cleared') | def manage_catalogClear(self, REQUEST, RESPONSE, URL1): """ clears the whole enchelada """ self._catalog.clear() |
def manage_addColumn(self, name, REQUEST, RESPONSE, URL1): | def manage_addColumn(self, name, REQUEST=None, RESPONSE=None, URL1=None): | def manage_addColumn(self, name, REQUEST, RESPONSE, URL1): """ add a column """ self._catalog.addColumn(name) |
RESPONSE.redirect(URL1 + '/manage_catalogSchema?manage_tabs_message=Column%20Added') def manage_delColumns(self, names, REQUEST, RESPONSE, URL1): | if REQUEST and RESPONSE: RESPONSE.redirect(URL1 + '/manage_catalogSchema?manage_tabs_message=Column%20Added') def manage_delColumns(self, names, REQUEST=None, RESPONSE=None, URL1=None): | def manage_addColumn(self, name, REQUEST, RESPONSE, URL1): """ add a column """ self._catalog.addColumn(name) |
RESPONSE.redirect(URL1 + '/manage_catalogSchema?manage_tabs_message=Column%20Deleted') def manage_addIndex(self, name, type, REQUEST, RESPONSE, URL1): | if REQUEST and RESPONSE: RESPONSE.redirect(URL1 + '/manage_catalogSchema?manage_tabs_message=Column%20Deleted') def manage_addIndex(self, name, type, REQUEST=None, RESPONSE=None, URL1=None): | def manage_delColumns(self, names, REQUEST, RESPONSE, URL1): """ del a column """ for name in names: self._catalog.delColumn(name) |
RESPONSE.redirect(URL1 + '/manage_catalogIndexes?manage_tabs_message=Index%20Added') def manage_delIndexes(self, names, REQUEST, RESPONSE, URL1): | if REQUEST and RESPONSE: RESPONSE.redirect(URL1 + '/manage_catalogIndexes?manage_tabs_message=Index%20Added') def manage_delIndexes(self, names, REQUEST=None, RESPONSE=None, URL1=None): | def manage_addIndex(self, name, type, REQUEST, RESPONSE, URL1): """ add an index """ self._catalog.addIndex(name, type) RESPONSE.redirect(URL1 + '/manage_catalogIndexes?manage_tabs_message=Index%20Added') |
RESPONSE.redirect(URL1 + '/manage_catalogIndexes?manage_tabs_message=Index%20Deleted') | if REQUEST and RESPONSE: RESPONSE.redirect(URL1 + '/manage_catalogIndexes?manage_tabs_message=Index%20Deleted') | def manage_delIndexes(self, names, REQUEST, RESPONSE, URL1): """ del an index """ for name in names: self._catalog.delIndex(name) RESPONSE.redirect(URL1 + '/manage_catalogIndexes?manage_tabs_message=Index%20Deleted') |
s=list(s[1]) | s=s[1] if type(s)==type(()): s=list(s) | def apply_diff(state, diff, expand): if not diff: return s=[None, state] diff.reverse() __traceback_info__=s, diff while diff: id=diff[-1] del diff[-1] if len(s)==1: s.append([]) s=list(s[1]) loc=-1 for i in range(len(s)): if s[i][0]==id: loc=i break if loc >= 0: if not diff and not expand: del s[loc] else: s=s[loc] elif diff or expand: s.append([id,[]]) s=s[-1][1] while diff: id=diff[-1] del diff[-1] if diff or expand: s.append([id,[]]) s=s[-1][1] |
if e > 0: args=text[n:e] if ent_name(text[n+1:e]) > 0: d=self.__dict__ d=self.__dict__ d[0]=text[s:e+1] d[1]=d['end']='' d[2]=d['name']='var' d[3]=d['args']=args return s | if e < 0: break args=text[n:e] if ent_name(text[n+1:e]) > 0: d=self.__dict__ d=self.__dict__ d[0]=text[s:e+1] d[1]=d['end']='' d[2]=d['name']='var' d[3]=d['args']=args return s | def search(self, text, start=0, name_match=regex.compile('[\0- ]*[a-zA-Z]+[\0- ]*').match, end_match=regex.compile('[\0- ]*\(/\|end\)', regex.casefold).match, start_search=regex.compile('[<&]').search, ent_name=regex.compile('[-a-zA-Z0-9_.]+').match, find=find, strip=strip ): |
__roles__=[] | def has_permission(self, permission, object): return 1 |
|
""" | """ % (id, id) | def _view_widget_for_type(self, t, id): if t not in ('lines', 'tokens'): return '<!--#var %s-->' % id return """ <!--#in %s--> <!--#var sequence-item--> <!--#in %s--> """ |
if not month or month > 12: raise self.SyntaxError, string | if not month: raise SyntaxError,string if month > 12: tmp=month month=day day=tmp | def _parse(self,string): |
"could not load package %s: %s" % (package, str(e)), | "could not load package %s: %s" % (package, repr(e)), | def schemaComponentSource(self, package, file): parts = package.split(".") if not parts: raise ZConfig.SchemaError( "illegal schema component name: " + `package`) if "" in parts: # '' somewhere in the package spec; still illegal raise ZConfig.SchemaError( "illegal schema component name: " + `package`) file = file or "component.xml" try: __import__(package) except ImportError, e: raise ZConfig.SchemaResourceError( "could not load package %s: %s" % (package, str(e)), filename=file, package=package) pkg = sys.modules[package] if not hasattr(pkg, "__path__"): raise ZConfig.SchemaResourceError( "import name does not refer to a package", filename=file, package=package) for dir in pkg.__path__: dirname = os.path.abspath(dir) fn = os.path.join(dirname, file) if os.path.exists(fn): return "file://" + urllib.pathname2url(fn) else: raise ZConfig.SchemaResourceError("schema component not found", filename=file, package=package, path=pkg.__path__) |
for id in self.objectIds_d(spec): a((id, g(id))) | for id in self.objectIds_d(t): a((id, g(id))) | def objectItems_d(self,t=None): r=[] a=r.append g=self._getOb for id in self.objectIds_d(spec): a((id, g(id))) return r |
self.program = [os.path.join(self.directory, "bin", "runzope")] | if config.runner and config.runner.program: self.program = config.runner.program else: self.program = [os.path.join(self.directory, "bin", "runzope")] | def realize(self, *args, **kw): ZDOptions.realize(self, *args, **kw) config = self.configroot self.directory = config.instancehome self.clienthome = config.clienthome self.program = [os.path.join(self.directory, "bin", "runzope")] self.sockname = os.path.join(self.clienthome, "zopectlsock") self.user = None self.python = sys.executable self.zdrun = os.path.join(os.path.dirname(zdaemon.__file__), "zdrun.py") self.exitcodes = [0, 2] if self.logfile is None and config.eventlog is not None: for handler in config.eventlog.handler_factories: if isinstance(handler, FileHandlerFactory): self.logfile = handler.section.path if self.logfile not in ("STDERR", "STDOUT"): break |
'config.setConfiguration(opts.configroot); ' % | 'config.setConfiguration(opts.configroot); ' 'from Zope.Startup import do_posix_stuff; ' 'do_posix_stuff(opts.configroot); '% | def get_startup_cmd(self, python, more): cmdline = ( '%s -c "from Zope.Startup.options import ZopeOptions; ' 'from Zope.Startup import handlers as h; ' 'from App import config; ' 'opts=ZopeOptions(); ' 'opts.configfile=\'%s\'; ' 'opts.realize(); ' 'h.handleConfig(opts.configroot,opts.confighandlers);' 'config.setConfiguration(opts.configroot); ' % (python, self.options.configfile) ) return cmdline + more + '\"' |
def do_run( self, arg ): | def do_run(self, arg): self.setuid() | def do_run( self, arg ): cmdline = self.get_startup_cmd(self.options.python, 'import Zope; app=Zope.app(); execfile(\'%s\')' % arg) os.system(cmdline) |
value=join(value, ' ') | value=join(str(value), ' ') | def dav__allprop(self, propstat=propstat, join=string.join): # DAV helper method - return one or more propstat elements # indicating property names and values for all properties. result=[] for item in self._propertyMap(): name, type=item['id'], item.get('type','string') value=self.getProperty(name) if type=='tokens': value=join(value, ' ') elif type=='lines': value=join(value, '\n') # check for xml property attrs=item.get('meta', {}).get('__xml_attrs__', None) if attrs is not None: attrs=map(lambda n: ' %s="%s"' % n, attrs.items()) attrs=join(attrs, '') else: # Quote non-xml items here? attrs='' |
value=join(value, '\n') | value=join(str(value), '\n') | def dav__allprop(self, propstat=propstat, join=string.join): # DAV helper method - return one or more propstat elements # indicating property names and values for all properties. result=[] for item in self._propertyMap(): name, type=item['id'], item.get('type','string') value=self.getProperty(name) if type=='tokens': value=join(value, ' ') elif type=='lines': value=join(value, '\n') # check for xml property attrs=item.get('meta', {}).get('__xml_attrs__', None) if attrs is not None: attrs=map(lambda n: ' %s="%s"' % n, attrs.items()) attrs=join(attrs, '') else: # Quote non-xml items here? attrs='' |
value=join(value, ' ') | value=join(str(value), ' ') | def dav__propstat(self, name, result, propstat=propstat, propdesc=propdesc, join=string.join): # DAV helper method - return a propstat element indicating # property name and value for the requested property. xml_id=self.xml_namespace() propdict=self._propdict() if not propdict.has_key(name): prop='<n:%s xmlns:n="%s"/>\n' % (name, xml_id) code='404 Not Found' if not result.has_key(code): result[code]=[prop] else: result[code].append(prop) return else: item=propdict[name] name, type=item['id'], item.get('type','string') value=self.getProperty(name) if type=='tokens': value=join(value, ' ') elif type=='lines': value=join(value, '\n') # allow for xml properties attrs=item.get('meta', {}).get('__xml_attrs__', None) if attrs is not None: attrs=map(lambda n: ' %s="%s"' % n, attrs.items()) attrs=join(attrs, '') else: # quote non-xml items here? attrs='' prop='<n:%s%s xmlns:n="%s">%s</n:%s>\n' % ( name, attrs, xml_id, value, name) code='200 OK' if not result.has_key(code): result[code]=[prop] else: result[code].append(prop) return |
value=join(value, '\n') | value=join(str(value), '\n') | def dav__propstat(self, name, result, propstat=propstat, propdesc=propdesc, join=string.join): # DAV helper method - return a propstat element indicating # property name and value for the requested property. xml_id=self.xml_namespace() propdict=self._propdict() if not propdict.has_key(name): prop='<n:%s xmlns:n="%s"/>\n' % (name, xml_id) code='404 Not Found' if not result.has_key(code): result[code]=[prop] else: result[code].append(prop) return else: item=propdict[name] name, type=item['id'], item.get('type','string') value=self.getProperty(name) if type=='tokens': value=join(value, ' ') elif type=='lines': value=join(value, '\n') # allow for xml properties attrs=item.get('meta', {}).get('__xml_attrs__', None) if attrs is not None: attrs=map(lambda n: ' %s="%s"' % n, attrs.items()) attrs=join(attrs, '') else: # quote non-xml items here? attrs='' prop='<n:%s%s xmlns:n="%s">%s</n:%s>\n' % ( name, attrs, xml_id, value, name) code='200 OK' if not result.has_key(code): result[code]=[prop] else: result[code].append(prop) return |
def db_name(self): return self._p_jar.db.file_name | def db_name(self): return Globals.Bobobase._jar.db.file_name | def db_name(self): return self._p_jar.db.file_name |
path=string.split(URL2, REQUEST.script)[1][1:] | path=urllib.unquote(string.split(URL2, REQUEST.script)[1]) | def manage_catalogFoundItems(self, REQUEST, RESPONSE, URL2, URL1, obj_metatypes=None, obj_ids=None, obj_searchterm=None, obj_expr=None, obj_mtime=None, obj_mspec=None, obj_roles=None, obj_permission=None): """ Find object according to search criteria and Catalog them """ |
pass | zLOG.LOG('Z2', zLOG.WARNING, 'A handler for %s failed!' % signame, error=sys.exc_info()) | def signalHandler(self, signum, frame): """Meta signal handler that dispatches to registered handlers.""" signame = zdaemon.Daemon.get_signal_name(signum) zLOG.LOG('Z2', zLOG.INFO , "Caught signal %s" % signame) |
if hasattr(sys, '__lg') and hasattr(sys.__lg, 'reopen'): sys.__lg.reopen() | reopen = getattr(getattr(sys, '__lg', None), 'reopen', None) if reopen is not None: reopen() | def sigusr2Handler(self): """Reopen log files on SIGUSR2. This is registered first, so it should be called after all other SIGUSR2 handlers.""" zLOG.LOG('Z2', zLOG.INFO , "Reopening log files") if hasattr(sys, '__lg') and hasattr(sys.__lg, 'reopen'): sys.__lg.reopen() zLOG.LOG('Z2', zLOG.BLATHER, "Reopened access log") if (hasattr(sys, '__detailedlog') and hasattr(sys.__detailedlog, 'reopen')): zLOG.LOG('Z2', zLOG.BLATHER,"Reopened detailed request log") sys.__detailedlog.reopen() if hasattr(zLOG, '_set_stupid_dest'): zLOG._set_stupid_dest(None) else: zLOG._stupid_dest = None ZLogger.stupidFileLogger._stupid_dest = None zLOG.LOG('Z2', zLOG.BLATHER, "Reopened event log") zLOG.LOG('Z2', zLOG.INFO, "Log files reopened successfully") |
if (hasattr(sys, '__detailedlog') and hasattr(sys.__detailedlog, 'reopen')): | reopen = getattr(getattr(sys, '__detailedlog', None), 'reopen', None) if reopen is not None: reopen() | def sigusr2Handler(self): """Reopen log files on SIGUSR2. This is registered first, so it should be called after all other SIGUSR2 handlers.""" zLOG.LOG('Z2', zLOG.INFO , "Reopening log files") if hasattr(sys, '__lg') and hasattr(sys.__lg, 'reopen'): sys.__lg.reopen() zLOG.LOG('Z2', zLOG.BLATHER, "Reopened access log") if (hasattr(sys, '__detailedlog') and hasattr(sys.__detailedlog, 'reopen')): zLOG.LOG('Z2', zLOG.BLATHER,"Reopened detailed request log") sys.__detailedlog.reopen() if hasattr(zLOG, '_set_stupid_dest'): zLOG._set_stupid_dest(None) else: zLOG._stupid_dest = None ZLogger.stupidFileLogger._stupid_dest = None zLOG.LOG('Z2', zLOG.BLATHER, "Reopened event log") zLOG.LOG('Z2', zLOG.INFO, "Log files reopened successfully") |
sys.__detailedlog.reopen() | def sigusr2Handler(self): """Reopen log files on SIGUSR2. This is registered first, so it should be called after all other SIGUSR2 handlers.""" zLOG.LOG('Z2', zLOG.INFO , "Reopening log files") if hasattr(sys, '__lg') and hasattr(sys.__lg, 'reopen'): sys.__lg.reopen() zLOG.LOG('Z2', zLOG.BLATHER, "Reopened access log") if (hasattr(sys, '__detailedlog') and hasattr(sys.__detailedlog, 'reopen')): zLOG.LOG('Z2', zLOG.BLATHER,"Reopened detailed request log") sys.__detailedlog.reopen() if hasattr(zLOG, '_set_stupid_dest'): zLOG._set_stupid_dest(None) else: zLOG._stupid_dest = None ZLogger.stupidFileLogger._stupid_dest = None zLOG.LOG('Z2', zLOG.BLATHER, "Reopened event log") zLOG.LOG('Z2', zLOG.INFO, "Log files reopened successfully") |
|
self.__name__, expr = name, expr | self.__name__, self.expr = name, expr | def __init__(self, blocks): |
'manage_addIndex', 'manage_delIndexs', 'manage_main',], | 'manage_addIndex', 'manage_delIndexes', 'manage_main',], | def manage_addZCatalog(self,id,title,REQUEST=None): """Add a ZCatalog object """ c=ZCatalog(id,title) self._setObject(id,c) if REQUEST is not None: return self.manage_main(self,REQUEST) |
self._properties=self._properties+({'id':id,'type':type},) self._setPropValue(id, value) | if type in ('selection', 'multiple selection'): if not hasattr(self, value): raise 'Bad Request', 'No select variable %s' % value self._properties=self._properties + ( {'id':id, 'type':type, 'select_variable':value},) self._setPropValue(id, '') else: self._properties=self._properties+({'id':id,'type':type},) self._setPropValue(id, value) | def _setProperty(self, id, value, type='string'): if not self.valid_property_id(id): raise 'Bad Request', 'Invalid or duplicate property id' self._properties=self._properties+({'id':id,'type':type},) self._setPropValue(id, value) |
"""The last child of this node. If ther is no such node | """The last child of this node. If there is no such node | def getLastChild(self): """The last child of this node. If ther is no such node this returns None.""" return None |
"""The last child of this node. If ther is no such node | """The last child of this node. If there is no such node | def getLastChild(self): """The last child of this node. If ther is no such node this returns None.""" children = self.getChildNodes() if children: return children._data[-1] return None |
return sys.modules[__name__[:rfind(__name__,'.')]].__path__[0] | return sys.modules[__name__].__path__[0] | def package_home(globals_dict): |
f=Fault(-1, "Unexpected Zope exception: " + str(v)) | f=Fault(-1, 'Unexpected Zope exception: %s' % value) | def exception(self, fatal=0, info=None, absuri_match=None, tag_search=None): # Fetch our exception info. t is type, v is value and tb is the # traceback object. if type(info) is type(()) and len(info)==3: t,v,tb = info else: t,v,tb = sys.exc_info() |
f=Fault(-2, "Unexpected Zope error value: " + str(v)) | f=Fault(-2, 'Unexpected Zope error value: %s' % value) | def exception(self, fatal=0, info=None, absuri_match=None, tag_search=None): # Fetch our exception info. t is type, v is value and tb is the # traceback object. if type(info) is type(()) and len(info)==3: t,v,tb = info else: t,v,tb = sys.exc_info() |
<<<<<<< ZCatalog.py | def manage_addZCatalog(self, id, title, vocab_id=None, REQUEST=None): """Add a ZCatalog object """ id=str(id) title=str(title) vocab_id=str(vocab_id) if vocab_id == 'create_default_catalog_': vocab_id = None c=ZCatalog(id, title, vocab_id, self) self._setObject(id, c) if REQUEST is not None: return self.manage_main(self, REQUEST) |
|
)+Folder.manage_options ======= 'help':('ZCatalog','ZCatalog_Status.dtml')}, | def manage_addZCatalog(self, id, title, vocab_id=None, REQUEST=None): """Add a ZCatalog object """ id=str(id) title=str(title) vocab_id=str(vocab_id) if vocab_id == 'create_default_catalog_': vocab_id = None c=ZCatalog(id, title, vocab_id, self) self._setObject(id, c) if REQUEST is not None: return self.manage_main(self, REQUEST) |
|
>>>>>>> 1.60 | def manage_addZCatalog(self, id, title, vocab_id=None, REQUEST=None): """Add a ZCatalog object """ id=str(id) title=str(title) vocab_id=str(vocab_id) if vocab_id == 'create_default_catalog_': vocab_id = None c=ZCatalog(id, title, vocab_id, self) self._setObject(id, c) if REQUEST is not None: return self.manage_main(self, REQUEST) |
|
return self.manage_CacheParameters(self,REQUEST) | return self.manage_cacheParameters(self,REQUEST) | def manage_cache_size(self,value,REQUEST): |
for id in self._objects: | def tpValues(self): # Return a list of subobjects, used by tree tag. r=[] if hasattr(aq_base(self), 'tree_ids'): tree_ids=self.tree_ids try: tree_ids=list(tree_ids) except TypeError: pass if hasattr(tree_ids, 'sort'): tree_ids.sort() for id in tree_ids: if hasattr(self, id): r.append(self._getOb(id)) else: obj_ids=self.objectIds() obj_ids.sort() for id in obj_ids: for id in self._objects: o=self._getOb(id) if hasattr(o, 'isPrincipiaFolderish') and \ o.isPrincipiaFolderish: r.append(o) return r |
|
not (d['product']==product and d['id']==id), | not (d['product'] in (product, 'methods') and d['id']==id), | def _manage_remove_product_data(self, type, product, id): values=filter( lambda d, product=product, id=id: not (d['product']==product and d['id']==id), self.aq_maybe('_getProductRegistryData')(type) ) |
if size < n: read(size), size | if size < n: return read(size), size | def _read_data(self, file): n=1<<16 if type(file) is type(''): size=len(file) if size < n: return file, size return Pdata(file), size seek=file.seek read=file.read seek(0,2) size=end=file.tell() jar=self._p_jar if size <= 2*n or jar is None or Globals.DatabaseVersion=='2': seek(0) if size < n: read(size), size return Pdata(read(size)), size |
if product is not None: self.__of__(product)._register() | def __init__(self, id, title, object_type, initial, product=None): self.id=id self.title=title self.object_type=object_type self.initial=initial if product is not None: self.__of__(product)._register() |
|
if getattr(container, '__class__', None) is Product.Product: | if (item is self or getattr(container, '__class__', None) is Product.Product): | def manage_afterAdd(self, item, container): if hasattr(self, 'aq_parent'): container=self.aq_parent elif item is not self: container=None |
if getattr(container, '__class__', None) is Product.Product: | if (item is self or getattr(container, '__class__', None) is Product.Product): | def manage_beforeDelete(self, item, container): if hasattr(self, 'aq_parent'): container=self.aq_parent elif item is not self: container=None |
sequence=self.sort_sequence(sequence) | sequence=self.sort_sequence(sequence, md) | def renderwb(self, md): expr=self.expr name=self.__name__ if expr is None: sequence=md[name] cache={ name: sequence } else: sequence=expr(md) cache=None |
sequence=self.sort_sequence(sequence) | sequence=self.sort_sequence(sequence, md) | def renderwob(self, md): """RENDER WithOutBatch""" expr=self.expr name=self.__name__ if expr is None: sequence=md[name] cache={ name: sequence } else: sequence=expr(md) cache=None |
def sort_sequence(self, sequence): | def sort_sequence(self, sequence, md): | def sort_sequence(self, sequence): |
sortfields = split(sort,',') | need_sortfunc = find(sort, '/') >= 0 sortfields = split(sort, ',') | def sort_sequence(self, sequence): |
s.sort() | if need_sortfunc: by = SortBy(multsort, sf_list) s.sort(by) else: s.sort() | def sort_sequence(self, sequence): |
default_license=0 | default_license=30 | def lic_check(product_name): default_license=0 path_join =os.path.join product_dir=path_join(SOFTWARE_HOME,'lib/python/Products') package_dir=path_join(product_dir, product_name) bobobase =Globals.Bobobase try: f=open(path_join(package_dir,'%s.lic' % product_name), 'rb') except: f, val = None, default_license if f is not None: dat=lcd(f.read()) f.close() if dat is None: name, val = '', default_license else: [name, val]=dat[:2] if name != product_name: val=default_license elif val is None: return 1 if not bobobase.has_key('_t_'): t=bobobase['_t_']={} else: t=bobobase['_t_'] if not t.has_key(product_name): t[product_name]=time.time() bobobase['_t_']=t if (t[product_name] + (86400.0 * val)) <= time.time(): # License has expired! product=getattr(__import__("Products.%s" % product_name), product_name) for s in pgetattr(product, 'classes', ()): p=rfind(s,'.') m='Products.%s.%s' % (product_name, s[:p]) c=s[p+1:] try: __import__(m) except: m=s[:p] __import__(m) setattr(sys.modules[m], c, Expired) return 0 return 1 |
def first(self,name): | def first(self,name,key=''): | def first(self,name): |
def last(self,name): | def last(self,name,key=''): | def last(self,name): |
def statistics(self,name): | def statistics(self,name,key): | def statistics(self,name): |
def next_batches(self, suffix='batches'): if suffix != 'batches': raise KeyError, 'next-batches' | return data[key] def next_batches(self, suffix='batches',key=''): if suffix != 'batches': raise KeyError, key | def statistics(self,name): |
def previous_batches(self, suffix='batches'): if suffix != 'batches': raise KeyError, 'previous-batches' | def previous_batches(self, suffix='batches',key=''): if suffix != 'batches': raise KeyError, key | def previous_batches(self, suffix='batches'): |
'sequence-index': lambda self, suffix: self['sequence-'+suffix], 'sequence-index-is': lambda self, suffix: self['sequence-'+suffix], | 'sequence-index': lambda self, suffix, key: self['sequence-'+suffix], 'sequence-index-is': lambda self, suffix, key: self['sequence-'+suffix], | def previous_batches(self, suffix='batches'): |
return special_prefixes[prefix](self, suffix) | return special_prefixes[prefix](self, suffix, key) | def __getitem__(self,key, special_prefixes=special_prefixes, special_prefix=special_prefixes.has_key ): data=self.data if data.has_key(key): return data[key] |
headers, html = ts_reulsts[1] | headers, html = ts_results[1] | def decapitate(html, RESPONSE=None, header_re=ts_regex.compile( '\(\(' '[^\0- <>:]+:[^\n]*\n' '\|' '[ \t]+[^\0- ][^\n]*\n' '\)+\)[ \t]*\n\([\0-\377]+\)' ), space_re=ts_regex.compile('\([ \t]+\)'), name_re=ts_regex.compile('\([^\0- <>:]+\):\([^\n]*\)'), ): ts_results = header_re.match_group(html, (1,3)) if not ts_results: return html headers, html = ts_reulsts[1] headers=string.split(headers,'\n') i=1 while i < len(headers): if not headers[i]: del headers[i] else: ts_results = space_re.match_group(headers[i], (1,)) if ts_reults: headers[i-1]="%s %s" % (headers[i-1], headers[i][len(ts_reults[1]):]) del headers[i] else: i=i+1 for i in range(len(headers)): ts_results = name_re.match_group(headers[i], (1,2)) if ts_reults: k, v = ts_reults[1] v=string.strip(v) else: raise ValueError, 'Invalid Header (%d): %s ' % (i,headers[i]) RESPONSE.setHeader(k,v) return html |
if ts_reults: | if ts_results: | def decapitate(html, RESPONSE=None, header_re=ts_regex.compile( '\(\(' '[^\0- <>:]+:[^\n]*\n' '\|' '[ \t]+[^\0- ][^\n]*\n' '\)+\)[ \t]*\n\([\0-\377]+\)' ), space_re=ts_regex.compile('\([ \t]+\)'), name_re=ts_regex.compile('\([^\0- <>:]+\):\([^\n]*\)'), ): ts_results = header_re.match_group(html, (1,3)) if not ts_results: return html headers, html = ts_reulsts[1] headers=string.split(headers,'\n') i=1 while i < len(headers): if not headers[i]: del headers[i] else: ts_results = space_re.match_group(headers[i], (1,)) if ts_reults: headers[i-1]="%s %s" % (headers[i-1], headers[i][len(ts_reults[1]):]) del headers[i] else: i=i+1 for i in range(len(headers)): ts_results = name_re.match_group(headers[i], (1,2)) if ts_reults: k, v = ts_reults[1] v=string.strip(v) else: raise ValueError, 'Invalid Header (%d): %s ' % (i,headers[i]) RESPONSE.setHeader(k,v) return html |
def decapitate(html, RESPONSE=None, header_re=ts_regex.compile( '\(\(' '[^\n\0\- <>:]+:[^\n]*\n' '\|' '[ \t]+[^\0\- ][^\n]*\n' '\)+\)[ \t]*\n\([\0-\377]+\)' ), space_re=ts_regex.compile('\([ \t]+\)'), name_re=ts_regex.compile('\([^\0\- <>:]+\):\([^\n]*\)'), ): ts_results = header_re.match_group(html, (1,3)) if not ts_results: return html headers, html = ts_results[1] headers=split(headers,'\n') i=1 while i < len(headers): if not headers[i]: del headers[i] continue ts_results = space_re.match_group(headers[i], (1,)) if ts_results: headers[i-1]="%s %s" % (headers[i-1], headers[i][len(ts_results[1]):]) del headers[i] continue i=i+1 for i in range(len(headers)): ts_results = name_re.match_group(headers[i], (1,2)) if ts_results: k, v = ts_results[1] v=strip(v) else: raise ValueError, 'Invalid Header (%d): %s ' % (i,headers[i]) RESPONSE.setHeader(k,v) return html | import re from string import find, strip token = "[a-zA-Z0-9! hdr_start = re.compile('(%s):(.*)' % token).match def decapitate(html, RESPONSE=None): headers = [] spos = 0 while 1: m = hdr_start(html, spos) if not m: if html[spos:spos+1] == '\n': break return html header = list(m.groups()) headers.append(header) spos = m.end() + 1 while spos < len(html) and html[spos] in ' \t': eol = find(html, '\n', spos) if eol < 0: return html header.append(strip(html[spos:eol])) spos = eol + 1 if RESPONSE is not None: for header in headers: hkey = header.pop(0) RESPONSE.setHeader(hkey, join(header, ' ')) return html[spos + 1:] | def manage_FTPget(self): "Get source for FTP download" return self.read() |
if REQUEST: return self.manage_main(self,REQUEST,update_menu=1) | if REQUEST is not None: REQUEST['RESPONSE'].redirect(self.absolute_url()+'/manage_main') | def manage_addUserFolder(self,dtself=None,REQUEST=None,**ignored): """ """ f=UserFolder() self=self.this() try: self._setObject('acl_users', f) except: return MessageDialog( title ='Item Exists', message='This object already contains a User Folder', action ='%s/manage_main' % REQUEST['URL1']) self.__allow_groups__=f if REQUEST: return self.manage_main(self,REQUEST,update_menu=1) |
if self.precondition and hasattr(self,self.precondition): | if self.precondition and hasattr(self, str(self.precondition)): | def index_html(self, REQUEST, RESPONSE): """ The default view of the contents of a File or Image. |
c=getattr(self,self.precondition) | c=getattr(self, str(self.precondition)) | def index_html(self, REQUEST, RESPONSE): """ The default view of the contents of a File or Image. |
expr = re.compile('\s*\*([ \na-zA-Z0-9.:/;,\'\"\?]+)\*(?!\*|-)').search | expr = re.compile('\s*\*([ \na-zA-Z0-9.:/;,\'\"\?\=\-\>\<\(\)]+)\*(?!\*|-)').search | def doc_emphasize( self, s, expr = re.compile('\s*\*([ \na-zA-Z0-9.:/;,\'\"\?]+)\*(?!\*|-)').search ): |
return cmp((self.co_argcount, self.co_varnames), (other.co_argcount, other.co_varnames)) | if other is None: return 1 try: return cmp((self.co_argcount, self.co_varnames), (other.co_argcount, other.co_varnames)) except: return 1 | def __cmp__(self,other): return cmp((self.co_argcount, self.co_varnames), (other.co_argcount, other.co_varnames)) |
cookies=None | cookies={} | def __init__(self, |
find(ob.PrincipiaSearchSource(), obj_searchterm) >= 0 | string.find(ob.PrincipiaSearchSource(), obj_searchterm) >= 0 | def ZopeFindAndApply(self, obj, obj_ids=None, obj_metatypes=None, obj_searchterm=None, obj_expr=None, obj_mtime=None, obj_mspec=None, obj_permission=None, obj_roles=None, search_sub=0, REQUEST=None, result=None, pre='', apply_func=None, apply_path=''): """Zope Find interface and apply |
query=self.template(self,REQUEST) | query=self.template(self,argdata) | def query_data(self,REQUEST): |
query=self.template(self,REQUEST) | query=self.template(self,argdata) | def manage_test(self,REQUEST): |
return self.counter | return self.counter - 1 | def set(self, word): """ return the word id of 'word' """ |
time.sleep(2) | deadline = time.time() + 60 is_started = False while time.time() < deadline: response = send_action('status\n', zdrun_socket) if response is None: time.sleep(0.05) else: is_started = True break self.assert_(is_started, "spawned process failed to start in a minute") | def testRunIgnoresParentSignals(self): # Spawn a process which will in turn spawn a zdrun process. # We make sure that the zdrun process is still running even if # its parent process receives an interrupt signal (it should # not be passed to zdrun). zdrun_socket = os.path.join(self.here, 'testsock') zdctlpid = os.spawnvp( os.P_NOWAIT, sys.executable, [sys.executable, os.path.join(self.here, 'parent.py')] ) time.sleep(2) # race condition possible here os.kill(zdctlpid, signal.SIGINT) try: response = send_action('status\n', zdrun_socket) or '' except socket.error, msg: response = '' params = response.split('\n') self.assert_(len(params) > 1, repr(response)) # kill the process send_action('exit\n', zdrun_socket) |
try: response = send_action('status\n', zdrun_socket) or '' except socket.error, msg: response = '' params = response.split('\n') self.assert_(len(params) > 1, repr(response)) | time.sleep(0.25) response = send_action('status\n', zdrun_socket) self.assert_(response is not None and '\n' in response) | def testRunIgnoresParentSignals(self): # Spawn a process which will in turn spawn a zdrun process. # We make sure that the zdrun process is still running even if # its parent process receives an interrupt signal (it should # not be passed to zdrun). zdrun_socket = os.path.join(self.here, 'testsock') zdctlpid = os.spawnvp( os.P_NOWAIT, sys.executable, [sys.executable, os.path.join(self.here, 'parent.py')] ) time.sleep(2) # race condition possible here os.kill(zdctlpid, signal.SIGINT) try: response = send_action('status\n', zdrun_socket) or '' except socket.error, msg: response = '' params = response.split('\n') self.assert_(len(params) > 1, repr(response)) # kill the process send_action('exit\n', zdrun_socket) |
def cacheStatistics(self): return self._getDB().cacheStatistics() | def manage_cache_size(self,value,REQUEST): "set cache size" db = self._getDB() if self._inVersion(): db.setVersionCacheSize(value) else: db.setCacheSize(value) |
|
elif type(data) is not ListType: data=list(data) | else: data=list(data) | def setRoles(self, roles): |
elif type(data) is not ListType: data=list(data) | else: data=list(data) | def delRoles(self, roles): |
exc_info=exc_info()) | exc_info=True) | def __setstate__(self, state): Globals.Persistent.__setstate__(self, state) if self.connection_string: try: self.connect(self.connection_string) except: LOG.error('Error connecting to relational database.', exc_info=exc_info()) |
exc_info=exc_info()) | exc_info=True) | def manage_close_connection(self, REQUEST=None): " " try: if hasattr(self,'_v_database_connection'): self._v_database_connection.close() except: LOG.error('Error closing relational database connection.', exc_info=exc_info()) self._v_connected='' if REQUEST is not None: return self.manage_main(self, REQUEST) |
l=version.rfind(/') | l=version.rfind('/') | def __init__(self, id, baseid, PATH_INFO): self.id=id self._refid=baseid version=PATH_INFO l=version.rfind(/') if l >= 0: version=version[:l] self._version="%s/%s" % (version, id) self.users__draft__=uf=AccessControl.User.UserFolder() self.__allow_groups__=uf |
other[key] = URL = '/'.join(path) | other[key] = URL | def get(self, key, default=None, returnTaints=0, URLmatch=re.compile('URL(PATH)?([0-9]+)$').match, BASEmatch=re.compile('BASE(PATH)?([0-9]+)$').match, ): """Get a variable value |
other[key] = URL = '/'.join(v) | other[key] = URL | def get(self, key, default=None, returnTaints=0, URLmatch=re.compile('URL(PATH)?([0-9]+)$').match, BASEmatch=re.compile('BASE(PATH)?([0-9]+)$').match, ): """Get a variable value |
manage=manage_main=Globals.DTMLFile('dtml/brokenEdit',globals()) manage_workspace=manage | manage=Globals.DTMLFile('dtml/brokenEdit',globals()) manage_main=Globals.DTMLFile('dtml/brokenEdit',globals()) manage_workspace=Globals.DTMLFile('dtml/brokenEdit',globals()) | def __getattr__(self, name): if name[:3]=='_p_': return BrokenClass.inheritedAttribute('__getattr__')(self, name) raise AttributeError, escape(name) |
else: name=method.__name__ | else: name=os.path.split(method.__name__)[-1] | def registerClass(self, instance_class=None, meta_type='', permission=None, constructors=(), icon=None, permissions=None, legacy=(), ): """Register a constructor |
self._p_changed=0 self._p_deactivate() self.__setstate__(state) self._p_changed=1 | base = aq_base(self) base._p_changed=0 base._p_deactivate() base.__setstate__(state) base._p_changed=1 | def manage_historyCopy(self, keys=[], RESPONSE=None, URL1=None): "Copy a selected revision to the present" if not keys: raise HistorySelectionError, ( "No historical revision was selected.<p>") |
name=user.getName() | name=user.getUserName() | def _setObject(self,id,object,roles=None,user=None, set_owner=1): v=self._checkId(id) if v is not None: id=v try: t=object.meta_type except: t=None |
sc=sc+(t-int(t)) s=(hr/24.0+mn/1440.0+sc/86400.0) | s=(hr/24.0+mn/1440.0+(sc+ms)/86400.0) | def __init__(self,*args): """Return a new date-time object |
sc=sc+(t-int(t)) | sc=sc+ms | def __init__(self,*args): """Return a new date-time object |
_d=d+(self._tzinfo[tz].info(t)[0]/86400.0) yr,mo,dy=self._calendarday(_d+jd1901) _s=(_d-int(_d))*86400.0 hr=int(_s/3600) _s=_s-(hr*3600) mn=int(_s/60) sc=_s-(mn*60) if(hr==23 and mn==59 and sc>59.999): hr,mn,sc=0,0,0.0 else: if hr<0: hr=23+hr if mn<0: mn=59+mn if sc<0: if (sc-int(sc)>=0.999): sc=round(sc) sc=59+sc | x=d+(self._tzinfo[tz].info(t)[0]/86400.0) yr,mo,dy=self._calendarday(x+jd1901) x=(x-int(x))*86400.0 hr=int(x/3600) x=x-(hr*3600) mn=int(x/60) sc=x-(mn*60) | def __init__(self,*args): """Return a new date-time object |
tza=self._tzinfo[tz].info(t)[0] d,t=d-(tza/86400.0),t-tza | a=self._tzinfo[tz].info(t)[0] d,t=d-(a/86400.0),t-a | def __init__(self,*args): """Return a new date-time object |
tza=self._tzinfo[tz].info(t)[0] d,t=arg-(tza/86400.0),t-tza | a=self._tzinfo[tz].info(t)[0] d,t=arg-(a/86400.0),t-a | def __init__(self,*args): """Return a new date-time object |
_d=d+(self._tzinfo[tz].info(t)[0]/86400.0) yr,mo,dy=self._calendarday(_d+jd1901) _s=(_d-int(_d))*86400.0 hr=int(_s/3600) _s=_s-(hr*3600) mn=int(_s/60) sc=_s-(mn*60) | x=d+(self._tzinfo[tz].info(t)[0]/86400.0) yr,mo,dy=self._calendarday(x+jd1901) x=(x-int(x))*86400.0 hr=int(x/3600) x=x-(hr*3600) mn=int(x/60) sc=x-(mn*60) | def __init__(self,*args): """Return a new date-time object |
_s=(d-int(d))*86400.0 hr=int(_s/3600) _s=_s-(hr*3600) mn=int(_s/60) sc=_s-(mn*60) | x=(d-int(d))*86400.0 hr=int(x/3600) x=x-(hr*3600) mn=int(x/60) sc=x-(mn*60) | def __init__(self,*args): """Return a new date-time object |
d=self._d+o t=self._t+(o*86400.0) _d=d+(self._tzinfo[self._localzone].info(self._t)[0]/86400.0) yr,mo,dy=self._calendarday((_d+jd1901)) s=(_d-int(_d))*86400.0 | d,t,tz=(self._d+o),(self._t+(o*86400.0)),self._tz x=d+(self._tzinfo[tz].info(t)[0]/86400.0) yr,mo,dy=self._calendarday((x+jd1901)) s=(x-int(x))*86400.0 | def __add__(self,other): |
sc=s-(mn*60) if(hr==23 and mn==59 and sc>59.999): hr,mn,sc=0,0,0.0 else: if hr<0: hr=23+hr if mn<0: mn=59+mn if sc<0: if (sc-int(sc)>=0.999): sc=round(sc) sc=59+sc return self.__class__(yr,mo,dy,hr,mn,sc,self._tz,t,d,(d-int(d))) | s=s-(mn*60) return self.__class__(yr,mo,dy,hr,mn,s,self._tz,t,d,(d-int(d))) | def __add__(self,other): |
path=REQUEST['SCRIPT_NAME'], | path=(REQUEST['BASEPATH1'] or '/'), | def leave(self, REQUEST, RESPONSE): """Temporarily stop working in a version""" RESPONSE.setCookie( Globals.VersionNameName,'No longer active', expires="Mon, 25-Jan-1999 23:59:59 GMT", path=REQUEST['SCRIPT_NAME'], ) if (REQUEST.has_key('SERVER_SOFTWARE') and REQUEST['SERVER_SOFTWARE'][:9]=='Microsoft'): # IIS doesn't handle redirect headers correctly return MessageDialog( action=REQUEST['URL1']+'/manage_main', message=('If cookies are enabled by your browser, then ' 'you should have left version %s.' % self.id) ) return RESPONSE.redirect(REQUEST['URL1']+'/manage_main') |
def evaluateBoolean(self, expr): return not not self.evaluate(expr) | evaluateBoolean = evaluate | def evaluate(self, expression, isinstance=isinstance, StringType=StringType): if isinstance(expression, StringType): expression = self._engine.compile(expression) __traceback_supplement__ = ( TALESTracebackSupplement, self, expression) return expression(self) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.