bugged
stringlengths 4
228k
| fixed
stringlengths 0
96.3M
| __index_level_0__
int64 0
481k
|
|---|---|---|
def __init__(self,
|
def __init__(self,
| 3,900
|
def __init__(self,
|
def __init__(self,
| 3,901
|
def __init__(self,
|
def __init__(self,
| 3,902
|
def __init__(self,
|
def __init__(self,
| 3,903
|
def get_module_info(self, server_name, module_name, module):
|
def get_module_info(self, server_name, module_name, module):
| 3,904
|
def get_module_info(self, server_name, module_name, module):
|
def get_module_info(self, server_name, module_name, module):
| 3,905
|
def get_module_info(self, server_name, module_name, module):
|
def get_module_info(self, server_name, module_name, module):
| 3,906
|
def get_module_info(self, server_name, module_name, module):
|
def get_module_info(self, server_name, module_name, module):
| 3,907
|
def get_module_info(self, server_name, module_name, module):
|
def get_module_info(self, server_name, module_name, module):
| 3,908
|
def get_module_info(self, server_name, module_name, module):
|
def get_module_info(self, server_name, module_name, module):
| 3,909
|
def get_module_info(self, server_name, module_name, module):
|
def get_module_info(self, server_name, module_name, module):
| 3,910
|
def get_module_info(self, server_name, module_name, module):
|
def get_module_info(self, server_name, module_name, module):
| 3,911
|
def publish(self, module_name, after_list, published='web_objects',
|
def publish(self, module_name, after_list, published='web_objects',
| 3,912
|
def publish(self, module_name, after_list, published='web_objects',
|
def publish(self, module_name, after_list, published='web_objects',
| 3,913
|
def publish(self, module_name, after_list, published='web_objects',
|
def publish(self, module_name, after_list, published='web_objects',
| 3,914
|
def publish(self, module_name, after_list, published='web_objects',
|
def publish(self, module_name, after_list, published='web_objects',
| 3,915
|
def publish(self, module_name, after_list, published='web_objects',
|
def publish(self, module_name, after_list, published='web_objects',
| 3,916
|
def publish(self, module_name, after_list, published='web_objects',
|
def publish(self, module_name, after_list, published='web_objects',
| 3,917
|
def publish(self, module_name, after_list, published='web_objects',
|
def publish(self, module_name, after_list, published='web_objects',
| 3,918
|
def publish(self, module_name, after_list, published='web_objects',
|
def publish(self, module_name, after_list, published='web_objects',
| 3,919
|
def publish(self, module_name, after_list, published='web_objects',
|
def publish(self, module_name, after_list, published='web_objects',
| 3,920
|
def publish(self, module_name, after_list, published='web_objects',
|
def publish(self, module_name, after_list, published='web_objects',
| 3,921
|
def publish(self, module_name, after_list, published='web_objects',
|
def publish(self, module_name, after_list, published='web_objects',
| 3,922
|
def publish(self, module_name, after_list, published='web_objects',
|
def publish(self, module_name, after_list, published='web_objects',
| 3,923
|
def publish(self, module_name, after_list, published='web_objects',
|
def publish(self, module_name, after_list, published='web_objects',
| 3,924
|
def publish(self, module_name, after_list, published='web_objects',
|
def publish(self, module_name, after_list, published='web_objects',
| 3,925
|
def publish(self, module_name, after_list, published='web_objects',
|
def publish(self, module_name, after_list, published='web_objects',
| 3,926
|
def publish(self, module_name, after_list, published='web_objects',
|
def publish(self, module_name, after_list, published='web_objects',
| 3,927
|
def publish(self, module_name, after_list, published='web_objects',
|
def publish(self, module_name, after_list, published='web_objects',
| 3,928
|
def publish(self, module_name, after_list, published='web_objects',
|
def publish(self, module_name, after_list, published='web_objects',
| 3,929
|
def function_with_empty_signature(): pass
|
def function_with_empty_signature(): pass
| 3,930
|
def function_with_empty_signature(): pass
|
def function_with_empty_signature(): pass
| 3,931
|
def function_with_empty_signature(): pass
|
def function_with_empty_signature(): pass
| 3,932
|
def function_with_empty_signature(): pass
|
def function_with_empty_signature(): pass
| 3,933
|
def function_with_empty_signature(): pass
|
def function_with_empty_signature(): pass
| 3,934
|
def function_with_empty_signature(): pass
|
def function_with_empty_signature(): pass
| 3,935
|
def function_with_empty_signature(): pass
|
def function_with_empty_signature(): pass
| 3,936
|
def str_field(v): if type(v) is types.ListType: return map(str_field,v) if type(v) is types.InstanceType and v.__class__ is FieldStorage: v=v.value elif type(v) is not types.StringType: try: if v.file: v=v.file else: v=v.value except: pass return v
|
def str_field(v): if type(v) is ListType: return map(str_field,v) if type(v) is types.InstanceType and v.__class__ is FieldStorage: v=v.value elif type(v) is not types.StringType: try: if v.file: v=v.file else: v=v.value except: pass return v
| 3,937
|
def str_field(v): if type(v) is types.ListType: return map(str_field,v) if type(v) is types.InstanceType and v.__class__ is FieldStorage: v=v.value elif type(v) is not types.StringType: try: if v.file: v=v.file else: v=v.value except: pass return v
|
def str_field(v): if type(v) is types.ListType: return map(str_field,v) if hasattr(v,'__class__') and v.__class__ is FieldStorage: v=v.value elif type(v) is not types.StringType: try: if v.file: v=v.file else: v=v.value except: pass return v
| 3,938
|
def str_field(v): if type(v) is types.ListType: return map(str_field,v) if type(v) is types.InstanceType and v.__class__ is FieldStorage: v=v.value elif type(v) is not types.StringType: try: if v.file: v=v.file else: v=v.value except: pass return v
|
def str_field(v): if type(v) is types.ListType: return map(str_field,v) if type(v) is types.InstanceType and v.__class__ is FieldStorage: v=v.value elif type(v) is not StringType: if hasattr(v,'file') and v.file: v=v.file elif hasattr(v,'value'): v=v.value return v
| 3,939
|
def __init__(self, aFieldStorage):
|
def __init__(self, aFieldStorage):
| 3,940
|
def __init__(self, aFieldStorage):
|
def __init__(self, aFieldStorage):
| 3,941
|
def field2string(v): try: v=v.read() except: v=str(v) return v
|
def field2string(v): if hasattr(v,'read'): v=v.read() else: v=str(v) return v
| 3,942
|
def field2text(v, nl=regex.compile('\r\n\|\n\r'), sub=regsub.gsub): try: v=v.read() except: v=str(v) v=sub(nl,'\n',v) return v
|
def field2text(v, nl=regex.compile('\r\n\|\n\r'), sub=regsub.gsub): if hasattr(v,'read'): v=v.read() else: v=str(v) v=sub(nl,'\n',v) return v
| 3,943
|
def field2required(v): try: v=v.read() except: v=str(v) if strip(v): return v raise ValueError, 'No input for required field<p>'
|
def field2required(v): if hasattr(v,'read'): v=v.read() else: v=str(v) if strip(v): return v raise ValueError, 'No input for required field<p>'
| 3,944
|
def field2int(v): try: v=v.read() except: v=str(v) # we can remove the check for an empty string when we go to python 1.4 if v: return atoi(v) raise ValueError, 'Empty entry when <strong>integer</strong> expected'
|
def field2int(v): if hasattr(v,'read'): v=v.read() else: v=str(v) # we can remove the check for an empty string when we go to python 1.4 if v: return atoi(v) raise ValueError, 'Empty entry when <strong>integer</strong> expected'
| 3,945
|
def field2float(v): try: v=v.read() except: v=str(v) # we can remove the check for an empty string when we go to python 1.4 if v: return atof(v) raise ValueError, ( 'Empty entry when <strong>floating-point number</strong> expected')
|
def field2float(v): if hasattr(v,'read'): v=v.read() else: v=str(v) # we can remove the check for an empty string when we go to python 1.4 if v: return atof(v) raise ValueError, ( 'Empty entry when <strong>floating-point number</strong> expected')
| 3,946
|
def field2long(v): try: v=v.read() except: v=str(v) # we can remove the check for an empty string when we go to python 1.4 if v: return atol(v) raise ValueError, 'Empty entry when <strong>integer</strong> expected'
|
def field2long(v): if hasattr(v,'read'): v=v.read() else: v=str(v) # we can remove the check for an empty string when we go to python 1.4 if v: return atol(v) raise ValueError, 'Empty entry when <strong>integer</strong> expected'
| 3,947
|
def field2Regex(v): try: v=v.read() except: v=str(v) if v: return regex.compile(v)
|
def field2Regex(v): if hasattr(v,'read'): v=v.read() else: v=str(v) if v: return regex.compile(v)
| 3,948
|
def field2regex(v): try: v=v.read() except: v=str(v) if v: return regex.compile(v,regex.casefold)
|
def field2regex(v): if hasattr(v,'read'): v=v.read() else: v=str(v) if v: return regex.compile(v,regex.casefold)
| 3,949
|
def field2Regexs(v): try: v=v.read() except: v=str(v) v= map(lambda v: regex.compile(v), split(v)) if v: return v
|
def field2Regexs(v): if hasattr(v,'read'): v=v.read() else: v=str(v) v= map(lambda v: regex.compile(v), split(v)) if v: return v
| 3,950
|
def field2regexs(v): try: v=v.read() except: v=str(v) v= map(lambda v: regex.compile(v, regex.casefold), split(v)) if v: return v
|
def field2regexs(v): if hasattr(v,'read'): v=v.read() else: v=str(v) v= map(lambda v: regex.compile(v, regex.casefold), split(v)) if v: return v
| 3,951
|
def field2tokens(v): try: v=v.read() except: v=str(v) return split(v)
|
def field2tokens(v): if hasattr(v,'read'): v=v.read() else: v=str(v) return split(v)
| 3,952
|
def field2lines(v, crlf=regex.compile('\r\n\|\n\r')): try: v=v.read() except: v=str(v) v=regsub.gsub(crlf,'\n',v) return split(v,'\n')
|
def field2lines(v, crlf=regex.compile('\r\n\|\n\r')): if hasattr(v,'read'): v=v.read() else: v=str(v) v=regsub.gsub(crlf,'\n',v) return split(v,'\n')
| 3,953
|
def field2date(v): from DateTime import DateTime try: v=v.read() except: v=str(v) return DateTime(v)
|
def field2date(v): from DateTime import DateTime if hasattr(v,'read'): v=v.read() else: v=str(v) return DateTime(v)
| 3,954
|
def field2list(v): if type(v) is not types.ListType: v=[v] return v
|
def field2list(v): if type(v) is not ListType: v=[v] return v
| 3,955
|
def field2tuple(v): if type(v) is not types.ListType: v=(v,) return tuple(v)
|
def field2tuple(v): if type(v) is not ListType: v=(v,) return tuple(v)
| 3,956
|
def field2tuple(v): if type(v) is not types.ListType: v=(v,) return tuple(v)
|
def field2tuple(v): if type(v) is not types.ListType: v=(v,) return tuple(v)
| 3,957
|
def field2tuple(v): if type(v) is not types.ListType: v=(v,) return tuple(v)
|
def field2tuple(v): if type(v) is not types.ListType: v=(v,) return tuple(v)
| 3,958
|
def field2tuple(v): if type(v) is not types.ListType: v=(v,) return tuple(v)
|
def field2tuple(v): if type(v) is not types.ListType: v=(v,) return tuple(v)
| 3,959
|
def __init__(self,environ,form,stdin):
|
def __init__(self,environ,form,stdin):
| 3,960
|
def __init__(self,environ,form,stdin):
|
def __init__(self,environ,form,stdin):
| 3,961
|
def has_key(self,key):
|
def has_key(self,key):
| 3,962
|
def __getitem__(self,key, URLmatch=regex.compile('URL[0-9]$').match, BASEmatch=regex.compile('BASE[0-9]$').match, ):
|
def __getitem__(self,key, URLmatch=regex.compile('URL[0-9]$').match, BASEmatch=regex.compile('BASE[0-9]$').match, ):
| 3,963
|
def __getitem__(self,key, URLmatch=regex.compile('URL[0-9]$').match, BASEmatch=regex.compile('BASE[0-9]$').match, ):
|
def __getitem__(self,key, URLmatch=regex.compile('URL[0-9]$').match, BASEmatch=regex.compile('BASE[0-9]$').match, ):
| 3,964
|
def __getitem__(self,key, URLmatch=regex.compile('URL[0-9]$').match, BASEmatch=regex.compile('BASE[0-9]$').match, ):
|
def __getitem__(self,key, URLmatch=regex.compile('URL[0-9]$').match, BASEmatch=regex.compile('BASE[0-9]$').match, ):
| 3,965
|
def __getitem__(self,key, URLmatch=regex.compile('URL[0-9]$').match, BASEmatch=regex.compile('BASE[0-9]$').match, ):
|
def __getitem__(self,key, URLmatch=regex.compile('URL[0-9]$').match, BASEmatch=regex.compile('BASE[0-9]$').match, ):
| 3,966
|
def publish_module(module_name, stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr, environ=os.environ, debug=0): must_die=0 status=200 after_list=[None] try: response=Response(stdout=stdout, stderr=stderr) publisher = ModulePublisher(stdin=stdin, stdout=stdout, stderr=stderr, environ=environ) response = publisher.response response = publisher.publish(module_name,after_list,debug=debug) except SystemExit: must_die=1 response.exception(must_die) except ImportError, v: if type(v)==types.TupleType and len(v)==3: sys.exc_type, sys.exc_value, sys.exc_traceback = v must_die=1 response.exception(must_die) except: response.exception() status=response.getStatus() if response: response=str(response) if response: stdout.write(response) # The module defined a post-access function, call it if after_list[0] is not None: after_list[0]() if must_die: raise sys.exc_type, sys.exc_value, sys.exc_traceback sys.exc_type, sys.exc_value, sys.exc_traceback = None, None, None return status
|
def publish_module(module_name, stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr, environ=os.environ, debug=0): must_die=0 status=200 after_list=[None] try: response=Response(stdout=stdout, stderr=stderr) publisher = ModulePublisher(stdin=stdin, stdout=stdout, stderr=stderr, environ=environ) response = publisher.response response = publisher.publish(module_name,after_list,debug=debug) except SystemExit: must_die=1 response.exception(must_die) except ImportError, v: if type(v)==TupleType and len(v)==3: sys.exc_type, sys.exc_value, sys.exc_traceback = v must_die=1 response.exception(must_die) except: response.exception() status=response.getStatus() if response: response=str(response) if response: stdout.write(response) # The module defined a post-access function, call it if after_list[0] is not None: after_list[0]() if must_die: raise sys.exc_type, sys.exc_value, sys.exc_traceback sys.exc_type, sys.exc_value, sys.exc_traceback = None, None, None return status
| 3,967
|
def publish_module(module_name, stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr, environ=os.environ, debug=0): must_die=0 status=200 after_list=[None] try: response=Response(stdout=stdout, stderr=stderr) publisher = ModulePublisher(stdin=stdin, stdout=stdout, stderr=stderr, environ=environ) response = publisher.response response = publisher.publish(module_name,after_list,debug=debug) except SystemExit: must_die=1 response.exception(must_die) except ImportError, v: if type(v)==types.TupleType and len(v)==3: sys.exc_type, sys.exc_value, sys.exc_traceback = v must_die=1 response.exception(must_die) except: response.exception() status=response.getStatus() if response: response=str(response) if response: stdout.write(response) # The module defined a post-access function, call it if after_list[0] is not None: after_list[0]() if must_die: raise sys.exc_type, sys.exc_value, sys.exc_traceback sys.exc_type, sys.exc_value, sys.exc_traceback = None, None, None return status
|
def publish_module(module_name, stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr, environ=os.environ, debug=0): must_die=0 status=200 after_list=[None] try: response=Response(stdout=stdout, stderr=stderr) publisher = ModulePublisher(stdin=stdin, stdout=stdout, stderr=stderr, environ=environ) response = publisher.response response = publisher.publish(module_name,after_list,debug=debug) except SystemExit: must_die=1 response.exception(must_die) except ImportError, v: if type(v)==types.TupleType and len(v)==3: sys.exc_type, sys.exc_value, sys.exc_traceback = v must_die=1 response.exception(must_die) except: response.exception() status=response.getStatus() if response: response=str(response) if response: stdout.write(response) # The module defined a post-access function, call it if after_list[0] is not None: after_list[0]() if must_die: raise sys.exc_type, sys.exc_value, sys.exc_traceback sys.exc_type, sys.exc_value, sys.exc_traceback = None, None, None return status
| 3,968
|
def realize(self, *args, **kw): ZDOptions.realize(self, *args, **kw) config = self.configroot self.directory = config.instancehome self.program = [os.path.join(self.directory, "bin", "runzope")] self.sockname = os.path.join(config.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
|
def realize(self, *args, **kw): ZDOptions.realize(self, *args, **kw) config = self.configroot self.directory = config.instancehome 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
| 3,969
|
def __init__(self,*args): """Return a new date-time object
|
def __init__(self,*args): """Return a new date-time object
| 3,970
|
def _parse(self,string): # Parse date-time components from a string month=year=tz=tm=None spaces =self.space_chars intpat =self.int_pattern fltpat =self.flt_pattern wordpat =self.name_pattern delimiters =self.delimiters MonthNumbers =self._monthmap DayOfWeekNames=self._daymap ValidZones =self._tzinfo._zidx TimeModifiers =['am','pm']
|
def _parse(self,string): # Parse date-time components from a string month=year=tz=tm=None spaces =self.space_chars intpat =self.int_pattern fltpat =self.flt_pattern wordpat =self.name_pattern delimiters =self.delimiters MonthNumbers =self._monthmap DayOfWeekNames=self._daymap ValidZones =self._tzinfo._zidx TimeModifiers =['am','pm']
| 3,971
|
def _parse(self,string): # Parse date-time components from a string month=year=tz=tm=None spaces =self.space_chars intpat =self.int_pattern fltpat =self.flt_pattern wordpat =self.name_pattern delimiters =self.delimiters MonthNumbers =self._monthmap DayOfWeekNames=self._daymap ValidZones =self._tzinfo._zidx TimeModifiers =['am','pm']
|
def _parse(self,string): # Parse date-time components from a string month=year=tz=tm=None spaces =self.space_chars intpat =self.int_pattern fltpat =self.flt_pattern wordpat =self.name_pattern delimiters =self.delimiters MonthNumbers =self._monthmap DayOfWeekNames=self._daymap ValidZones =self._tzinfo._zidx TimeModifiers =['am','pm']
| 3,972
|
def _verifyObjectPaste(self, object, validate_src=1): # Verify whether the current user is allowed to paste the # passed object into self. This is determined by checking # to see if the user could create a new object of the same # meta_type of the object passed in and checking that the # user actually is allowed to access the passed in object # in its existing context. # # Passing a false value for the validate_src argument will skip # checking the passed in object in its existing context. This is # mainly useful for situations where the passed in object has no # existing context, such as checking an object during an import # (the object will not yet have been connected to the acquisition # heirarchy). if not hasattr(object, 'meta_type'): raise CopyError, MessageDialog( title='Not Supported', message='The object <EM>%s</EM> does not support this ' \ 'operation' % absattr(object.id), action='manage_main') mt=object.meta_type if not hasattr(self, 'all_meta_types'): raise CopyError, MessageDialog( title='Not Supported', message='Cannot paste into this object.', action='manage_main')
|
def _verifyObjectPaste(self, object, validate_src=1): # Verify whether the current user is allowed to paste the # passed object into self. This is determined by checking # to see if the user could create a new object of the same # meta_type of the object passed in and checking that the # user actually is allowed to access the passed in object # in its existing context. # # Passing a false value for the validate_src argument will skip # checking the passed in object in its existing context. This is # mainly useful for situations where the passed in object has no # existing context, such as checking an object during an import # (the object will not yet have been connected to the acquisition # heirarchy). if not hasattr(object, 'meta_type'): raise CopyError, MessageDialog( title='Not Supported', message='The object <EM>%s</EM> does not support this' \ ' operation' % absattr(object.id), action='manage_main') mt=object.meta_type if not hasattr(self, 'all_meta_types'): raise CopyError, MessageDialog( title='Not Supported', message='Cannot paste into this object.', action='manage_main')
| 3,973
|
def _verifyObjectPaste(self, object, validate_src=1): # Verify whether the current user is allowed to paste the # passed object into self. This is determined by checking # to see if the user could create a new object of the same # meta_type of the object passed in and checking that the # user actually is allowed to access the passed in object # in its existing context. # # Passing a false value for the validate_src argument will skip # checking the passed in object in its existing context. This is # mainly useful for situations where the passed in object has no # existing context, such as checking an object during an import # (the object will not yet have been connected to the acquisition # heirarchy). if not hasattr(object, 'meta_type'): raise CopyError, MessageDialog( title='Not Supported', message='The object <EM>%s</EM> does not support this ' \ 'operation' % absattr(object.id), action='manage_main') mt=object.meta_type if not hasattr(self, 'all_meta_types'): raise CopyError, MessageDialog( title='Not Supported', message='Cannot paste into this object.', action='manage_main')
|
def _verifyObjectPaste(self, object, validate_src=1): # Verify whether the current user is allowed to paste the # passed object into self. This is determined by checking # to see if the user could create a new object of the same # meta_type of the object passed in and checking that the # user actually is allowed to access the passed in object # in its existing context. # # Passing a false value for the validate_src argument will skip # checking the passed in object in its existing context. This is # mainly useful for situations where the passed in object has no # existing context, such as checking an object during an import # (the object will not yet have been connected to the acquisition # heirarchy). if not hasattr(object, 'meta_type'): raise CopyError, MessageDialog( title='Not Supported', message='The object <EM>%s</EM> does not support this ' \ 'operation.' % absattr(object.id), action='manage_main') mt=object.meta_type if not hasattr(self, 'all_meta_types'): raise CopyError, MessageDialog( title='Not Supported', message='Cannot paste into this object.', action='manage_main')
| 3,974
|
def _verifyObjectPaste(self, object, validate_src=1): # Verify whether the current user is allowed to paste the # passed object into self. This is determined by checking # to see if the user could create a new object of the same # meta_type of the object passed in and checking that the # user actually is allowed to access the passed in object # in its existing context. # # Passing a false value for the validate_src argument will skip # checking the passed in object in its existing context. This is # mainly useful for situations where the passed in object has no # existing context, such as checking an object during an import # (the object will not yet have been connected to the acquisition # heirarchy). if not hasattr(object, 'meta_type'): raise CopyError, MessageDialog( title='Not Supported', message='The object <EM>%s</EM> does not support this ' \ 'operation' % absattr(object.id), action='manage_main') mt=object.meta_type if not hasattr(self, 'all_meta_types'): raise CopyError, MessageDialog( title='Not Supported', message='Cannot paste into this object.', action='manage_main')
|
def _verifyObjectPaste(self, object, validate_src=1): # Verify whether the current user is allowed to paste the # passed object into self. This is determined by checking # to see if the user could create a new object of the same # meta_type of the object passed in and checking that the # user actually is allowed to access the passed in object # in its existing context. # # Passing a false value for the validate_src argument will skip # checking the passed in object in its existing context. This is # mainly useful for situations where the passed in object has no # existing context, such as checking an object during an import # (the object will not yet have been connected to the acquisition # heirarchy). if not hasattr(object, 'meta_type'): raise CopyError, MessageDialog( title='Not Supported', message='The object <EM>%s</EM> does not support this ' \ 'operation' % absattr(object.id), action='manage_main') mt=object.meta_type if not hasattr(self, 'all_meta_types'): raise CopyError, MessageDialog( title='Not Supported', message='Cannot paste into this object.', action='manage_main')
| 3,975
|
def cookie_path(request): # Return a "path" value for use in a cookie that refers # to the root of the Zope object space. return request['BASEPATH1'] or "/"
|
def cookie_path(request): # Return a "path" value for use in a cookie that refers # to the root of the Zope object space. return request['BASEPATH1'] or "/"
| 3,976
|
def field2date(v): from DateTime import DateTime if hasattr(v,'read'): v=v.read() else: v=str(v) return DateTime(v)
|
def field2date(v): from DateTime import DateTime if hasattr(v,'read'): v=v.read() else: v=str(v) return DateTime(v)
| 3,977
|
def field2boolean(v): return v
|
def field2boolean(v): return v
| 3,978
|
def field2tuple(v): if type(v) is not ListType: v=(v,) return tuple(v)
|
def field2tuple(v): if type(v) is not TupleType: v=(v,) return tuple(v)
| 3,979
|
def MOVE(self, REQUEST, RESPONSE): """Move a resource to a new location. Though we may later try to make a move appear seamless across namespaces (e.g. from Zope to Apache), MOVE is currently only supported within the Zope namespace.""" self.dav__init(REQUEST, RESPONSE) self.dav__validate(self, 'DELETE', REQUEST) if not hasattr(aq_base(self), 'cb_isMoveable') or \ not self.cb_isMoveable(): raise MethodNotAllowed, 'This object may not be moved.'
|
def MOVE(self, REQUEST, RESPONSE): """Move a resource to a new location. Though we may later try to make a move appear seamless across namespaces (e.g. from Zope to Apache), MOVE is currently only supported within the Zope namespace.""" self.dav__init(REQUEST, RESPONSE) self.dav__validate(self, 'DELETE', REQUEST) if not hasattr(aq_base(self), 'cb_isMoveable') or \ not self.cb_isMoveable(): raise MethodNotAllowed, 'This object may not be moved.'
| 3,980
|
def PUT(self, REQUEST, RESPONSE): """Create a new non-collection resource.""" self.dav__init(REQUEST, RESPONSE) type=REQUEST.get_header('content-type', None) body=REQUEST.get('BODY', '') name=self.__name__ if type is None: type, enc=mimetypes.guess_type(name) if type is None: if OFS.content_types.find_binary(body) >= 0: content_type='application/octet-stream' else: type=OFS.content_types.text_type(body) type=string.lower(type) from OFS.Image import Image, File if type in ('text/html', 'text/xml', 'text/plain'): self.__parent__.manage_addDTMLDocument(name, '', body) elif type[:6]=='image/': ob=Image(name, '', body, content_type=type) self.__parent__._setObject(name, ob) else: ob=File(name, '', body, content_type=type) self.__parent__._setObject(name, ob) RESPONSE.setStatus(201) RESPONSE.setBody('') return RESPONSE
|
def PUT(self, REQUEST, RESPONSE): """Create a new non-collection resource.""" self.dav__init(REQUEST, RESPONSE) type=REQUEST.get_header('content-type', None) body=REQUEST.get('BODY', '') name=self.__name__ if type is None: type, enc=mimetypes.guess_type(name) if type is None: if OFS.content_types.find_binary(body) >= 0: type='application/octet-stream' else: type=OFS.content_types.text_type(body) type=string.lower(type) from OFS.Image import Image, File if type in ('text/html', 'text/xml', 'text/plain'): self.__parent__.manage_addDTMLDocument(name, '', body) elif type[:6]=='image/': ob=Image(name, '', body, content_type=type) self.__parent__._setObject(name, ob) else: ob=File(name, '', body, content_type=type) self.__parent__._setObject(name, ob) RESPONSE.setStatus(201) RESPONSE.setBody('') return RESPONSE
| 3,981
|
def __call__(self): self.namespaceDict = {} self.namespaceStack = [self.namespaceDict] DOMVisitor.__call__(self) assert not self.stack return self.program, self.macros
|
def __call__(self): self.namespaceDict = {"xml": XML_NS} self.namespaceStack = [self.namespaceDict] DOMVisitor.__call__(self) assert not self.stack return self.program, self.macros
| 3,982
|
def optimize(self, program): output = [] collect = [] rawseen = cursor = 0 if self.xml: endsep = "/>" else: endsep = " />" for cursor in xrange(len(program)+1): try: item = program[cursor] except IndexError: item = (None, None) if item[0] == "rawtext": collect.append(item[1]) continue if item[0] == "endTag": collect.append("</%s>" % item[1]) continue if item[0] == "startTag": if self.optimizeStartTag(collect, item[1], item[2], ">"): continue if item[0] == "startEndTag": if self.optimizeStartTag(collect, item[1], item[2], endsep): continue text = string.join(collect, "") if text: output.append(("rawtext", text)) if item[0] != None: output.append(item) rawseen = cursor+1 collect = [] return output
|
def optimize(self, program): output = [] collect = [] rawseen = cursor = 0 if self.xml: endsep = "/>" else: endsep = " />" for cursor in xrange(len(program)+1): try: item = program[cursor] except IndexError: item = (None, None) opcode = item[0] if opcode == "rawtext": collect.append(item[1]) continue if item[0] == "endTag": collect.append("</%s>" % item[1]) continue if item[0] == "startTag": if self.optimizeStartTag(collect, item[1], item[2], ">"): continue if item[0] == "startEndTag": if self.optimizeStartTag(collect, item[1], item[2], endsep): continue text = string.join(collect, "") if text: output.append(("rawtext", text)) if item[0] != None: output.append(item) rawseen = cursor+1 collect = [] return output
| 3,983
|
def optimize(self, program): output = [] collect = [] rawseen = cursor = 0 if self.xml: endsep = "/>" else: endsep = " />" for cursor in xrange(len(program)+1): try: item = program[cursor] except IndexError: item = (None, None) if item[0] == "rawtext": collect.append(item[1]) continue if item[0] == "endTag": collect.append("</%s>" % item[1]) continue if item[0] == "startTag": if self.optimizeStartTag(collect, item[1], item[2], ">"): continue if item[0] == "startEndTag": if self.optimizeStartTag(collect, item[1], item[2], endsep): continue text = string.join(collect, "") if text: output.append(("rawtext", text)) if item[0] != None: output.append(item) rawseen = cursor+1 collect = [] return output
|
def optimize(self, program): output = [] collect = [] rawseen = cursor = 0 if self.xml: endsep = "/>" else: endsep = " />" for cursor in xrange(len(program)+1): try: item = program[cursor] except IndexError: item = (None, None) if item[0] == "rawtext": collect.append(item[1]) continue if opcode == "endTag": collect.append("</%s>" % item[1]) continue if item[0] == "startTag": if self.optimizeStartTag(collect, item[1], item[2], ">"): continue if item[0] == "startEndTag": if self.optimizeStartTag(collect, item[1], item[2], endsep): continue text = string.join(collect, "") if text: output.append(("rawtext", text)) if item[0] != None: output.append(item) rawseen = cursor+1 collect = [] return output
| 3,984
|
def optimize(self, program): output = [] collect = [] rawseen = cursor = 0 if self.xml: endsep = "/>" else: endsep = " />" for cursor in xrange(len(program)+1): try: item = program[cursor] except IndexError: item = (None, None) if item[0] == "rawtext": collect.append(item[1]) continue if item[0] == "endTag": collect.append("</%s>" % item[1]) continue if item[0] == "startTag": if self.optimizeStartTag(collect, item[1], item[2], ">"): continue if item[0] == "startEndTag": if self.optimizeStartTag(collect, item[1], item[2], endsep): continue text = string.join(collect, "") if text: output.append(("rawtext", text)) if item[0] != None: output.append(item) rawseen = cursor+1 collect = [] return output
|
def optimize(self, program): output = [] collect = [] rawseen = cursor = 0 if self.xml: endsep = "/>" else: endsep = " />" for cursor in xrange(len(program)+1): try: item = program[cursor] except IndexError: item = (None, None) if item[0] == "rawtext": collect.append(item[1]) continue if item[0] == "endTag": collect.append("</%s>" % item[1]) continue if opcode == "startTag": if self.optimizeStartTag(collect, item[1], item[2], ">"): continue if item[0] == "startEndTag": if self.optimizeStartTag(collect, item[1], item[2], endsep): continue text = string.join(collect, "") if text: output.append(("rawtext", text)) if item[0] != None: output.append(item) rawseen = cursor+1 collect = [] return output
| 3,985
|
def optimize(self, program): output = [] collect = [] rawseen = cursor = 0 if self.xml: endsep = "/>" else: endsep = " />" for cursor in xrange(len(program)+1): try: item = program[cursor] except IndexError: item = (None, None) if item[0] == "rawtext": collect.append(item[1]) continue if item[0] == "endTag": collect.append("</%s>" % item[1]) continue if item[0] == "startTag": if self.optimizeStartTag(collect, item[1], item[2], ">"): continue if item[0] == "startEndTag": if self.optimizeStartTag(collect, item[1], item[2], endsep): continue text = string.join(collect, "") if text: output.append(("rawtext", text)) if item[0] != None: output.append(item) rawseen = cursor+1 collect = [] return output
|
def optimize(self, program): output = [] collect = [] rawseen = cursor = 0 if self.xml: endsep = "/>" else: endsep = " />" for cursor in xrange(len(program)+1): try: item = program[cursor] except IndexError: item = (None, None) if item[0] == "rawtext": collect.append(item[1]) continue if item[0] == "endTag": collect.append("</%s>" % item[1]) continue if item[0] == "startTag": if self.optimizeStartTag(collect, item[1], item[2], ">"): continue if opcode == "startEndTag": if self.optimizeStartTag(collect, item[1], item[2], endsep): continue text = string.join(collect, "") if text: output.append(("rawtext", text)) if item[0] != None: output.append(item) rawseen = cursor+1 collect = [] return output
| 3,986
|
def optimize(self, program): output = [] collect = [] rawseen = cursor = 0 if self.xml: endsep = "/>" else: endsep = " />" for cursor in xrange(len(program)+1): try: item = program[cursor] except IndexError: item = (None, None) if item[0] == "rawtext": collect.append(item[1]) continue if item[0] == "endTag": collect.append("</%s>" % item[1]) continue if item[0] == "startTag": if self.optimizeStartTag(collect, item[1], item[2], ">"): continue if item[0] == "startEndTag": if self.optimizeStartTag(collect, item[1], item[2], endsep): continue text = string.join(collect, "") if text: output.append(("rawtext", text)) if item[0] != None: output.append(item) rawseen = cursor+1 collect = [] return output
|
def optimize(self, program): output = [] collect = [] rawseen = cursor = 0 if self.xml: endsep = "/>" else: endsep = " />" for cursor in xrange(len(program)+1): try: item = program[cursor] except IndexError: item = (None, None) if item[0] == "rawtext": collect.append(item[1]) continue if item[0] == "endTag": collect.append("</%s>" % item[1]) continue if item[0] == "startTag": if self.optimizeStartTag(collect, item[1], item[2], ">"): continue if item[0] == "startEndTag": if self.optimizeStartTag(collect, item[1], item[2], endsep): continue text = string.join(collect, "") if text: i = string.rfind(text, "\n") if i >= 0: i = len(text) - (i + 1) output.append(("rawtextColumn", (text, i))) else: output.append(("rawtextOffset", (text, len(text)))) if opcode != None: output.append((opcode, tuple(item[1:]))) rawseen = cursor+1 collect = [] return output
| 3,987
|
def validate(self, accessed, container, name, value, context, None=None, type=type, IntType=type(0), DictType=type({}), getattr=getattr, _noroles=_noroles, StringType=type(''), Containers=SimpleObjectPolicies.Containers, valid_aq_=('aq_parent','aq_explicit')):
|
def validate(self, accessed, container, name, value, context, None=None, type=type, IntType=type(0), DictType=type({}), getattr=getattr, _noroles=_noroles, StringType=type(''), Containers=SimpleObjectPolicies.Containers, valid_aq_=('aq_parent','aq_explicit')):
| 3,988
|
def validate(self, accessed, container, name, value, context, None=None, type=type, IntType=type(0), DictType=type({}), getattr=getattr, _noroles=_noroles, StringType=type(''), Containers=SimpleObjectPolicies.Containers, valid_aq_=('aq_parent','aq_explicit')):
|
def validate(self, accessed, container, name, value, context, None=None, type=type, IntType=type(0), DictType=type({}), getattr=getattr, _noroles=_noroles, StringType=type(''), Containers=SimpleObjectPolicies.Containers, valid_aq_=('aq_parent','aq_explicit')):
| 3,989
|
def structure(list): if not list: return [] i=0 l=len(list) r=[] while i < l: sublen=paragraphs(list,i) i=i+1 r.append((list[i-1][1],structure(list[i:i+sublen]))) i=i+sublen return r
|
def structure(list): if not list: return [] i=0 l=len(list) r=[] while i < l: sublen=paragraphs(list,i) i=i+1 r.append((list[i-1][1],structure(list[i:i+sublen]))) i=i+sublen return r
| 3,990
|
def __init__(self,aStructuredString, level=1):
|
def __init__(self,aStructuredString, level=1):
| 3,991
|
def ctag(s): if s is None: s='' s=regsub.gsub(extra_dl,'\n',s) s=regsub.gsub(extra_ul,'\n',s) s=regsub.gsub(extra_ol,'\n',s) s=regsub.gsub(strong,' <strong>\\1</strong>\\2',s) s=regsub.gsub(code,' <code>\\1</code>\\3',s) s=regsub.gsub(em,' <em>\\1</em>\\2',s) return s
|
def ctag(s): if s is None: s='' s=regsub.gsub(strong,' <strong>\\1</strong>\\2',s) s=regsub.gsub(code,' <code>\\1</code>\\3',s) s=regsub.gsub(em,' <em>\\1</em>\\2',s) return s
| 3,992
|
def __str__(self):
|
def __str__(self):
| 3,993
|
def head(self, before, t, level, d):
|
defif level > 0 and level < 6: return ('%s<h%d>%s</h%d>\n%s\n' % (before,level,ctag(t),level,d)) head(self,if level > 0 and level < 6: return ('%s<h%d>%s</h%d>\n%s\n' % (before,level,ctag(t),level,d)) before,if level > 0 and level < 6: return ('%s<h%d>%s</h%d>\n%s\n' % (before,level,ctag(t),level,d)) t,if level > 0 and level < 6: return ('%s<h%d>%s</h%d>\n%s\n' % (before,level,ctag(t),level,d)) level,if level > 0 and level < 6: return ('%s<h%d>%s</h%d>\n%s\n' % (before,level,ctag(t),level,d)) d):
| 3,994
|
def _str(self,structure,level):
|
def _str(self,structure,level):
| 3,995
|
def _str(self,structure,level):
|
def _str(self,structure,level):
| 3,996
|
def html_with_references(text): import regsub text = regsub.gsub( '[\0\n].. \[\([0-9_a-zA-Z]+\)\]', '\n <a name="\\1">[\\1]</a>', text) text = regsub.gsub( '\([\0- ,]\)\[\([0-9_a-zA-Z]+\)\]\([\0- ,.:]\)', '\\1<a href="#\\2">[\\2]</a>\\3', text) text = regsub.gsub( '\([\0- ]\)\([a-z]+://[^\0- ]+\)', '\\1<a href="\\2">\\2</a>', text) return HTML(text)
|
def html_with_references(text): import regsub text = regsub.gsub( '[\0\n].. \[\([-_0-9_a-zA-Z]+\)\]', '\n <a name="\\1">[\\1]</a>', text) text = regsub.gsub( '\([\0- ,]\)\[\([0-9_a-zA-Z]+\)\]\([\0- ,.:]\)', '\\1<a href="#\\2">[\\2]</a>\\3', text) text = regsub.gsub( '\([\0- ]\)\([a-z]+://[^\0- ]+\)', '\\1<a href="\\2">\\2</a>', text) return HTML(text)
| 3,997
|
def html_with_references(text): import regsub text = regsub.gsub( '[\0\n].. \[\([0-9_a-zA-Z]+\)\]', '\n <a name="\\1">[\\1]</a>', text) text = regsub.gsub( '\([\0- ,]\)\[\([0-9_a-zA-Z]+\)\]\([\0- ,.:]\)', '\\1<a href="#\\2">[\\2]</a>\\3', text) text = regsub.gsub( '\([\0- ]\)\([a-z]+://[^\0- ]+\)', '\\1<a href="\\2">\\2</a>', text) return HTML(text)
|
def html_with_references(text): import regsub text = regsub.gsub( '[\0\n].. \[\([0-9_a-zA-Z]+\)\]', '\n <a name="\\1">[\\1]</a>', text) text = regsub.gsub( '\([\0- ,]\)\[\([0-9_a-zA-Z]+\)\]\([\0- ,.:]\)', '\\1<a href="#\\2">[\\2]</a>\\3', text) text = regsub.gsub( '\([\0- ]\)\([a-z]+://[^\0- ]+\)', '\\1<a href="\\2">\\2</a>', text) return HTML(text,level=1)
| 3,998
|
def goahead(self, end): rawdata = self.rawdata i = 0 n = len(rawdata) while i < n: if self.nomoretags: self.handle_data(rawdata[i:n]) i = self.updatepos(i, n) break match = interesting.search(rawdata, i) if match: j = match.start(0) else: j = n if i < j: self.handle_data(rawdata[i:j]) i = self.updatepos(i, j) if i == n: break if rawdata[i] == '<': if starttagopen.match(rawdata, i): if self.literal: self.handle_data(rawdata[i]) i = self.updatepos(i, i+1) continue k = self.parse_starttag(i) if k < 0: break i = self.updatepos(i, k) continue if endtagopen.match(rawdata, i): k = self.parse_endtag(i) if k < 0: break i = self.updatepos(i, k) self.literal = 0 continue if commentopen.match(rawdata, i): if self.literal: self.handle_data(rawdata[i]) i = self.updatepos(i, i+1) continue k = self.parse_comment(i) if k < 0: break i = self.updatepos(i, i+k) continue if piopen.match(rawdata, i): if self.literal: self.handle_data(rawdata[i]) i = self.updatepos(i, i+1) continue k = self.parse_pi(i) if k < 0: break i = self.updatepos(i, i+k) continue match = special.match(rawdata, i) if match: if self.literal: self.handle_data(rawdata[i]) i = self.updatepos(i, i+1) continue # This is some sort of declaration; in "HTML as # deployed," this should only be the document type # declaration ("<!DOCTYPE html...>"). k = self.parse_declaration(i) if k < 0: break i = self.updatepos(i, k) continue elif rawdata[i] == '&': match = charref.match(rawdata, i) if match: name = match.group(1) self.handle_charref(name) k = match.end(0) if rawdata[k-1] != ';': k = k-1 i = self.updatepos(i, k) continue match = entityref.match(rawdata, i) if match: name = match.group(1) self.handle_entityref(name) k = match.end(0) if rawdata[k-1] != ';': k = k-1 i = self.updatepos(i, k) continue else: raise HTMLParserError('neither < nor & ??', self.getpos()) # We get here only if incomplete matches but # nothing else match = incomplete.match(rawdata, i) if not match: self.handle_data(rawdata[i]) i = self.updatepos(i, i+1) continue j = match.end(0) if j == n: break # Really incomplete self.handle_data(rawdata[i:j]) i = self.updatepos(i, j) # end while if end and i < n: self.handle_data(rawdata[i:n]) i = self.updatepos(i, n) self.rawdata = rawdata[i:] # XXX if end: check for empty stack
|
def goahead(self, end): rawdata = self.rawdata i = 0 n = len(rawdata) while i < n: if self.nomoretags: self.handle_data(rawdata[i:n]) i = self.updatepos(i, n) break match = interesting.search(rawdata, i) if match: j = match.start(0) else: j = n if i < j: self.handle_data(rawdata[i:j]) i = self.updatepos(i, j) if i == n: break if rawdata[i] == '<': if starttagopen.match(rawdata, i): if self.literal: self.handle_data(rawdata[i]) i = self.updatepos(i, i+1) continue k = self.parse_starttag(i) if k < 0: break i = self.updatepos(i, k) continue if endtagopen.match(rawdata, i): k = self.parse_endtag(i) if k < 0: break i = self.updatepos(i, k) self.literal = 0 continue if commentopen.match(rawdata, i): if self.literal: self.handle_data(rawdata[i]) i = self.updatepos(i, i+1) continue k = self.parse_comment(i) if k < 0: break i = self.updatepos(i, i+k) continue if piopen.match(rawdata, i): if self.literal: self.handle_data(rawdata[i]) i = self.updatepos(i, i+1) continue k = self.parse_pi(i) if k < 0: break i = self.updatepos(i, i+k) continue match = special.match(rawdata, i) if match: if self.literal: self.handle_data(rawdata[i]) i = self.updatepos(i, i+1) continue # This is some sort of declaration; in "HTML as # deployed," this should only be the document type # declaration ("<!DOCTYPE html...>"). k = self.parse_declaration(i) if k < 0: break i = self.updatepos(i, k) continue elif rawdata[i] == '&': match = charref.match(rawdata, i) if match: name = match.group(1) self.handle_charref(name) k = match.end(0) if rawdata[k-1] != ';': k = k-1 i = self.updatepos(i, k) continue match = entityref.match(rawdata, i) if match: name = match.group(1) self.handle_entityref(name) k = match.end(0) if rawdata[k-1] != ';': k = k-1 i = self.updatepos(i, k) continue # We get here only if incomplete matches but # nothing else match = incomplete.match(rawdata, i) if not match: self.handle_data(rawdata[i]) i = self.updatepos(i, i+1) continue j = match.end(0) if j == n: break # Really incomplete self.handle_data(rawdata[i:j]) i = self.updatepos(i, j) # end while if end and i < n: self.handle_data(rawdata[i:n]) i = self.updatepos(i, n) self.rawdata = rawdata[i:] # XXX if end: check for empty stack
| 3,999
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.