bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def allowed(self, object, object_roles=None): """Check whether the user has access to object, assuming that object.__roles__ is the given roles.""" if object_roles is None or 'Anonymous' in object_roles: return 1 usr_roles=self.getRolesInContext(object) for role in object_roles: if role in usr_roles: # The user apparen... | def allowed(self, object, object_roles=None): """Check whether the user has access to object, assuming that object.__roles__ is the given roles.""" if object_roles is None or 'Anonymous' in object_roles: return 1 usr_roles=self.getRolesInContext(object) for role in object_roles: if role in usr_roles: # The user apparen... | 3,100 |
def allowed(self, object, object_roles=None): """Check whether the user has access to object, assuming that object.__roles__ is the given roles.""" if object_roles is None or 'Anonymous' in object_roles: return 1 usr_roles=self.getRolesInContext(object) for role in object_roles: if role in usr_roles: # The user apparen... | def allowed(self, object, object_roles=None): """Check whether the user has access to object, assuming that object.__roles__ is the given roles.""" if object_roles is None or 'Anonymous' in object_roles: return 1 usr_roles=self.getRolesInContext(object) for role in object_roles: if role in usr_roles: # The user apparen... | 3,101 |
def manage_cutObjects(self, ids=None, REQUEST=None): """Put a reference to the objects named in ids in the clip board""" if ids is None and REQUEST is not None: return eNoItemsSpecified elif ids is None: raise ValueError, 'ids must be specified' | def manage_cutObjects(self, ids=None, REQUEST=None): """Put a reference to the objects named in ids in the clip board""" if ids is None and REQUEST is not None: return eNoItemsSpecified elif ids is None: raise ValueError, 'ids must be specified' | 3,102 |
def manage_copyObjects(self, ids=None, REQUEST=None, RESPONSE=None): """Put a reference to the objects named in ids in the clip board""" if ids is None and REQUEST is not None: return eNoItemsSpecified elif ids is None: raise ValueError, 'ids must be specified' | def manage_copyObjects(self, ids=None, REQUEST=None, RESPONSE=None): """Put a reference to the objects named in ids in the clip board""" if ids is None and REQUEST is not None: return eNoItemsSpecified elif ids is None: raise ValueError, 'ids must be specified' | 3,103 |
def _booleanInput(self,n,t,v): | def _booleanInput(self,n,t,v): | 3,104 |
def _booleanInput(self,n,t,v): | def _booleanInput(self,n,t,v): | 3,105 |
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>' | 3,106 |
def manage_addZGadflyConnection( self, id, title, connection, check=None, REQUEST=None): " " return getDA().manage_addZGadflyConnection( self, id, title, connection, check, REQUEST) | def manage_addZGadflyConnection( self, id, title, connection, check=None, REQUEST=None): " " return getDA().manage_addZGadflyConnection( self, id, title, connection, check, REQUEST) | 3,107 |
def write(self, text): assert type(text) is type('') if text[:len(self._error_start)] == self._error_start: errend = find(text, '-->') if errend >= 0: text = text[errend + 4:] if self._text != text: self._text = text self._cook() | def write(self, text): assert type(text) is type('') if text[:len(self._error_start)] == self._error_start: errend = text.find('-->') if errend >= 0: text = text[errend + 4:] if self._text != text: self._text = text self._cook() | 3,108 |
def install_products(): # Install a list of products into the basic folder class, so # that all folders know about top-level objects, aka products path_join=os.path.join product_dir=path_join(SOFTWARE_HOME,'lib/python/Products') isdir=os.path.isdir exists=os.path.exists DictType=type({}) meta_types=list(Folder.Folder... | def install_products(): # Install a list of products into the basic folder class, so # that all folders know about top-level objects, aka products path_join=os.path.join product_dir=path_join(SOFTWARE_HOME,'lib/python/Products') isdir=os.path.isdir exists=os.path.exists DictType=type({}) meta_types=list(Folder.Folder... | 3,109 |
def get_env(self, req): env = self._ENV.copy() (path, params, query, fragment) = req.split_uri() if params: path = path + params # undo medusa bug while path and path[0] == '/': path = path[1:] if '%' in path: path = unquote(path) if query: # ZPublisher doesn't want the leading '?' query = query[1:] env['PATH_INFO']= '... | def get_env(self, req): env = self._ENV.copy() (path, params, query, fragment) = req.split_uri() if params: path = path + params # undo medusa bug while path and path[0] == '/': path = path[1:] if '%' in path: path = unquote(path) if query: # ZPublisher doesn't want the leading '?' query = query[1:] env['PATH_INFO']= '... | 3,110 |
def _prep_version_data(): global _version_string, _zope_version if _version_string is None: v = sys.version_info pyver = "python %d.%d.%d, %s" % (v[0], v[1], v[2], sys.platform) cfg = getConfiguration() fn = os.path.join(cfg.softwarehome, 'version.txt') expr = re.compile( r'(?P<product>[A-Za-z0-9]+) +(?P<major>[0-9]+)'... | def _prep_version_data(): global _version_string, _zope_version if _version_string is None: v = sys.version_info pyver = "python %d.%d.%d, %s" % (v[0], v[1], v[2], sys.platform) cfg = getConfiguration() fn = os.path.join(cfg.softwarehome, 'version.txt') expr = re.compile( r'(?P<product>[A-Za-z0-9]+) +(?P<major>[0-9]+)'... | 3,111 |
def do_useMacro(self, macroName, compiledSlots): doc, localName = self.engine.findMacroDocument(macroName) if not doc: # Local macro macro = self.macros[localName] else: # External macro macroDict = macroIndexer(doc) if not macroDict.has_key(localName): print "Macro", macroName, "not found" return macroNode = macroDict... | def do_useMacro(self, macroName, compiledSlots): doc, localName = self.engine.findMacroDocument(macroName) if not doc: # Local macro macro = self.macros[localName] else: # External macro macroDict = macroIndexer(doc) if not macroDict.has_key(localName): print "Macro", macroName, "not found" return macroNode = macroDict... | 3,112 |
def _edit_widget_for_type(self, t, id, p): if t in ('int', 'long', 'float', 'date', 'string'): if t=='string': q=' html_quote' else: q='' return (''' <input name="%s:%s" size="35" value="<!--#var %s%s-->">''' % (id, t, id, q) ) if t=='boolean': return (''' <input type="checkbox" name="%s:boolean" size="35" <!--#if %s--... | def _edit_widget_for_type(self, t, id, p): if t in ('int', 'long', 'float', 'date', 'string'): if t=='string': q=' html_quote' else: q='' return (''' <input name="%s:%s" size="35" value="<!--#var %s%s-->">''' % (id, t, id, q) ) if t=='boolean': return (''' <input type="checkbox" name="%s:boolean" size="35" <!--#if %s--... | 3,113 |
def main(args): usage_msg="""Usage: python testrunner.py options 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. options: -a Run all tests found in all subdirectories of the curre... | def main(args): usage_msg="""Usage: python testrunner.py options 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. options: -a Run all tests found in all subdirectories of the curre... | 3,114 |
def manage_renameObject(self, id, new_id, REQUEST=None): """Rename a particular sub-object""" try: self._checkId(new_id) except: raise CopyError, MessageDialog( title='Invalid Id', message=sys.exc_info()[1], action ='manage_main') ob=self._getOb(id) if not ob.cb_isMoveable(): raise CopyError, eNotSupported % id self._v... | def manage_renameObject(self, id, new_id, REQUEST=None): """Rename a particular sub-object""" try: self._checkId(new_id) except: raise CopyError, MessageDialog( title='Invalid Id', message=sys.exc_info()[1], action ='manage_main') ob=self._getOb(id) if not ob.cb_isMoveable(): raise CopyError, eNotSupported % id self._v... | 3,115 |
def hasSessionData(self): """ """ key = self.getBrowserIdManager().getToken(create=0) if key: if self._hasSessionDataObject(key): return 1 | def hasSessionData(self): """ """ key = self.getBrowserIdManager().getToken(create=0) if key: if self._hasSessionDataObject(key): return 1 | 3,116 |
def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam | def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam | 3,117 |
def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam | def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam | 3,118 |
def publish(self, module_name, published='web_objects', | def publish(self, module_name, published='web_objects', | 3,119 |
def publish(self, module_name, published='web_objects', | def publish(self, module_name, published='web_objects', | 3,120 |
def function_with_empty_signature(): pass | def try: transaction=get_transaction() transaction.begin() except: transaction=None function_with_empty_signature(): try: transaction=get_transaction() transaction.begin() except: transaction=None pass | 3,121 |
def flatten_field(v,converter): if type(v) is types.ListType: if len(v) > 1: return map(flatten_field,v) v=v[0] try: if v.file: v=v.file else: v=v.value except: pass if converter: v=converter(v) return v | def flatten_field(v,converter=None): if type(v) is types.ListType: if len(v) > 1: return map(flatten_field,v) v=v[0] try: if v.file: v=v.file else: v=v.value except: pass if converter: v=converter(v) return v | 3,122 |
def __getitem__(self,key): | def __getitem__(self,key): | 3,123 |
def __init__(self, | def __init__(self, | 3,124 |
def __init__(self, | def __init__(self, | 3,125 |
def add(self, id, title='', smtp_host=None, localhost='localhost', smtp_port=25, timeout=1.0, REQUEST=None): ' add a MailHost into the system ' id=str(id) title=str(title) if smtp_host is not None: smtp_host=str(smtp_host) if type(smtp_port) is not type(1): smtp_port=string.atoi(smtp_port) i=MailHost() #cr... | def add(self, id, title='', smtp_host=None, localhost='localhost', smtp_port=25, timeout=1.0, REQUEST=None): ' add a MailHost into the system ' id=str(id) title=str(title) if smtp_host is not None: smtp_host=str(smtp_host) if type(smtp_port) is not type(1): smtp_port=string.atoi(smtp_port) i=MailHost() #cr... | 3,126 |
def __init__(self, stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr, environ=os.environ): self.environ=environ fp=None try: if environ['REQUEST_METHOD'] != 'GET': fp=stdin except: pass | def __init__(self, stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr, environ=os.environ): self.environ=environ fp=None try: if environ['REQUEST_METHOD'] != 'GET': fp=stdin except: pass | 3,127 |
def emitDefines(self, defines): for part in splitParts(defines): m = re.match( r"\s*(?:(global|local)\s+)?(%s)\s+(.*)" % NAME_RE, part) if not m: if not string.strip(part): break # extra space after semi raise TALError("invalid z:define syntax: " + `part`) scope, name, expr = m.group(1, 2, 3) scope = scope or "local" c... | def emitDefines(self, defines): for part in splitParts(defines): m = re.match( r"\s*(?:(global|local)\s+)?(%s)\s+(.*)" % NAME_RE, part) if not m: if not string.strip(part): break # extra space after semi raise TALError("invalid z:define syntax: " + `part`) scope, name, expr = m.group(1, 2, 3) scope = scope or "local" c... | 3,128 |
def emitRepeat(self, arg): m = re.match("\s*(%s)\s+(.*)" % NAME_RE, arg) if not m: raise TALError("invalid z:repeat syntax: " + `repeat`) name, expr = m.group(1, 2) cexpr = self.compileExpression(expr) program = self.popProgram() self.emit("loop", name, cexpr, program) | 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) | 3,129 |
def emitSubstitution(self, arg, attrDict={}): key, expr = parseSubstitution(arg) if not key: raise TALError("Bad syntax in z:insert/z:replace: " + `arg`) cexpr = self.compileExpression(expr) program = self.popProgram() if key == "text": self.emit("insertText", cexpr, program) else: assert key == "structure" self.emit("... | def emitSubstitution(self, arg, attrDict={}): key, expr = parseSubstitution(arg) if not key: raise TALError("Bad syntax in insert/replace: " + `arg`) cexpr = self.compileExpression(expr) program = self.popProgram() if key == "text": self.emit("insertText", cexpr, program) else: assert key == "structure" self.emit("inse... | 3,130 |
def initialize(app): # Initialize the application # Initialize the cache: app.Control_Panel.initialize_cache() # The following items marked b/c are backward compatibility hacks # which make sure that expected system objects are added to the # bobobase. This is required because the bobobase in use may pre- # date the ... | def initialize(app): # Initialize the application # Initialize the cache: app.Control_Panel.initialize_cache() # The following items marked b/c are backward compatibility hacks # which make sure that expected system objects are added to the # bobobase. This is required because the bobobase in use may pre- # date the ... | 3,131 |
def initialize(app): # Initialize the application # Initialize the cache: app.Control_Panel.initialize_cache() # The following items marked b/c are backward compatibility hacks # which make sure that expected system objects are added to the # bobobase. This is required because the bobobase in use may pre- # date the ... | def initialize(app): # Initialize the application # Initialize the cache: app.Control_Panel.initialize_cache() # The following items marked b/c are backward compatibility hacks # which make sure that expected system objects are added to the # bobobase. This is required because the bobobase in use may pre- # date the ... | 3,132 |
def delRoles(self, roles): | def delRoles(self, roles): | 3,133 |
def __init__(self,name,data,obj): | def __init__(self,name,data,obj): | 3,134 |
def marshal_long(n,f): return ('%s:long=%s' % (n,f))[:-1] | def marshal_long(n,f): value = '%s:long=%s' % (n, f) if value[-1] == 'L': value = value[:-1] return value | 3,135 |
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=se... | 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=se... | 3,136 |
def manage_FTPlist(self, REQUEST): """Directory listing for FTP. """ out=() | def manage_FTPlist(self, REQUEST): """Directory listing for FTP. """ out=() | 3,137 |
def manage_FTPlist(self, REQUEST): """Directory listing for FTP. """ out=() | def manage_FTPlist(self, REQUEST): """Directory listing for FTP. """ out=() | 3,138 |
def manage_FTPlist(self, REQUEST): """Directory listing for FTP. """ out=() | def manage_FTPlist(self, REQUEST): """Directory listing for FTP. """ out=() | 3,139 |
def manage_FTPlist(self, REQUEST): """Directory listing for FTP. """ out=() | def manage_FTPlist(self, REQUEST): """Directory listing for FTP. """ out=() | 3,140 |
def findChildren(obj,dirname=''): """ recursive walk through the object hierarchy to find all children of an object (ajung) """ lst =[] for name,child in obj.objectItems(): if child.meta_type=="Folder": lst.extend(findChildren(child,dirname+ obj.id + '/')) else: lst.append( (dirname + obj.id + "/" + name,child) ) ret... | def findChildren(obj,dirname=''): """ recursive walk through the object hierarchy to find all children of an object (ajung) """ lst = [] for name, child in obj.objectItems(): if hasattr(aq_base(child), 'isPrincipiaFolderish') and child.isPrincipiaFolderish: lst.extend(findChildren(child, dirname + obj.id + '/')) else:... | 3,141 |
def findChildren(obj,dirname=''): """ recursive walk through the object hierarchy to find all children of an object (ajung) """ lst =[] for name,child in obj.objectItems(): if child.meta_type=="Folder": lst.extend(findChildren(child,dirname+ obj.id + '/')) else: lst.append( (dirname + obj.id + "/" + name,child) ) ret... | def findChildren(obj,dirname=''): """ recursive walk through the object hierarchy to find all children of an object (ajung) """ lst =[] for name,child in obj.objectItems(): if child.meta_type=="Folder": lst.extend(findChildren(child,dirname+ obj.id + '/')) else: lst.append((dirname + obj.id + "/" + name, child)) retu... | 3,142 |
def _cookie_list(self): cookie_list=[] for name, attrs in self.cookies.items(): | def _cookie_list(self): cookie_list=[] for name, attrs in self.cookies.items(): | 3,143 |
def apply(self, classobj): """Apply security information to the given class object.""" dict = classobj.__dict__ | def apply(self, classobj): """Apply security information to the given class object.""" dict = classobj.__dict__ | 3,144 |
def emitStartTag(self, node): self.emit("startTag", node.nodeName, getAttributeList(node)) | def emitStartTag(self, node): self.emit("startTag", node.nodeName, getAttributeList(node)) | 3,145 |
def emitStartEndTag(self, node): self.emit("startEndTag", node.nodeName, getAttributeList(node)) | def emitStartEndTag(self, node): self.emit("startEndTag", node.nodeName, getAttributeList(node)) | 3,146 |
def visitElement(self, node): if not node.hasAttributes(): self.emitElement(node) return macroName = node.getAttributeNS(ZOPE_METAL_NS, "use-macro") if macroName: slotDict = slotIndexer(node) compiledSlots = {} if slotDict: # Compile the slots for slotName, slotNode in slotDict.items(): self.pushProgram() self.visitEle... | def visitElement(self, node): if not node.hasAttributes(): self.emitElement(node) else: self.expandElement(node) self.popNS() def expandElement(self, node): macroName = node.getAttributeNS(ZOPE_METAL_NS, "use-macro") if macroName: slotDict = slotIndexer(node) compiledSlots = {} if slotDict: # Compile the slots for slo... | 3,147 |
def testVariables(self): '''Test variables''' ctxt = self.getContext() c = ctxt.vars ctxt.beginScope() ctxt.setLocal('v1', 1) ctxt.setLocal('v2', 2) | def testVariables(self): '''Test variables''' ctxt = self.getContext() ctxt.beginScope() ctxt.setLocal('v1', 1) ctxt.setLocal('v2', 2) | 3,148 |
def setUp(self): self._old = __builtins__.__dict__.get('INSTANCE_HOME') __builtins__.INSTANCE_HOME = os.path.split( Products.ExternalMethod.tests.__file__)[0] | def setUp(self): self._old = builtinsdict.get('INSTANCE_HOME') builtinsdict['INSTANCE_HOME'] = os.path.split( Products.ExternalMethod.tests.__file__)[0] | 3,149 |
def tearDown(self): if self._old is None: del __builtins__.INSTANCE_HOME else: __builtins__.INSTANCE_HOME = self._old | def tearDown(self): if self._old is None: del builtinsdict['INSTANCE_HOME'] else: __builtins__.INSTANCE_HOME = self._old | 3,150 |
def tearDown(self): if self._old is None: del __builtins__.INSTANCE_HOME else: __builtins__.INSTANCE_HOME = self._old | def tearDown(self): if self._old is None: del __builtins__.INSTANCE_HOME else: __builtins__.INSTANCE_HOME = self._old | 3,151 |
def __init__(self, | def __init__(self, | 3,152 |
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` | 3,153 |
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` | 3,154 |
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 | 3,155 |
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 | 3,156 |
def read_file(name): f = open(os.path.join(here, name), 'rb') res = f.read() f.close() return res | def read_file(name): f = open(os.path.join(here, name), 'rb') res = f.read() f.close() return res | 3,157 |
def __getitem__(self,key): | def __getitem__(self,key): | 3,158 |
def careful_mul(env, *factors): s=None r=1 for factor in factors: try: l=len(factor) s=1 except: l=factor if s and (l*r) > 1000: raise TypeError, 'Illegal sequence repeat' r=r*factor return r | def careful_mul(env, *factors): s=None for factor in factors: try: l=len(factor) s=1 except: l=factor if s and (l*r) > 1000: raise TypeError, 'Illegal sequence repeat' r=r*factor return r | 3,159 |
def careful_mul(env, *factors): s=None r=1 for factor in factors: try: l=len(factor) s=1 except: l=factor if s and (l*r) > 1000: raise TypeError, 'Illegal sequence repeat' r=r*factor return r | def careful_mul(env, *factors): s=None r=1 for factor in factors: try: l=len(factor) s=1 except TypeError: c=c*factor if s and c > 1000: raise TypeError, \ 'Illegal sequence repeat (too many repetitions: %d)' % c r=r*factor return r | 3,160 |
def careful_mul(env, *factors): s=None r=1 for factor in factors: try: l=len(factor) s=1 except: l=factor if s and (l*r) > 1000: raise TypeError, 'Illegal sequence repeat' r=r*factor return r | defcareful_mul(env,*factors):s=Noner=1forfactorinfactors:try:l=len(factor)s=1except:l=factorifsand(l*r)>1000:raiseTypeError,'Illegalsequencerepeat'r=r*factorreturnr | 3,161 |
def dav__propstat(self, name, 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/>' % name error=propd... | def dav__propstat(self, name, result, propstat=propstat, propdesc=propdesc, join=string.join): 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].a... | 3,162 |
def __getitem__(self,index): if index==self._index: return self._row parent=self._parent fields=self._class(self._data[index], parent) self._index=index self._row=fields if parent is None: return fields return fields.__of__(parent) | def __getitem__(self,index): if index==self._index: return self._row parent=self._parent fields=self._class(self._data[index], parent) self._index=index self._row=fields if parent is None: return fields return fields.__of__(parent) | 3,163 |
def evaluate(self, expression): m = re.match(r"(?s)(%s):(.*)\Z" % NAME_RE, expression) if m: type, expr = m.group(1, 2) else: type = "var" expr = expression if type == "str": return expr if type == "local": return self.locals[string.strip(expr)] if type == "global": return self.globals[string.strip(expr)] if type == "v... | def evaluate(self, expression): m = re.match(r"(?s)(%s):(.*)\Z" % NAME_RE, expression) if m: type, expr = m.group(1, 2) else: type = "path" expr = expression if type == "str": return expr if type == "local": return self.locals[string.strip(expr)] if type == "global": return self.globals[string.strip(expr)] if type == "... | 3,164 |
def evaluate(self, expression): m = re.match(r"(?s)(%s):(.*)\Z" % NAME_RE, expression) if m: type, expr = m.group(1, 2) else: type = "var" expr = expression if type == "str": return expr if type == "local": return self.locals[string.strip(expr)] if type == "global": return self.globals[string.strip(expr)] if type == "v... | def evaluate(self, expression): m = re.match(r"(?s)(%s):(.*)\Z" % NAME_RE, expression) if m: type, expr = m.group(1, 2) else: type = "var" expr = expression if type in ("string", "str"): return expr if type == "local": return self.locals[string.strip(expr)] if type == "global": return self.globals[string.strip(expr)] i... | 3,165 |
def evaluate(self, expression): m = re.match(r"(?s)(%s):(.*)\Z" % NAME_RE, expression) if m: type, expr = m.group(1, 2) else: type = "var" expr = expression if type == "str": return expr if type == "local": return self.locals[string.strip(expr)] if type == "global": return self.globals[string.strip(expr)] if type == "v... | def evaluate(self, expression): m = re.match(r"(?s)(%s):(.*)\Z" % NAME_RE, expression) if m: type, expr = m.group(1, 2) else: type = "var" expr = expression if type == "str": return expr if type in ("path", "var", "global", "local"): expr = string.strip(expr) if self.locals.has_key(expr): return self.locals[expr] else:... | 3,166 |
def evaluate(self, expression): m = re.match(r"(?s)(%s):(.*)\Z" % NAME_RE, expression) if m: type, expr = m.group(1, 2) else: type = "var" expr = expression if type == "str": return expr if type == "local": return self.locals[string.strip(expr)] if type == "global": return self.globals[string.strip(expr)] if type == "v... | def evaluate(self, expression): m = re.match(r"(?s)(%s):(.*)\Z" % NAME_RE, expression) if m: type, expr = m.group(1, 2) else: type = "var" expr = expression if type == "str": return expr if type == "local": return self.locals[string.strip(expr)] if type == "global": return self.globals[string.strip(expr)] if type == "v... | 3,167 |
def evaluate(self, expression): m = re.match(r"(?s)(%s):(.*)\Z" % NAME_RE, expression) if m: type, expr = m.group(1, 2) else: type = "var" expr = expression if type == "str": return expr if type == "local": return self.locals[string.strip(expr)] if type == "global": return self.globals[string.strip(expr)] if type == "v... | def evaluate(self, expression): m = re.match(r"(?s)(%s):(.*)\Z" % NAME_RE, expression) if m: type, expr = m.group(1, 2) else: type = "var" expr = expression if type == "str": return expr if type == "local": return self.locals[string.strip(expr)] if type == "global": return self.globals[string.strip(expr)] if type == "v... | 3,168 |
def _getMountRoot(self, root): sdc = root.get('folder', None) if sdc is None: sdc = root['folder'] = OFS.Folder.Folder() self._populate(sdc, root) | def _getMountRoot(self, root): sdc = root.get('folder', None) if sdc is None: sdc = root['folder'] = Folder() self._populate(sdc, root) | 3,169 |
def db_size(self): if Globals.DatabaseVersion=='2': s=os.stat(self.db_name())[6] else: s=self._p_jar.db().getSize() if s >= 1048576.0: return '%.1fM' % (s/1048576.0) return '%.1fK' % (s/1024.0) | def db_size(self): if Globals.DatabaseVersion=='2': s=os.stat(self.db_name())[6] else: s=self._p_jar.db().getSize() if s >= 1048576.0: return '%.1fM' % (s/1048576.0) return '%.1fK' % (s/1024.0) | 3,170 |
def rcsnapshot(self): self._v_rcs=self.refdict() self._v_rst=DateTime() | def rcsnapshot(self): self._v_rcs=self.refdict() self._v_rst=DateTime() | 3,171 |
def rcdate(self): return self._v_rst | def rcdate(self): return self._v_rst | 3,172 |
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() | def rcdeltas(self): if _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() | 3,173 |
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() | def rcdeltas(self): if self._v_rcs is None: self.rcsnapshot() nc=self.refdict() rc=_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() | 3,174 |
def manage_addZClass(self, id, title='', baseclasses=[], meta_type='', CreateFactory=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_type... | 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... | 3,175 |
def __init__(self, stdin, environ, response, clean=0, # "static" variables that we want to be local for speed SEQUENCE=1, DEFAULT=2, RECORD=4, RECORDS=8, REC=12, # RECORD|RECORDS EMPTY=16, CONVERTED=32, hasattr=hasattr, getattr=getattr, setattr=setattr, search_type=regex.compile( ':[a-zA-Z][a-zA-Z0-9_]+$' ).search, rfi... | def __init__(self, stdin, environ, response, clean=0, # "static" variables that we want to be local for speed SEQUENCE=1, DEFAULT=2, RECORD=4, RECORDS=8, REC=12, # RECORD|RECORDS EMPTY=16, CONVERTED=32, hasattr=hasattr, getattr=getattr, setattr=setattr, search_type=regex.compile( ':[a-zA-Z][a-zA-Z0-9_]+$' ).search, rfi... | 3,176 |
def near(self, x, distance = 1): '''\ near(rl, distance = 1) Returns a ResultList containing documents which contain''' result = self.__class__() for key, v in self.items(): try: value = x[key] except KeyError: value = None if value is None: continue | def near(self, x, distance = 1): '''\ near(rl, distance = 1) Returns a ResultList containing documents which contain''' result = self.__class__() for key, v in self.items(): try: value = x[key] except KeyError: value = None if value is None: continue | 3,177 |
def render(self, md): args=self.args have_arg=args.has_key name=self.__name__ | def render(self, md): args=self.args have_arg=args.has_key name=self.__name__ | 3,178 |
def render(self, md): args=self.args have_arg=args.has_key name=self.__name__ | def render(self, md): args=self.args have_arg=args.has_key name=self.__name__ | 3,179 |
def render(self, md): args=self.args have_arg=args.has_key name=self.__name__ | def render(self, md): args=self.args have_arg=args.has_key name=self.__name__ | 3,180 |
def tpValues(self): | def tpValues(self): | 3,181 |
def manage_edit(self, title, module, function, REQUEST=None): """Change the external method | def manage_edit(self, title, module, function, REQUEST=None): """Change the external method | 3,182 |
def redirect(self, location, status=302): """Cause a redirection without raising an error""" self.setStatus(status) self.setHeader('Location', location) | def redirect(self, location, status=302, lock=0): """Cause a redirection without raising an error""" self.setStatus(status) self.setHeader('Location', location) | 3,183 |
def redirect(self, location, status=302): """Cause a redirection without raising an error""" self.setStatus(status) self.setHeader('Location', location) | def redirect(self, location, status=302): """Cause a redirection without raising an error""" self.setStatus(status) self.setHeader('Location', location) | 3,184 |
def new_version(self, _intending=regex.compile("[.]?[0-9]+$").search, ): # Return a new version number based on the existing version. v=str(self.version) if not v: return '1.0' if _intending(v) < 0: return v l=rfind(v,'.') return v[:l+1]+str(1+atoi(v[l+1:])) | def new_version(self, _intending=regex.compile("[.]?[0-9]+$").search, ): # Return a new version number based on the existing version. v=str(self.version) if not v: return '1.0' if _intending(v) < 0: return v l=rfind(v,'.') return v[:l+1]+str(1+atoi(v[l+1:])) | 3,185 |
def manage_addPropertySheet(self, id, ns): """ """ md={'xmlns':ns} ps=PropertySheet(id, md) self.addPropertySheet(ps) return 'OK' | def manage_addPropertySheet(self, id, ns, REQUEST=None): """ """ md={'xmlns':ns} ps=PropertySheet(id, md) self.addPropertySheet(ps) return 'OK' | 3,186 |
def manage_addPropertySheet(self, id, ns): """ """ md={'xmlns':ns} ps=PropertySheet(id, md) self.addPropertySheet(ps) return 'OK' | def manage_addPropertySheet(self, id, ns): """ """ md={'xmlns':ns} ps= self.PropertySheetClass(id, md) self.addPropertySheet(ps) return 'OK' | 3,187 |
def manage_addPropertySheet(self, id, ns): """ """ md={'xmlns':ns} ps=PropertySheet(id, md) self.addPropertySheet(ps) return 'OK' | def manage_addPropertySheet(self, id, ns): """ """ md={'xmlns':ns} ps=PropertySheet(id, md) self.addPropertySheet(ps) return 'OK' | 3,188 |
def manage_options(self): """Return a manage option data structure for me instance """ try: r=self.REQUEST except: r=None if r is None: pre='../' else: pre=r['URL'] for i in (1,2): l=pre.rfind('/') if l >= 0: pre=pre[:l] pre=pre+'/' | def manage_options(self): """Return a manage option data structure for me instance """ try: r=self.REQUEST except: r=None if r is None: pre='../' else: pre=r['URLPATH0'] for i in (1,2): l=pre.rfind('/') if l >= 0: pre=pre[:l] pre=pre+'/' | 3,189 |
def test_dont_break_getPhysicalPath(self): # see http://www.zope.org/Collectors/Zope/2057 item = SimpleItem() self.assertEqual(item.getPhysicalPath(), ('',)) self.assertEqual(item.getPhysicalPath(), makerequest(item).getPhysicalPath()) | def test_dont_break_getPhysicalPath(self): # see http://www.zope.org/Collectors/Zope/2057 item = SimpleItem() self.assertEqual(item.getPhysicalPath(), ('',)) self.assertEqual(item.getPhysicalPath(), makerequest(item).getPhysicalPath()) | 3,190 |
def __init__(self, smtpHost, smtpPort, localHost="localhost", timeout=1): self.conn = socket(AF_INET, SOCK_STREAM) self.conn.connect(smtpHost, smtpPort) self.timeout=timeout self.fd=self.conn.fileno() self.conn.send("helo "+localHost+"\r\n") while 1: if not self._check(): break | def __init__(self, smtpHost, smtpPort, localHost="localhost", timeout=1): self.conn = socket(AF_INET, SOCK_STREAM) self.conn.connect(smtpHost, smtpPort) self.timeout=timeout self.fd=self.conn.fileno() self.conn.send("helo "+localHost+"\015\012") while 1: if not self._check(): break | 3,191 |
def _check(self, lev='250'): line = self.getLine() if not line: return 0 #can't check an empty line, eh? try: code=string.atoi(line[:3]) except: raise smtpError, "Cannot convert line from SMTP: %s" % line | def _check(self, lev='250'): line = self.getLine() if not line: return 0 #can't check an empty line, eh? try: code=string.atoi(line[:3]) except: raise smtpError, "Cannot convert line from SMTP: %s" % line | 3,192 |
def send(self, mfrom, mto, subj='No Subject', body='Blank Message'): self.conn.send("mail from:<%s>\n" % mfrom) self._check() if type(mto) in [types.ListType, types.TupleType]: for person in mto: self.conn.send("rcpt to:<%s>\n" % person) self._check() else: self.conn.send("rcpt to:<%s>\n" % mto) self._check() self.conn... | def send(self, mfrom, mto, subj='No Subject', body='Blank Message'): self.conn.send("mail from:<%s>\015\012" % mfrom) self._check() if type(mto) in [types.ListType, types.TupleType]: for person in mto: self.conn.send("rcpt to:<%s>\n" % person) self._check() else: self.conn.send("rcpt to:<%s>\n" % mto) self._check() sel... | 3,193 |
def send(self, mfrom, mto, subj='No Subject', body='Blank Message'): self.conn.send("mail from:<%s>\n" % mfrom) self._check() if type(mto) in [types.ListType, types.TupleType]: for person in mto: self.conn.send("rcpt to:<%s>\n" % person) self._check() else: self.conn.send("rcpt to:<%s>\n" % mto) self._check() self.conn... | def send(self, mfrom, mto, subj='No Subject', body='Blank Message'): self.conn.send("mail from:<%s>\n" % mfrom) self._check() if type(mto) in [types.ListType, types.TupleType]: for person in mto: self.conn.send("rcpt to:<%s>\015\012" % person) self._check() else: self.conn.send("rcpt to:<%s>\n" % mto) self._check() sel... | 3,194 |
def send(self, mfrom, mto, subj='No Subject', body='Blank Message'): self.conn.send("mail from:<%s>\n" % mfrom) self._check() if type(mto) in [types.ListType, types.TupleType]: for person in mto: self.conn.send("rcpt to:<%s>\n" % person) self._check() else: self.conn.send("rcpt to:<%s>\n" % mto) self._check() self.conn... | def send(self, mfrom, mto, subj='No Subject', body='Blank Message'): self.conn.send("mail from:<%s>\n" % mfrom) self._check() if type(mto) in [types.ListType, types.TupleType]: for person in mto: self.conn.send("rcpt to:<%s>\n" % person) self._check() else: self.conn.send("rcpt to:<%s>\015\012" % mto) self._check() sel... | 3,195 |
def send(self, mfrom, mto, subj='No Subject', body='Blank Message'): self.conn.send("mail from:<%s>\n" % mfrom) self._check() if type(mto) in [types.ListType, types.TupleType]: for person in mto: self.conn.send("rcpt to:<%s>\n" % person) self._check() else: self.conn.send("rcpt to:<%s>\n" % mto) self._check() self.conn... | def send(self, mfrom, mto, subj='No Subject', body='Blank Message'): self.conn.send("mail from:<%s>\n" % mfrom) self._check() if type(mto) in [types.ListType, types.TupleType]: for person in mto: self.conn.send("rcpt to:<%s>\n" % person) self._check() else: self.conn.send("rcpt to:<%s>\n" % mto) self._check() self.conn... | 3,196 |
def send(self, mfrom, mto, subj='No Subject', body='Blank Message'): self.conn.send("mail from:<%s>\n" % mfrom) self._check() if type(mto) in [types.ListType, types.TupleType]: for person in mto: self.conn.send("rcpt to:<%s>\n" % person) self._check() else: self.conn.send("rcpt to:<%s>\n" % mto) self._check() self.conn... | def send(self, mfrom, mto, subj='No Subject', body='Blank Message'): self.conn.send("mail from:<%s>\n" % mfrom) self._check() if type(mto) in [types.ListType, types.TupleType]: for person in mto: self.conn.send("rcpt to:<%s>\n" % person) self._check() else: self.conn.send("rcpt to:<%s>\n" % mto) self._check() self.conn... | 3,197 |
def _close(self): self.conn.send("quit\n") self.conn.close() | def _close(self): self.conn.send("quit\015\012") self.conn.close() | 3,198 |
def main(): user, password = 'superuser', '123' opts, args = getopt.getopt(sys.argv[1:], 'p:u:v9') global verbose global old for o, v in opts: if o=='-p': d, f = os.path.split(v) if f=='ZPublisher': sys.path.insert(0,d) else: sys.path.insert(0,v) elif o=='-u': v = string.split(v,':') user, password = v[0], string.join(... | def main(): user, password = 'superuser', '123' opts, args = getopt.getopt(sys.argv[1:], 'p:u:DIv9') global verbose global old for o, v in opts: if o=='-p': d, f = os.path.split(v) if f=='ZPublisher': sys.path.insert(0,d) else: sys.path.insert(0,v) elif o=='-u': v = string.split(v,':') user, password = v[0], string.joi... | 3,199 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.