bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def _makeFunction(self, allowSideEffect=0): from Guarded import GuardedBlock, theGuard, safebin from Guarded import WriteGuard, ReadGuard # Was the cached bytecode compiled with a compatible Python? if getattr(self, Python_magic, None) != Python_magic: allowSideEffect = 1 if allowSideEffect: self._checkCBlock(GuardedBl...
def _makeFunction(self, allowSideEffect=0): from Guarded import GuardedBlock, theGuard, safebin from Guarded import WriteGuard, ReadGuard # Was the cached bytecode compiled with a compatible Python? if getattr(self, 'Python_magic', None) != Python_magic: allowSideEffect = 1 if allowSideEffect: self._checkCBlock(Guarded...
2,300
def __init__(self,*args): """Return a new date-time object
def__init__(self,*args):"""Returnanewdate-timeobject
2,301
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
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
2,302
def renderwob(self, md): expr=self.expr name=self.__name__ if expr is None: sequence=md[name] cache={ name: sequence } else: sequence=expr(md) cache=None
def renderwob(self, md): expr=self.expr name=self.__name__ if expr is None: sequence=md[name] cache={ name: sequence } else: sequence=expr(md) cache=None
2,303
def numObjects(self): """ return number of indexed objects """ print 'numobjects', self.getId(), len(self._unindex) return len(self._unindex)
def numObjects(self): """ return number of indexed objects """ return len(self._unindex)
2,304
def indexSize(self): """ return of distinct values indexed""" print 'indexSize', self.getId(), len(self) return len(self)
def indexSize(self): """ return of distinct values indexed""" return len(self)
2,305
def load_binput(self): i = mloads('i' + self.read(1) + '\000\000\000') last = self.stack[-1] if getattr(last, 'id', last) is not last: last.id = self.idprefix + `i`
def load_binput(self): i = mloads('i' + self.read(1) + '\000\000\000') last = self.stack[-1] if getattr(last, 'id', last) is last: last.id = self.idprefix + `i`
2,306
def load_long_binput(self): i = mloads('i' + self.read(4)) last = self.stack[-1] if getattr(last, 'id', last) is not last: last.id = self.idprefix + `i`
def load_long_binput(self): i = mloads('i' + self.read(4)) last = self.stack[-1] if getattr(last, 'id', last) is last: last.id = self.idprefix + `i`
2,307
def save_persis(self, tag, data): v=data[2] if self.binary: v=v+'Q' else: v='P'+v return v
def save_persis(self, tag, data): v=data[2] if self.binary: v=v+'Q' else: v='P'+v return v
2,308
def save_persis(self, tag, data): v=data[2] if self.binary: v=v+'Q' else: v='P'+v return v
def save_persis(self, tag, data): v=data[2] if self.binary: v=v+'Q' else: v='P'+v return v
2,309
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 ):
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 ):
2,310
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 ):
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 ):
2,311
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 ):
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 ):
2,312
def __of__(self, parent): r=imPermissionRole() n=r._p=self._p if hasattr(parent, n): r._d=getattr(parent,n) else: r._d=self._d return r
def __of__(self, parent): r=imPermissionRole() r._p=self._p r._pa=parent r._d=self._d return r
2,313
def __getitem__(self, i): return self._d[i]
def __getitem__(self, i): return self._d[i]
2,314
def LOG(subsystem, severity, summary, detail='', error=None, reraise=None): """Log some information The required arguments are: subsystem -- The subsystem generating the message (e.g. ZODB) severity -- The "severity" of the event. This may be an integer or a floating point number. Logging back ends may consider th...
def LOG(subsystem, severity, summary, detail='', error=None, reraise=None): """Log some information The required arguments are: subsystem -- The subsystem generating the message (e.g. ZODB) severity -- The "severity" of the event. This may be an integer or a floating point number. Logging back ends may consider th...
2,315
def publish(self, module_name, after_list, published='web_objects', imported_modules={}, module_dicts={},debug=0):
def publish(self, module_name, after_list, published='web_objects', imported_modules={}, module_dicts={},debug=0):
2,316
def publish(self, module_name, after_list, published='web_objects', imported_modules={}, module_dicts={},debug=0):
def publish(self, module_name, after_list, published='web_objects', imported_modules={}, module_dicts={},debug=0):
2,317
def _defaultInput(self,n,t,v): return '<INPUT NAME="%s:%s" SIZE="50" VALUE="%s"></TD>' % (n,t,v)
def _defaultInput(self,n,t,v): return '<INPUT NAME="%s:%s" SIZE="50" VALUE="%s"></TD>' % (n,t,v)
2,318
def _stringInput(self,n,t,v): return ('<INPUT NAME="%s:%s" SIZE="50" VALUE="%s"></TD>'
def _stringInput(self,n,t,v): return ('<INPUT NAME="%s:%s" SIZE="50" VALUE="%s"></TD>'
2,319
def _linesInput(self,n,t,v):
def _linesInput(self,n,t,v):
2,320
def _textInput(self,n,t,v): return ('<TEXTAREA NAME="%s" ROWS="10" COLS="50">%s</TEXTAREA>'
def _textInput(self,n,t,v): return ('<TEXTAREA NAME="%s" ROWS="10" COLS="50">%s</TEXTAREA>'
2,321
def setLocal(self, name, value): if self.locals is self.stack[-1]: # Unmerge this scope's locals from previous scope of first set self.locals = self.locals.copy() self.locals[name] = value
def setLocal(self, name, value): if self.locals is self.stack[-1]: # Unmerge this scope's locals from previous scope of first set self.locals = self.locals.copy() self.locals[name] = value
2,322
def manage_FTPlist(self, REQUEST): "Directory listing for FTP" out=()
def manage_FTPlist(self, REQUEST): "Directory listing for FTP" out=()
2,323
def getPath(prefix, name, checkProduct=1, suffixes=('',)): """Find a file in one of several relative locations Arguments: prefix -- The location, relative to some home, to look for the file name -- The name of the file. This must not be a path. checkProduct -- a flag indicating whether product directories should b...
def getPath(prefix, name, checkProduct=1, suffixes=('',)): """Find a file in one of several relative locations Arguments: prefix -- The location, relative to some home, to look for the file name -- The name of the file. This must not be a path. checkProduct -- a flag indicating whether product directories should b...
2,324
def getPath(prefix, name, checkProduct=1, suffixes=('',)): """Find a file in one of several relative locations Arguments: prefix -- The location, relative to some home, to look for the file name -- The name of the file. This must not be a path. checkProduct -- a flag indicating whether product directories should b...
def getPath(prefix, name, checkProduct=1, suffixes=('',)): """Find a file in one of several relative locations Arguments: prefix -- The location, relative to some home, to look for the file name -- The name of the file. This must not be a path. checkProduct -- a flag indicating whether product directories should b...
2,325
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") )
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") )
2,326
def rfc1123_date(t=None, time=time, asctime=asctime, gmtime=gmtime, split=split): # Return an RFC 1123 format date string. t=split(asctime(gmtime(t or time()))) return '%s, %s %s %s %s GMT' % (t[0],t[2],t[1],t[3],t[4])
def rfc1123_date(t=None, time=time, asctime=asctime, gmtime=gmtime, split=split): # Return an RFC 1123 format date string. t=split(asctime(gmtime(t or time()))) return '%s, %s %s %s %s GMT' % (t[0],t[2],t[1],t[4],t[3])
2,327
def default_input_form(id,arguments,action='query', tabs=''): if arguments: items=arguments.items() return ( "%s\n%s%s" % ( '<html><head><title>%s Input Data</title></head><body>\n%s\n' '<form action="<dtml-var URL2>/<dtml-var id>/%s" ' 'method="get">\n' '<h2>%s Input Data</h2>\n' 'Enter query parameters:<br>' '<table>...
def default_input_form(id,arguments,action='query', tabs=''): if arguments: items=arguments.items() return ( "%s\n%s%s" % ( '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">\n' '<html lang="en"><head><title>%s Input Data</title></head>\n' '<body bgcolor=" '<form...
2,328
def default_input_form(id,arguments,action='query', tabs=''): if arguments: items=arguments.items() return ( "%s\n%s%s" % ( '<html><head><title>%s Input Data</title></head><body>\n%s\n' '<form action="<dtml-var URL2>/<dtml-var id>/%s" ' 'method="get">\n' '<h2>%s Input Data</h2>\n' 'Enter query parameters:<br>' '<table>...
def default_input_form(id,arguments,action='query', tabs=''): if arguments: items=arguments.items() return ( "%s\n%s%s" % ( '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">\n' '<html lang="en"><head><title>%s Input Data</title></head>\n' '<body bgcolor=" '<form...
2,329
def _getTargetClass( self ):
def _getTargetClass( self ):
2,330
def initialize(context): # abuse registerClass to get a tutorial constructor # in the product add list context.registerClass( None, meta_type='Zope Tutorial', constructors=(TutorialTopic.addTutorialForm, TutorialTopic.addTutorial), ) # create tutorial help topics lesson_path=os.path.join(App.Common.package_home(global...
def initialize(context): # abuse registerClass to get a tutorial constructor # in the product add list context.registerClass( None, meta_type='Zope Tutorial', constructors=(TutorialTopic.addTutorialForm, TutorialTopic.addTutorial), ) # create tutorial help topics lesson_path=os.path.join(App.Common.package_home(global...
2,331
def decapitate(html, RESPONSE=None): headers = [] spos = 0 eolen = 1 while 1: m = hdr_start(html, spos) if not m: if html[spos:spos+2] == '\r\n': eolen = 2 break if html[spos:spos+1] == '\n': eolen = 1 break return html header = list(m.groups()) headers.append(header) spos = m.end() + 1 while spos < len(html) and html...
def decapitate(html, RESPONSE=None): headers = [] spos = 0 eolen = 1 while 1: m = hdr_start(html, spos) if not m: if html[spos:spos+2] == '\r\n': eolen = 2 break if html[spos:spos+1] == '\n': eolen = 1 break return html header = list(m.groups()) headers.append(header) spos = m.end() + 1 while spos < len(html) and html...
2,332
def decapitate(html, RESPONSE=None): headers = [] spos = 0 eolen = 1 while 1: m = hdr_start(html, spos) if not m: if html[spos:spos+2] == '\r\n': eolen = 2 break if html[spos:spos+1] == '\n': eolen = 1 break return html header = list(m.groups()) headers.append(header) spos = m.end() + 1 while spos < len(html) and html...
def decapitate(html, RESPONSE=None): headers = [] spos = 0 eolen = 1 while 1: m = hdr_start(html, spos) if not m: if html[spos:spos+2] == '\r\n': eolen = 2 break if html[spos:spos+1] == '\n': eolen = 1 break return html header = list(m.groups()) headers.append(header) spos = m.end() + 1 while spos < len(html) and html...
2,333
def decapitate(html, RESPONSE=None): headers = [] spos = 0 eolen = 1 while 1: m = hdr_start(html, spos) if not m: if html[spos:spos+2] == '\r\n': eolen = 2 break if html[spos:spos+1] == '\n': eolen = 1 break return html header = list(m.groups()) headers.append(header) spos = m.end() + 1 while spos < len(html) and html...
def decapitate(html, RESPONSE=None): headers = [] spos = 0 eolen = 1 while 1: m = hdr_start(html, spos) if not m: if html[spos:spos+2] == '\r\n': eolen = 2 break if html[spos:spos+1] == '\n': eolen = 1 break return html header = list(m.groups()) headers.append(header) spos = m.end() + 1 while spos < len(html) and html...
2,334
def resolve_url(self, url): # Attempt to resolve a url into an object in the Zope # namespace. The url must be a fully-qualified url. The # method will return the requested object if it is found # or raise the same HTTP error that would be raised in # the case of a real web request. If the passed in url # does not appe...
def resolve_url(self, url): # Attempt to resolve a url into an object in the Zope # namespace. The url must be a fully-qualified url. The # method will return the requested object if it is found # or raise the same HTTP error that would be raised in # the case of a real web request. If the passed in url # does not appe...
2,335
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'""" id, title = cookId(id, title, file) self._setObject(id, File(id,title,file,precondition)) if REQUEST is not None: return self.manage_main(self,REQUEST)
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'""" id, title = cookId(id, title, file) self._setObject(id, File(id,title,file,precondition)) if REQUEST is not None: return self.manage_main(self,REQUEST)
2,336
def tearDown(self): try: os.remove(self.path) except os.error: pass if os.environ.has_key('STUPID_LOG_FILE'): del os.environ['STUPID_LOG_FILE'] if os.environ.has_key('EVENT_LOG_FILE'): del os.environ['EVENT_LOG_FILE'] if os.environ.has_key('STUPID_LOG_SEVERITY'): del os.environ['STUPID_LOG_SEVERITY'] if os.environ.has_...
def tearDown(self): try: os.remove(self.path) except os.error: pass if os.environ.has_key('STUPID_LOG_FILE'): del os.environ['STUPID_LOG_FILE'] if os.environ.has_key('EVENT_LOG_FILE'): del os.environ['EVENT_LOG_FILE'] if os.environ.has_key('STUPID_LOG_SEVERITY'): del os.environ['STUPID_LOG_SEVERITY'] if os.environ.has_...
2,337
def database_size(self): try: db=self._p_jar.db() except: # BoboPOS2 return len(Globals.Bobobase._jar.db.index)*4 else: return db.getSize()
def database_size(self): try: db=self._p_jar.db() except: # BoboPOS2 return len(Globals.Bobobase._jar.db.index)*4 else: return db.getSize()
2,338
def recordMetaData(self, object, request, # Optimize global var lookups: hasattr=hasattr, getattr=getattr, logger=ac_logger, ): request_get = request.get if hasattr(object, 'getPhysicalPath'): path = '/'.join(object.getPhysicalPath()) else: # Try hard to get the physical path of the object, # but there are many circums...
def recordMetaData(self, object, request, # Optimize global var lookups: hasattr=hasattr, getattr=getattr, logger=ac_logger, ): request_get = request.get if hasattr(object, 'getPhysicalPath'): path = '/'.join(object.getPhysicalPath()) else: # Try hard to get the physical path of the object, # but there are many circums...
2,339
def traverse(self, path, response=None): """Traverse the object space
def traverse(self, path, response=None): """Traverse the object space
2,340
def manage_exportObject(self,id=None,download=None,RESPONSE=None): """Exports an object to a file and returns that file.""" if id is None: o=self else: o=getattr(self,id) if download: f=StringIO() o._p_jar.export_file(o,f) RESPONSE.setHeader('Content-type','application/data') RESPONSE.setHeader('Content-Disposition', '...
def manage_exportObject(self, id='', download=None, RESPONSE=None): """Exports an object to a file and returns that file.""" if id is None: o=self else: o=getattr(self,id) if download: f=StringIO() o._p_jar.export_file(o,f) RESPONSE.setHeader('Content-type','application/data') RESPONSE.setHeader('Content-Disposition', ...
2,341
def manage_exportObject(self,id=None,download=None,RESPONSE=None): """Exports an object to a file and returns that file.""" if id is None: o=self else: o=getattr(self,id) if download: f=StringIO() o._p_jar.export_file(o,f) RESPONSE.setHeader('Content-type','application/data') RESPONSE.setHeader('Content-Disposition', '...
def manage_exportObject(self,id=None,download=None,RESPONSE=None): """Exports an object to a file and returns that file.""" if not id: id=self.id if callable(id): id=id() ob=self else: ob=getattr(self,id) if download: f=StringIO() o._p_jar.export_file(o,f) RESPONSE.setHeader('Content-type','application/data') RESPONSE....
2,342
def manage_exportObject(self,id=None,download=None,RESPONSE=None): """Exports an object to a file and returns that file.""" if id is None: o=self else: o=getattr(self,id) if download: f=StringIO() o._p_jar.export_file(o,f) RESPONSE.setHeader('Content-type','application/data') RESPONSE.setHeader('Content-Disposition', '...
def manage_exportObject(self,id=None,download=None,RESPONSE=None): """Exports an object to a file and returns that file.""" if id is None: o=self else: o=getattr(self,id) if download: f=StringIO() ob._p_jar.export_file(ob, f) RESPONSE.setHeader('Content-type','application/data') RESPONSE.setHeader('Content-Disposition'...
2,343
def manage_exportObject(self,id=None,download=None,RESPONSE=None): """Exports an object to a file and returns that file.""" if id is None: o=self else: o=getattr(self,id) if download: f=StringIO() o._p_jar.export_file(o,f) RESPONSE.setHeader('Content-type','application/data') RESPONSE.setHeader('Content-Disposition', '...
def manage_exportObject(self,id=None,download=None,RESPONSE=None): """Exports an object to a file and returns that file.""" if id is None: o=self else: o=getattr(self,id) if download: f=StringIO() ob._p_jar.export_file(ob, f) RESPONSE.setHeader('Content-type','application/data') RESPONSE.setHeader('Content-Disposition'...
2,344
def manage_exportObject(self,id=None,download=None,RESPONSE=None): """Exports an object to a file and returns that file.""" if id is None: o=self else: o=getattr(self,id) if download: f=StringIO() o._p_jar.export_file(o,f) RESPONSE.setHeader('Content-type','application/data') RESPONSE.setHeader('Content-Disposition', '...
def manage_exportObject(self,id=None,download=None,RESPONSE=None): """Exports an object to a file and returns that file.""" if id is None: o=self else: o=getattr(self,id) if download: f=StringIO() o._p_jar.export_file(o,f) RESPONSE.setHeader('Content-type','application/data') RESPONSE.setHeader('Content-Disposition', '...
2,345
def __init__(self, parent, id): self.id=id self.__parent__=parent self.__roles__ =parent.PUT__roles__
def __init__(self, parent, id): self.id=id self.__parent__=parent self.__roles__ =parent.PUT__roles__
2,346
def PUT(self, REQUEST, RESPONSE): """Adds a document, image or file to the folder when a PUT request is received.""" name=self.id type=REQUEST.get_header('content-type', None) body=REQUEST.get('BODY', '') if type is None: type, enc=mimetypes.guess_type(name) if type is None: if content_types.find_binary(body) >= 0: rai...
def PUT(self, REQUEST, RESPONSE): """Adds a document, image or file to the folder when a PUT request is received.""" name=self.id type=REQUEST.get_header('content-type', None) body=REQUEST.get('BODY', '') if type is None: type, enc=mimetypes.guess_type(name) if type is None: if content_types.find_binary(body) >= 0: con...
2,347
def scrub(list, dirname, filelist): for name in filelist: if name in EXCLUDED_NAMES: continue prefix, ext = os.path.splitext(name) if ext == '.pyo' or ext == '.pyc': full = os.path.join(dirname, name) os.unlink(full) filelist.remove(name) if DEBUG: print full
def scrub(list, dirname, filelist): for name in filelist: if name in EXCLUDED_NAMES: continue prefix, ext = os.path.splitext(name) if ext == '.pyo' or ext == '.pyc': full = os.path.join(dirname, name) os.unlink(full) if DEBUG: print full
2,348
def usage(): usage = ("""
def usage(): usage = ("""
2,349
def usage(): usage = ("""
def usage(): usage = ("""
2,350
def usage(): usage = ("""
def usage(): usage = ("""
2,351
def __init__(self, vocabulary=None, brains=None): # Catalogs no longer care about vocabularies and lexicons # so the vocabulary argument is ignored. (Casey)
def __init__(self, vocabulary=None, brains=None): # Catalogs no longer care about vocabularies and lexicons # so the vocabulary argument is ignored. (Casey)
2,352
def clear(self): """ clear catalog """
def clear(self): """ clear catalog """
2,353
def logBadRefresh(productid): exc = sys.exc_info() try: logger.error('Exception while refreshing %s' % productid, exc_info=exc) if hasattr(exc[0], '__name__'): error_type = exc[0].__name__ else: error_type = str(exc[0]) error_value = str(exc[1]) info = ''.join(format_exception(exc[0], exc[1], exc[2], limit=200)) refres...
def logBadRefresh(productid): exc = sys.exc_info() try: logger.error('Exception while refreshing %s' % productid, exc_info=True) if hasattr(exc[0], '__name__'): error_type = exc[0].__name__ else: error_type = str(exc[0]) error_value = str(exc[1]) info = ''.join(format_exception(exc[0], exc[1], exc[2], limit=200)) refre...
2,354
def set_locale(val): try: import locale except: raise SystemExit, ( 'The locale module could not be imported.\n' 'To use localization options, you must ensure\n' 'that the locale module is compiled into your\n' 'Python installation.' ) try: locale.setlocale(locale.LC_ALL, val) except: raise SystemExit, ( 'The specified...
def set_locale(val): try: import locale except: raise SystemExit, ( 'The locale module could not be imported.\n' 'To use localization options, you must ensure\n' 'that the locale module is compiled into your\n' 'Python installation.' ) try: locale.setlocale(locale.LC_ALL, val) except: raise SystemExit, ( 'The specified...
2,355
def _indexedSearch(self, args, sort_index, append, used):
def _indexedSearch(self, args, sort_index, append, used):
2,356
def package_home(globals_dict): __name__=globals_dict['__name__'] m=sys.modules[__name__] if hasattr(m,'__path__'): return m.__path__[0] return sys.modules[__name__[:rfind(__name__,'.')]].__path__[0]
def package_home(globals_dict): __name__=globals_dict['__name__'] m=sys.modules[__name__] if hasattr(m,'__path__'): return m.__path__[0] return sys.modules[__name__[:rfind(__name__,'.')]].__path__[0]
2,357
def allowed(self, parent, roles=None): """Check whether the user has access to parent, assuming that parent.__roles__ is the given roles.""" if roles is None or 'Anonymous' in roles: return 1 usr_roles=self.getRolesInContext(parent) for role in roles: if role in usr_roles: if (hasattr(self,'aq_parent') and hasattr(self...
def allowed(self, parent, roles=None): """Check whether the user has access to parent, assuming that parent.__roles__ is the given roles.""" if roles is None or 'Anonymous' in roles: return 1 usr_roles=self.getRolesInContext(parent) for role in roles: if role in usr_roles: if (hasattr(self,'aq_parent') and hasattr(self...
2,358
def careful_hasattr(md, inst, name): get = md.guarded_getattr if get is None: get = getattr try: get(inst, name) except (AttributeError, ValidationError): return 0 else: return 1
def careful_hasattr(md, inst, name): get = md.guarded_getattr if get is None: get = getattr try: get(inst, name) except (AttributeError, ValidationError, KeyError): return 0 else: return 1
2,359
def connected(self):
def connected(self):
2,360
def __bobo_traverse__(self, REQUEST, key):
def __bobo_traverse__(self, REQUEST, key):
2,361
def __getattr__(self, name):
def __getattr__(self, name):
2,362
def __getattr__(self, name):
def __getattr__(self, name):
2,363
def __init__(self,(items,data),brains=NoBrains, parent=None, zbrains=None):
def __init__(self,(items,data),brains=NoBrains, parent=None, zbrains=None):
2,364
def _apply_index(self, request):
def _apply_index(self, request):
2,365
def hs_search_mod(self, mod, dict): # Root through a module for things that look like # createable object classes. hidden=('Control Panel', 'Principia Draft', 'simple item') for k, v in mod.__dict__.items(): if is_class(v) and hasattr(v, 'meta_type') and \ hasattr(v, '__ac_permissions__') and \ (v.meta_type not in hidd...
def hs_search_mod(self, mod, dict): # Root through a module for things that look like # createable object classes. hidden=('Control Panel', 'Principia Draft', 'simple item', 'Broken Because Product is Gone') for k, v in mod.__dict__.items(): if is_class(v) and hasattr(v, 'meta_type') and \ hasattr(v, '__ac_permissions_...
2,366
def hs_search_mod(self, mod, dict): # Root through a module for things that look like # createable object classes. hidden=('Control Panel', 'Principia Draft', 'simple item') for k, v in mod.__dict__.items(): if is_class(v) and hasattr(v, 'meta_type') and \ hasattr(v, '__ac_permissions__') and \ (v.meta_type not in hidd...
def hs_search_mod(self, mod, dict): # Root through a module for things that look like # createable object classes. hidden=('Control Panel', 'Principia Draft', 'simple item') for k, v in mod.__dict__.items(): if is_class(v) and hasattr(v, 'meta_type') and \ hasattr(v, '__ac_permissions__'): if callable(v.meta_type): try...
2,367
def __call__(self, sub, sev, sum, det, err):
def __call__(self, sub, sev, sum, det, err):
2,368
def has_permission(self, permission, object): """Check to see if a user has a given permission on an object.""" return getSecurityManager().checkPermission(permission, object)
def has_permission(self, permission, object): """Check to see if a user has a given permission on an object.""" return getSecurityManager().checkPermission(permission, object)
2,369
def _setaccess(self, names, access): # Empty names list sets access to the class itself, named '' if not len(names): names = ('',) for name in names: if self.names.get(name, access) != access: LOG('SecurityInfo', WARNING, 'Conflicting security ' 'declarations for "%s"' % name) self._warnings = 1 self.names[name] = acce...
def _setaccess(self, names, access): # Empty names list sets access to the class itself, named '' if not len(names): names = ('',) for name in names: if self.names.get(name, access) != access: LOG('SecurityInfo', WARNING, 'Conflicting security ' 'declarations for "%s"' % name) self._warnings = 1 self.names[name] = acce...
2,370
def public(self, *names): """Declare names to be publicly accessible.""" self._setaccess(names, ACCESS_PUBLIC)
def public(self, *names): """Declare names to be publicly accessible.""" self._setaccess(names, ACCESS_PUBLIC)
2,371
def private(self, *names): """Declare names to be inaccessible to restricted code.""" self._setaccess(names, ACCESS_PRIVATE)
def private(self, *names): """Declare names to be inaccessible to restricted code.""" self._setaccess(names, ACCESS_PRIVATE)
2,372
def protected(self, permission_name, *names): """Cannot declare module names protected.""" pass
declareProtected__roles__=ACCESS_PRIVATE def declareProtected(self, permission_name, *names): """Cannot declare module names protected.""" pass
2,373
def import_products(): # Try to import each product, checking for and catching errors. done={} products = get_products() for priority, product_name, index, product_dir in products: if done.has_key(product_name): LOG('OFS.Application', WARNING, 'Duplicate Product name', 'After loading Product %s from %s,\n' 'I skipped...
def import_products(): # Try to import each product, checking for and catching errors. done={} products = get_products() for priority, product_name, index, product_dir in products: if done.has_key(product_name): LOG('OFS.Application', WARNING, 'Duplicate Product name', 'After loading Product %s from %s,\n' 'I skipped...
2,374
def install_products(app): # Install a list of products into the basic folder class, so # that all folders know about top-level objects, aka products folder_permissions = get_folder_permissions() meta_types=[] done={} get_transaction().note('Prior to product installs') get_transaction().commit() products = get_produ...
def install_products(app): # Install a list of products into the basic folder class, so # that all folders know about top-level objects, aka products folder_permissions = get_folder_permissions() meta_types=[] done={} get_transaction().note('Prior to product installs') get_transaction().commit() products = get_produ...
2,375
def __getitem__(self, key): self=self.aq_parent
def __getitem__(self, key): self=self.aq_parent
2,376
def filtered_manage_options( self, REQUEST=None, help_option_=({'label': 'Help', 'action': 'manage_help', 'target':"z_help_wnd"},), ): if REQUEST is None and hasattr(self, 'aq_acquire'): try: REQUEST=self.aq_acquire('REQUEST') except: pass try: user=REQUEST['AUTHENTICATED_USER'] except: user=None result=[] seen_roles=...
def filtered_manage_options( self, REQUEST=None, help_option_=({'label': 'Help', 'action': 'manage_help', 'target':"z_help_wnd"},), ): if REQUEST is None and hasattr(self, 'aq_acquire'): try: REQUEST=self.aq_acquire('REQUEST') except: pass try: user=REQUEST['AUTHENTICATED_USER'] except: user=None result=[] seen_roles=...
2,377
def check_zglobals(self): if not doInstall(): return
def check_zglobals(self): if not doInstall(): return
2,378
def parse_endtag(self, i): rawdata = self.rawdata assert rawdata[i:i+2] == "</", "unexpected call to parse_endtag" match = endendtag.search(rawdata, i+1) # > if not match: return -1 j = match.end() tag = string.lower(string.strip(rawdata[i+2:j-1])) if not tag: raise HTMLParseError("empty start tag", self.getpos()) self...
def parse_endtag(self, i): rawdata = self.rawdata assert rawdata[i:i+2] == "</", "unexpected call to parse_endtag" match = endendtag.search(rawdata, i+1) # > if not match: return -1 j = match.end() match = endtagfind.match(rawdata, i) if not match: raise HTMLParseError("bad end tag: %s" % `rawdata[i:j]`, self.getpos())...
2,379
def load(self, oid, version): self._lock_acquire() try: s=self._index[oid] p=self._opickle[oid] return p, s # pickle, serial finally: self._lock_release()
def load(self, oid, version): self._lock_acquire() try: s=self._index[oid] p=self._opickle[oid] return p, s # pickle, serial finally: self._lock_release()
2,380
def store(self, oid, serial, data, version, transaction): if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction) if version: # we allow a version to be in use although we don't # support versions in the storage. LOG('TemporaryStorage', BLATHER, ('versions in use with Temp...
def store(self, oid, serial, data, version, transaction): if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction) if version: # we allow a version to be in use although we don't # support versions in the storage. LOG('TemporaryStorage', BLATHER, ('versions in use with Temp...
2,381
def store(self, oid, serial, data, version, transaction): if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction) if version: # we allow a version to be in use although we don't # support versions in the storage. LOG('TemporaryStorage', BLATHER, ('versions in use with Temp...
def store(self, oid, serial, data, version, transaction): if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction) if version: # we allow a version to be in use although we don't # support versions in the storage. LOG('TemporaryStorage', BLATHER, ('versions in use with Temp...
2,382
def _finish(self, tid, u, d, e): zeros={} referenceCount=self._referenceCount referenceCount_get=referenceCount.get oreferences=self._oreferences serial=self._tid index=self._index opickle=self._opickle
def _finish(self, tid, u, d, e): zeros={} referenceCount=self._referenceCount referenceCount_get=referenceCount.get oreferences=self._oreferences serial=self._serial index=self._index opickle=self._opickle
2,383
def render(self, md): name=self.__name__ t=self.type try: v = md[name] except KeyError, key: if key==name and self.optional: return '' raise KeyError, key, sys.exc_traceback if type(v) in (ListType, TupleType): if len(v) > 1 and not self.multiple: raise 'Multiple Values', ( 'multiple values are not allowed for <em>%s...
def render(self, md): name=self.__name__ t=self.type try: v = md[name] except KeyError, key: if str(key)==name and self.optional: return '' raise KeyError, key, sys.exc_traceback if type(v) in (ListType, TupleType): if len(v) > 1 and not self.multiple: raise 'Multiple Values', ( 'multiple values are not allowed for <...
2,384
def validClipData(self):
def validClipData(self):
2,385
def unauthorized(self, realm): if not (self.request.has_key('REMOTE_USER') and self.request['REMOTE_USER']): self.response['WWW-authenticate']='basic realm="%s"' % realm m="<strong>You are not authorized to access this resource.</strong>" if not self.HTTP_AUTHORIZATION: m=m+'\n<!-- No Authorization header-->' raise 'Un...
def unauthorized(self, realm,debug_mode=None): if not (self.request.has_key('REMOTE_USER') and self.request['REMOTE_USER']): self.response['WWW-authenticate']='basic realm="%s"' % realm m="<strong>You are not authorized to access this resource.</strong>" if not self.HTTP_AUTHORIZATION: m=m+'\n<!-- No Authorization head...
2,386
def unauthorized(self, realm): if not (self.request.has_key('REMOTE_USER') and self.request['REMOTE_USER']): self.response['WWW-authenticate']='basic realm="%s"' % realm m="<strong>You are not authorized to access this resource.</strong>" if not self.HTTP_AUTHORIZATION: m=m+'\n<!-- No Authorization header-->' raise 'Un...
def unauthorized(self, realm): if not (self.request.has_key('REMOTE_USER') and self.request['REMOTE_USER']): self.response['WWW-authenticate']='basic realm="%s"' % realm m="<strong>You are not authorized to access this resource.</strong>" if debug_mode: if self.HTTP_AUTHORIZATION: m=m+'\nUsername and password are not c...
2,387
def publish(self, module_name, after_list, published='web_objects', imported_modules={}, module_dicts={},debug=0):
def publish(self, module_name, after_list, published='web_objects', imported_modules={}, module_dicts={},debug=0):
2,388
def publish(self, module_name, after_list, published='web_objects', imported_modules={}, module_dicts={},debug=0):
def publish(self, module_name, after_list, published='web_objects', imported_modules={}, module_dicts={},debug=0):
2,389
def publish(self, module_name, after_list, published='web_objects', imported_modules={}, module_dicts={},debug=0):
def publish(self, module_name, after_list, published='web_objects', imported_modules={}, module_dicts={},debug=0):
2,390
def publish(self, module_name, after_list, published='web_objects', imported_modules={}, module_dicts={},debug=0):
def publish(self, module_name, after_list, published='web_objects', imported_modules={}, module_dicts={},debug=0):
2,391
def publish(self, module_name, after_list, published='web_objects', imported_modules={}, module_dicts={},debug=0):
def publish(self, module_name, after_list, published='web_objects', imported_modules={}, module_dicts={},debug=0):
2,392
def publish(self, module_name, after_list, published='web_objects', imported_modules={}, module_dicts={},debug=0):
def publish(self, module_name, after_list, published='web_objects', imported_modules={}, module_dicts={},debug=0):
2,393
def publish(self, module_name, after_list, published='web_objects', imported_modules={}, module_dicts={},debug=0):
def publish(self, module_name, after_list, published='web_objects', imported_modules={}, module_dicts={},debug=0):
2,394
def publish(self, module_name, after_list, published='web_objects', imported_modules={}, module_dicts={},debug=0):
def publish(self, module_name, after_list, published='web_objects', imported_modules={}, module_dicts={},debug=0):
2,395
def publish(self, module_name, after_list, published='web_objects', imported_modules={}, module_dicts={},debug=0):
def publish(self, module_name, after_list, published='web_objects', imported_modules={}, module_dicts={},debug=0):
2,396
def get_module_info(module_name, modules={}, acquire=_l.acquire, release=_l.release, ): if modules.has_key(module_name): return modules[module_name] if module_name[-4:]=='.cgi': module_name=module_name[:-4] acquire() tb=None try: try: module=__import__(module_name, globals(), globals(), ('__doc__',)) realm=module_n...
def get_module_info(module_name, modules={}, acquire=_l.acquire, release=_l.release, ): if modules.has_key(module_name): return modules[module_name] if module_name[-4:]=='.cgi': module_name=module_name[:-4] acquire() tb=None try: try: module=__import__(module_name, globals(), globals(), ('__doc__',)) realm=module_n...
2,397
def get_module_info(module_name, modules={}, acquire=_l.acquire, release=_l.release, ): if modules.has_key(module_name): return modules[module_name] if module_name[-4:]=='.cgi': module_name=module_name[:-4] acquire() tb=None try: try: module=__import__(module_name, globals(), globals(), ('__doc__',)) realm=module_n...
def get_module_info(module_name, modules={}, acquire=_l.acquire, release=_l.release, ): if modules.has_key(module_name): return modules[module_name] if module_name[-4:]=='.cgi': module_name=module_name[:-4] acquire() tb=None try: try: module=__import__(module_name, globals(), globals(), ('__doc__',)) realm=module_n...
2,398
def __init__(self,environ,form,stdin): self.environ=environ self.other=form self.stdin=stdin have_env=environ.has_key
def __init__(self,environ,form,stdin): self.environ=environ self.other=form self.stdin=stdin have_env=environ.has_key
2,399