bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def upload_file(object, f): if os.path.isdir(f): return upload_dir(object, f) dir, name = os.path.split(f) root, ext = os.path.splitext(name) if ext in ('file', 'dir'): ext='' else: ext=string.lower(ext) if ext and ext[0] in '.': ext=ext[1:] if ext and globals().has_key('upload_'+ext): if verbose: print 'upload_'+ext, ...
def upload_file(object, f): if os.path.isdir(f): return upload_dir(object, f) dir, name = os.path.split(f) root, ext = os.path.splitext(name) if ext in ('file', 'dir'): ext='' else: ext=string.lower(ext) if ext and ext[0] in '.': ext=ext[1:] if ext and globals().has_key('upload_'+ext): if verbose: print 'upload_'+ext, ...
3,200
def upload_html(object, f): dir, name = os.path.split(f) f=open(f) # There is a Document bugs that causes file uploads to fail. # Waaa. This will be fixed in 1.10.2. #f=f.read() title, head, body = parse_html(f) if old: call(object.manage_addDocument, id=name, file=body) else: call(object.manage_addDTMLDocument, id=...
def upload_html(object, f): dir, name = os.path.split(f) f=open(f) # There is a Document bugs that causes file uploads to fail. # Waaa. This will be fixed in 1.10.2. #f=f.read() title, head, body = parse_html(f) if old: call(object.manage_addDocument, id=name, file=body) else: call(object.manage_addDTMLDocument, id=...
3,201
def upload_html(object, f): dir, name = os.path.split(f) f=open(f) # There is a Document bugs that causes file uploads to fail. # Waaa. This will be fixed in 1.10.2. #f=f.read() title, head, body = parse_html(f) if old: call(object.manage_addDocument, id=name, file=body) else: call(object.manage_addDTMLDocument, id=...
def upload_html(object, f): dir, name = os.path.split(f) f=open(f) # There is a Document bugs that causes file uploads to fail. # Waaa. This will be fixed in 1.10.2. #f=f.read() title, head, body = parse_html(f) if old: call(object.manage_addDocument, id=name, file=body) else: call(object.manage_addDTMLDocument, id=...
3,202
def upload_dtml(object, f): dir, name = os.path.split(f) if old: call(object.manage_addDocument, id=name, file=open(f)) else: call(object.manage_addDTMLDocument, id=name, file=f)
def upload_dtml(object, f): dir, name = os.path.split(f) if old: f=f.read() call(object.manage_addDocument, id=name, file=f) else: call(object.manage_addDTMLDocument, id=name, file=f)
3,203
def upload_dtml(object, f): dir, name = os.path.split(f) if old: call(object.manage_addDocument, id=name, file=open(f)) else: call(object.manage_addDTMLDocument, id=name, file=f)
def upload_dtml(object, f): dir, name = os.path.split(f) if old: call(object.manage_addDocument, id=name, file=open(f)) else: call(object.manage_addDTMLMethod, id=name, file=f)
3,204
def upload_gif(object, f): dir, name = os.path.split(f) call(object.manage_addImage, id=name, file=open(f))
def upload_gif(object, f): dir, name = os.path.split(f) call(object.manage_addImage, id=name, file=open(f,'rb'))
3,205
def careful_getslice(md, seq, *indexes): v=len(indexes) if v==2: v=seq[indexes[0]:indexes[1]] elif v==1: v=seq[indexes[0]:] else: v=seq[:] if type(seq) is type(''): return v # Short-circuit common case validate=md.validate if validate is not None: for e in v: if not validate(seq,seq,'',e,md): raise ValidationError, '...
def careful_getslice(md, seq, *indexes): v=len(indexes) if v==2: v=seq[indexes[0]:indexes[1]] elif v==1: v=seq[indexes[0]:] else: v=seq[:] if type(seq) is type(''): return v # Short-circuit common case validate=md.validate if validate is not None: for e in v: if not validate(seq,seq,'',e,md): raise ValidationError, '...
3,206
def __call__(self,REQUEST=None):
def __call__(self,REQUEST=None):
3,207
def __init__(self, blocks):
def __init__(self, blocks):
3,208
def initializeProduct(productp, name, home, app): # Initialize a levered product products=app.Control_Panel.Products if hasattr(productp, '__import_error__'): ie=productp.__import_error__ else: ie=None try: fver=strip(open(home+'/version.txt').read()) except: fver='' old=None try: if ihasattr(products,name): old=get...
def initializeProduct(productp, name, home, app): # Initialize a levered product products=app.Control_Panel.Products if hasattr(productp, '__import_error__'): ie=productp.__import_error__ else: ie=None try: fver=strip(open(home+'/version.txt').read()) except: fver='' old=None try: if ihasattr(products,name): old=get...
3,209
def getSuiteFromFile(self, filepath): if not os.path.isfile(filepath): raise ValueError, '%s is not a file' % filepath path, filename=os.path.split(filepath) name, ext=os.path.splitext(filename) file, pathname, desc=imp.find_module(name, [path]) saved_syspath = sys.path[:] try: sys.path.append(path) # let module ...
def getSuiteFromFile(self, filepath): if not os.path.isfile(filepath): raise ValueError, '%s is not a file' % filepath path, filename=os.path.split(filepath) name, ext=os.path.splitext(filename) file, pathname, desc=imp.find_module(name, [path]) saved_syspath = sys.path[:] try: sys.path.append(path) # let module ...
3,210
def custom_default_report(id, result, action='', no_table=0): columns=result._searchable_result_columns() __traceback_info__=columns heading=('<tr>\n%s\t</tr>' % string.joinfields( map(lambda c: '\t<th>%s</th>\n' % nicify(c['name']), columns), '' ) ) if no_table: tr, _tr, td, _td, delim = '<p>', '</p>', '', '', ', ' e...
def custom_default_report(id, result, action='', no_table=0, goofy=regex.compile('[^a-zA-Z0-9_]').search ): columns=result._searchable_result_columns() __traceback_info__=columns heading=('<tr>\n%s\t</tr>' % string.joinfields( map(lambda c: '\t<th>%s</th>\n' % nicify(c['name']), columns), '' ) ) if no_table: tr, _tr, ...
3,211
def custom_default_report(id, result, action='', no_table=0): columns=result._searchable_result_columns() __traceback_info__=columns heading=('<tr>\n%s\t</tr>' % string.joinfields( map(lambda c: '\t<th>%s</th>\n' % nicify(c['name']), columns), '' ) ) if no_table: tr, _tr, td, _td, delim = '<p>', '</p>', '', '', ', ' e...
def custom_default_report(id, result, action='', no_table=0): columns=result._searchable_result_columns() __traceback_info__=columns heading=('<tr>\n%s\t</tr>' % string.joinfields( map(lambda c: '\t<th>%s</th>\n' % nicify(c['name']), columns), '' ) ) if no_table: tr, _tr, td, _td, delim = '<p>', '</p>', '', '', ', ' e...
3,212
def LOCK(self, REQUEST, RESPONSE): """Lock a resource""" self.dav__init(REQUEST, RESPONSE) security = getSecurityManager() creator = security.getUser() body = REQUEST.get('BODY', '') ifhdr = REQUEST.get_header('If', None) depth = REQUEST.get_header('Depth', 'infinite') alreadylocked = Lockable.wl_isLocked(self)
def LOCK(self, REQUEST, RESPONSE): """Lock a resource""" self.dav__init(REQUEST, RESPONSE) security = getSecurityManager() creator = security.getUser() body = REQUEST.get('BODY', '') ifhdr = REQUEST.get_header('If', None) depth = REQUEST.get_header('Depth', 'infinite') alreadylocked = Lockable.wl_isLocked(self)
3,213
def make_sortfunctions(sortfields, _): """Accepts a list of sort fields; splits every field, finds comparison function. Returns a list of 3-tuples (field, cmp_function, asc_multplier)""" sf_list = [] for field in sortfields: f = list(field) l = len(f) if l == 1: f.append("cmp") f.append("asc") elif l == 2: f.append("...
def make_sortfunctions(sortfields, _): """Accepts a list of sort fields; splits every field, finds comparison function. Returns a list of 3-tuples (field, cmp_function, asc_multplier)""" sf_list = [] for field in sortfields: f = list(field) l = len(f) if l == 1: f.append("cmp") f.append("asc") elif l == 2: f.append("...
3,214
def _setPropValue(self, id, value): Cache._setPropValue(self, id, value) self.ZCacheable_invalidate()
def _setPropValue(self, id, value): PropertyManager._setPropValue(self, id, value) self.ZCacheable_invalidate()
3,215
def parse_qsl(qs, keep_blank_values=0, strict_parsing=0): """Parse a query given as a string argument. Arguments: qs: URL-encoded query string to be parsed keep_blank_values: flag indicating whether blank values in URL encoded queries should be treated as blank strings. A true value inicates that blanks should be re...
def parse_qsl(qs, keep_blank_values=0, strict_parsing=0): """Parse a query given as a string argument. Arguments: qs: URL-encoded query string to be parsed keep_blank_values: flag indicating whether blank values in URL encoded queries should be treated as blank strings. A true value inicates that blanks should be re...
3,216
def info(self,t=None): idx=self.index(t)[0] zs =self.az[self.tinfo[idx][2]:] return self.tinfo[idx][0],self.tinfo[idx][1],zs[:find(zs,'\000')]
def info(self,t=None): idx=self.index(t)[0] zs =self.az[self.tinfo[idx][2]:] return self.tinfo[idx][0],self.tinfo[idx][1],zs[:find(zs,'\000')]
3,217
def __getitem__(self,k): try: n=self._zmap[lower(k)] except KeyError: if numericTimeZoneMatch(k) <= 0: raise 'DateTimeError','Unrecognized timezone: %s' % k return k try: return self._d[n] except KeyError: z=self._d[n]=_timezone(self._db[n]) return z
def __getitem__(self,k): try:def _findLocalTimeZoneName(isDST): if not daylight: isDST = 0 try: _localzone = _cache._zmap[lower(tzname[isDST])] except: try: _localzone = _cache._zmap[lower(tzname[0])] except: try: if isDST: localzone = altzone else: localzone = timezone offset=(-localzone/(60*60)) majorOffset=int...
3,218
def __init__(self,*args): """Return a new date-time object
def __init__(self,*args): """Return a new date-time object
3,219
def __init__(self,*args): """Return a new date-time object
def __init__(self,*args): """Return a new date-time object
3,220
def __init__(self,*args): """Return a new date-time object
def __init__(self,*args): """Return a new date-time object
3,221
def __init__(self,*args): """Return a new date-time object
def __init__(self,*args): """Return a new date-time object
3,222
def __init__(self,*args): """Return a new date-time object
def __init__(self,*args): """Return a new date-time object
3,223
def __init__(self,*args): """Return a new date-time object
def __init__(self,*args): """Return a new date-time object
3,224
def __init__(self,*args): """Return a new date-time object
def __init__(self,*args): """Return a new date-time object
3,225
def __init__(self,*args): """Return a new date-time object
def __init__(self,*args): """Return a new date-time object
3,226
def __init__(self,*args): """Return a new date-time object
def __init__(self,*args): """Return a new date-time object
3,227
def __init__(self,*args): """Return a new date-time object
def __init__(self,*args): """Return a new date-time object
3,228
def __init__(self,*args): """Return a new date-time object
def __init__(self,*args): """Return a new date-time object
3,229
def __init__(self,*args): """Return a new date-time object
def __init__(self,*args): """Return a new date-time object
3,230
def __init__(self,*args): """Return a new date-time object
defif millisecs is None: millisecs = long(math.floor(t * 1000.0)) self._millis = millisecs __init__(self,*args):if millisecs is None: millisecs = long(math.floor(t * 1000.0)) self._millis = millisecs """Returnif millisecs is None: millisecs = long(math.floor(t * 1000.0)) self._millis = millisecs aif millisecs is ...
3,231
def __init__(self,*args): """Return a new date-time object
def __init__(self,*args): """Return a new date-time object
3,232
def __init__(self,*args): """Return a new date-time object
def __init__(self,*args): """Return a new date-time object
3,233
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 ...
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 ...
3,234
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 ...
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 ...
3,235
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 ...
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 ...
3,236
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 ...
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 ...
3,237
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 ...
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 =['a...
3,238
def _julianday(self,yr,mo,dy): y,m,d=long(yr),long(mo),long(dy) if m > 12L: y=y+m/12L m=m%12L elif m < 1L: m=-m y=y-m/12L-1L m=12L-m%12L if y > 0L: yr_correct=0L else: yr_correct=3L if m < 3L: y, m=y-1L,m+12L if y*10000L+m*100L+d > 15821014L: b=2L-y/100L+y/400L else: b=0L return (1461L*y-yr_correct)/4L+306001L*(m+...
def _julianday(self,yr,mo,dy): y,m,d=long(yr),long(mo),long(dy) if m > 12L: y=y+m/12L m=m%12L elif m < 1L: m=-m y=y-m/12L-1L m=12L-m%12L if y > 0L: yr_correct=0L else: yr_correct=3L if m < 3L: y, m=y-1L,m+12L if y*10000L+m*100L+d > 15821014L: b=2L-y/100L+y/400L else: b=0L return (1461L*y-yr_correct)/4L+306001L*(m+...
3,239
def toZone(self, z): """Return a DateTime with the value as the current object, represented in the indicated timezone.""" t,tz=self._t,self._tzinfo._zmap[lower(z)] if (t>0 and ((t/86400.0) < 24837)): # Try to cheat and use time module for speed... yr,mo,dy,hr,mn,sc=gmtime(t+self._tzinfo[tz].info(t)[0])[:6] sc=self._sec...
def toZone(self, z): """Return a DateTime with the value as the current object, represented in the indicated timezone.""" t,tz=self._t,self._tzinfo._zmap[lower(z)] if (t>0 and ((t/86400.0) < 24837)): # Try to cheat and use time module for speed... yr,mo,dy,hr,mn,sc=gmtime(t+self._tzinfo[tz].info(t)[0])[:6] sc=self._sec...
3,240
def toZone(self, z): """Return a DateTime with the value as the current object, represented in the indicated timezone.""" t,tz=self._t,self._tzinfo._zmap[lower(z)] if (t>0 and ((t/86400.0) < 24837)): # Try to cheat and use time module for speed... yr,mo,dy,hr,mn,sc=gmtime(t+self._tzinfo[tz].info(t)[0])[:6] sc=self._sec...
def toZone(self, z): """Return a DateTime with the value as the current object, represented in the indicated timezone.""" t,tz=self._t,self._tzinfo._zmap[lower(z)] if (t>0 and ((t/86400.0) < 24837)): # Try to cheat and use time module for speed... yr,mo,dy,hr,mn,sc=gmtime(t+self._tzinfo[tz].info(t)[0])[:6] sc=self._sec...
3,241
def isCurrentYear(self): """Return true if this object represents a date/time that falls within the current year, in the context of this object\'s timezone representation""" t=time() return gmtime(t+self._tzinfo[self._tz].info(t)[0])[0]==self._year
def isCurrentYear(self): """Return true if this object represents a date/time that falls within the current year, in the context of this object\'s timezone representation""" t=time() return gmtime(t+self._tzinfo[self._tz].info(t)[0])[0]==self._year
3,242
def isCurrentMonth(self): """Return true if this object represents a date/time that falls within the current month, in the context of this object\'s timezone representation""" t=time() return gmtime(t+self._tzinfo[self._tz].info(t)[0])[1]==self._month
def isCurrentMonth(self): """Return true if this object represents a date/time that falls within the current month, in the context of this object\'s timezone representation""" t=time() return gmtime(t+self._tzinfo[self._tz].info(t)[0])[1]==self._month
3,243
def isCurrentDay(self): """Return true if this object represents a date/time that falls within the current day, in the context of this object\'s timezone representation""" t=time() return gmtime(t+self._tzinfo[self._tz].info(t)[0])[2]==self._day
def isCurrentDay(self): """Return true if this object represents a date/time that falls within the current day, in the context of this object\'s timezone representation""" t=time() return gmtime(t+self._tzinfo[self._tz].info(t)[0])[2]==self._day
3,244
def isCurrentHour(self): """Return true if this object represents a date/time that falls within the current hour, in the context of this object\'s timezone representation""" t=time() return gmtime(t+self._tzinfo[self._tz].info(t)[0])[3]==self._hour
def isCurrentHour(self): """Return true if this object represents a date/time that falls within the current hour, in the context of this object\'s timezone representation""" t=time() return gmtime(t+self._tzinfo[self._tz].info(t)[0])[3]==self._hour
3,245
def isCurrentMinute(self): """Return true if this object represents a date/time that falls within the current minute, in the context of this object\'s timezone representation""" t=time() return gmtime(t+self._tzinfo[self._tz].info(t)[0])[4]==self._minute
def isCurrentMinute(self): """Return true if this object represents a date/time that falls within the current minute, in the context of this object\'s timezone representation""" t=time() return gmtime(t+self._tzinfo[self._tz].info(t)[0])[4]==self._minute
3,246
def greaterThan(self,t): """Compare this DateTime object to another DateTime object OR a floating point number such as that which is returned by the python time module. Returns true if the object represents a date/time greater than the specified DateTime or time module style time.""" try: return (self._d > t._d) exc...
def greaterThan(self,t): """Compare this DateTime object to another DateTime object OR a floating point number such as that which is returned by the python time module. Returns true if the object represents a date/time greater than the specified DateTime or time module style time. Revised to give more correct results t...
3,247
def greaterThanEqualTo(self,t): """Compare this DateTime object to another DateTime object OR a floating point number such as that which is returned by the python time module. Returns true if the object represents a date/time greater than or equal to the specified DateTime or time module style time.""" try: return (...
def greaterThanEqualTo(self,t): """Compare this DateTime object to another DateTime object OR a floating point number such as that which is returned by the python time module. Returns true if the object represents a date/time greater than or equal to the specified DateTime or time module style time. Revised to give mor...
3,248
def equalTo(self,t): """Compare this DateTime object to another DateTime object OR a floating point number such as that which is returned by the python time module. Returns true if the object represents a date/time equal to the specified DateTime or time module style time.""" try: return (self._d == t._d) except: re...
def equalTo(self,t): """Compare this DateTime object to another DateTime object OR a floating point number such as that which is returned by the python time module. Returns true if the object represents a date/time equal to the specified DateTime or time module style time. Revised to give more correct results through c...
3,249
def notEqualTo(self,t): """Compare this DateTime object to another DateTime object OR a floating point number such as that which is returned by the python time module. Returns true if the object represents a date/time not equal to the specified DateTime or time module style time.""" try: return (self._d != t._d) exc...
def notEqualTo(self,t): """Compare this DateTime object to another DateTime object OR a floating point number such as that which is returned by the python time module. Returns true if the object represents a date/time not equal to the specified DateTime or time module style time. Revised to give more correct results th...
3,250
def lessThan(self,t): """Compare this DateTime object to another DateTime object OR a floating point number such as that which is returned by the python time module. Returns true if the object represents a date/time less than the specified DateTime or time module style time.""" try: return (self._d < t._d) except: r...
def lessThan(self,t): """Compare this DateTime object to another DateTime object OR a floating point number such as that which is returned by the python time module. Returns true if the object represents a date/time less than the specified DateTime or time module style time. Revised to give more correct results through...
3,251
def lessThanEqualTo(self,t): """Compare this DateTime object to another DateTime object OR a floating point number such as that which is returned by the python time module. Returns true if the object represents a date/time less than or equal to the specified DateTime or time module style time.""" try: return (self._...
def lessThanEqualTo(self,t): """Compare this DateTime object to another DateTime object OR a floating point number such as that which is returned by the python time module. Returns true if the object represents a date/time less than or equal to the specified DateTime or time module style time. Revised to give more corr...
3,252
def dayOfYear(self): """Return the day of the year, in context of the timezone representation of the object""" d=int(self._d+(self._tzinfo[self._tz].info(self._t)[0]/86400.0)) return int((d+jd1901)-self._julianday(self._year,1,0))
def dayOfYear(self): """Return the day of the year, in context of the timezone representation of the object""" d=int(self._d+(self._tzinfo[self._tz].info(self._t)[0]/86400.0)) return int((d+jd1901)-self._julianday(self._year,1,0))
3,253
def __add__(self,other): """A DateTime may be added to a number and a number may be added to a DateTime; two DateTimes cannot be added.""" if hasattr(other,'_t'): raise self.DateTimeError,'Cannot add two DateTimes' o=float(other) d,t,tz=(self._d+o),(self._t+(o*86400.0)),self._tz x=d+(self._tzinfo[tz].info(t)[0]/86400....
def __add__(self,other): """A DateTime may be added to a number and a number may be added to a DateTime; two DateTimes cannot be added.""" if hasattr(other,'_t'): raise self.DateTimeError,'Cannot add two DateTimes' o=float(other) d,t,tz=(self._d+o),(self._t+(o*86400.0)),self._tz x=d+(self._tzinfo[tz].info(t)[0]/86400....
3,254
def __str__(self): """Convert a DateTime to a string.""" y,m,d =self._year,self._month,self._day h,mn,s,t=self._hour,self._minute,self._second,self._tz if(h+mn+s): if (s-int(s))> 0.0001: return '%4.4d/%2.2d/%2.2d %2.2d:%2.2d:%g %s' % ( y,m,d,h,mn,s,t) else: return '%4.4d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d %s' % ( y,m,d,h...
def __str__(self): """Convert a DateTime to a string.""" y,m,d =self._year,self._month,self._day h,mn,s,t=self._hour,self._minute,self._second,self._tz if(h+mn+s): if (s-int(s))> 0.0001: try: subsec = split('%g' % s, '.')[1] return '%4.4d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d.%s %s' % ( y,m,d,h,mn,s,subsec,t) except: pas...
3,255
def __cmp__(self,obj): """Compare a DateTime with another DateTime object, or a float such as those returned by time.time().
def __cmp__(self,obj): """Compare a DateTime with another DateTime object, or a float such as those returned by time.time().
3,256
def __int__(self): """Convert to an integer number of seconds since the epoch (gmt)""" return int(self._t)
def __int__(self): """Convert to an integer number of seconds since the epoch (gmt)""" return int(self._t)
3,257
def __long__(self): """Convert to a long-int number of seconds since the epoch (gmt)""" return long(self._t)
def __long__(self): """Convert to a long-int number of seconds since the epoch (gmt)""" return long(self._t)
3,258
def exception(self, fatal=0, info=None, absuri_match=regex.compile( "^" "\(/\|\([a-zA-Z0-9+.-]+:\)\)" "[^\000- \"\\#<>]*" "\\(#[^\000- \"\\#<>]*\\)?" "$" ).match, tag_search=regex.compile('[a-zA-Z]>').search, ): if type(info) is type(()) and len(info)==3: t,v,tb = info else: t,v,tb = sys.exc_info()
def exception(self, fatal=0, info=None, absuri_match=regex.compile( "^" "\(/\|\([a-zA-Z0-9+.-]+:\)\)" "[^\000- \"\\#<>]*" "\\(#[^\000- \"\\#<>]*\\)?" "$" ).match, tag_search=regex.compile('[a-zA-Z]>').search, ): if type(info) is type(()) and len(info)==3: t,v,tb = info else: t,v,tb = sys.exc_info()
3,259
def manage_addExternalMethod(self, id, title, module, function): """ Add an external method to an ObjectManager. In addition to the standard object-creation arguments, 'id' and title, the following arguments are defined: function -- The name of the python function. This can be a an ordinary Python function, or a bou...
def manage_addExternalMethod(self, id, title, module, function): """ Add an external method to an 'ObjectManager'. In addition to the standard object-creation arguments, 'id' and title, the following arguments are defined: function -- The name of the python function. This can be a an ordinary Python function, or a bo...
3,260
def manage_addExternalMethod(self, id, title, module, function): """ Add an external method to an ObjectManager. In addition to the standard object-creation arguments, 'id' and title, the following arguments are defined: function -- The name of the python function. This can be a an ordinary Python function, or a bou...
def manage_addExternalMethod(self, id, title, module, function): """ Add an external method to an ObjectManager. In addition to the standard object-creation arguments, 'id' and title, the following arguments are defined: function -- The name of the python function. This can be a an ordinary Python function, or a bou...
3,261
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,262
def __call__(self, *args, **kw):
def __call__(self, *args, **kw):
3,263
def testEmptyLists(self): self.assertEqual(len(mass_weightedIntersection([])), 0) self.assertEqual(len(mass_weightedUnion([])), 0)
def testEmptyLists(self): self.assertEqual(len(mass_weightedIntersection([])), 0) self.assertEqual(len(mass_weightedUnion([])), 0)
3,264
def tabs_path_info(self, script, path): url=script out=[] while path[:1]=='/': path=path[1:] while path[-1:]=='/': path=path[:-1] while script[:1]=='/': script=script[1:] while script[-1:]=='/': script=script[:-1] path=split(path,'/')[:-1] if script: path=[script]+path if not path: return '' script='' last=path[-1] del...
def tabs_path_info(self, script, path): url=script out=[] while path[:1]=='/': path=path[1:] while path[-1:]=='/': path=path[:-1] while script[:1]=='/': script=script[1:] while script[-1:]=='/': script=script[:-1] path=split(path,'/')[:-1] if script: path=[script]+path if not path: return '' script='' last=path[-1] del...
3,265
def _delOb(self, id): delattr(self, id) pc=self.aq_inner.aq_parent.aq_parent._zclass_propertysheets_class delattr(pc,id) pc.__propset_attrs__=tuple(map(lambda o: o[0], self._objects)) rclass(pc)
def _delOb(self, id): delattr(self, id) pc=self.aq_inner.aq_parent.aq_parent._zclass_propertysheets_class delattr(pc,id) pc.__propset_attrs__=tuple(map(lambda o: o['id'], self._objects)) rclass(pc)
3,266
def __getstate__(self): raise SystemError, ( """This object was originally created by a product that is no longer installed. It cannot be updated. """)
def __getstate__(self): raise SystemError, ( """This object was originally created by a product that is no longer installed. It cannot be updated. """)
3,267
def manage_addFolder(self,id,title='',createPublic=0,createUserF=0, REQUEST=None): """Add a new Folder object with id *id*. If the 'createPublic' and 'createUserF' parameters are set to any true value, an 'index_html' and a 'UserFolder' objects are created respectively in the new folder. """ i=self.folderClass()() i.i...
def manage_addFolder(self,id,title='',createPublic=0,createUserF=0, REQUEST=None): """Add a new Folder object with id *id*. If the 'createPublic' and 'createUserF' parameters are set to any true value, an 'index_html' and a 'UserFolder' objects are created respectively in the new folder. """ i=self.folderClass()() i.i...
3,268
def HTML4(self): """Return the object in the format used in the HTML4.0 specification, one of the standard forms in ISO8601. See http://www.w3.org/TR/NOTE-datetime
def HTML4(self): """Return the object in the format used in the HTML4.0 specification, one of the standard forms in ISO8601. See http://www.w3.org/TR/NOTE-datetime
3,269
def convert_unicode(self,v): return field2utext.convert_unicode(v).split('\n')
def convert_unicode(self,v): return field2utext.convert_unicode(v).split('\n')
3,270
def _canCopy(self, op=0): return 0
def _canCopy(self, op=0): return 0
3,271
def initializeProduct(productp, name, home, app): # Initialize a levered product products=app.Control_Panel.Products if hasattr(productp, '__import_error__'): ie=productp.__import_error__ else: ie=None try: fver=strip(open(home+'/version.txt').read()) except: fver='' old=None try: if ihasattr(products,name): old=get...
def initializeProduct(productp, name, home, app): # Initialize a levered product products=app.Control_Panel.Products if hasattr(productp, 'import_error_'): ie=productp.import_error_ else: ie=None try: fver=strip(open(home+'/version.txt').read()) except: fver='' old=None try: if ihasattr(products,name): old=getattr(p...
3,272
def initializeProduct(productp, name, home, app): # Initialize a levered product products=app.Control_Panel.Products if hasattr(productp, '__import_error__'): ie=productp.__import_error__ else: ie=None try: fver=strip(open(home+'/version.txt').read()) except: fver='' old=None try: if ihasattr(products,name): old=get...
def initializeProduct(productp, name, home, app): # Initialize a levered product products=app.Control_Panel.Products if hasattr(productp, '__import_error__'): ie=productp.__import_error__ else: ie=None try: fver=strip(open(home+'/version.txt').read()) except: fver='' old=None try: if ihasattr(products,name): old=get...
3,273
def SearchableText(self): "The full text of the Help Topic, for indexing purposes" text="%s %s" % (self.title, self.doc) for api in self.apis: text="%s %s %s" % (text, api.SearchableText()) return text
def SearchableText(self): "The full text of the Help Topic, for indexing purposes" text="%s %s" % (self.title, self.doc) for api in self.apis: text="%s %s" % (text, api.SearchableText()) return text
3,274
def zpublisher_exception_hook(published, REQUEST, t, v, traceback): try: if isinstance(t, StringType): if t.lower() in ('unauthorized', 'redirect'): raise else: if t is SystemExit: raise if issubclass(t, ConflictError): # First, we need to close the current connection. We'll # do this by releasing the hold on it. There...
def zpublisher_exception_hook(published, REQUEST, t, v, traceback): try: if isinstance(t, StringType): if t.lower() in ('unauthorized', 'redirect'): raise else: if t is SystemExit: raise if issubclass(t, ConflictError): # First, we need to close the current connection. We'll # do this by releasing the hold on it. There...
3,275
def manage_cache_age(self,value,REQUEST): "set cache age" try: v=self._p_jar.getVersion() except: # BoboPOS2: if self._p_jar.db is not Globals.Bobobase._jar.db: raise 'Version Error', ( '''You may not change the database cache age while working in a <em>version</em>''') self._cache_age=Globals.Bobobase._jar.cache.cache...
def manage_cache_age(self,value,REQUEST): "set cache age" try: v=self._p_jar.getVersion() except: # BoboPOS2: if self._p_jar.db is not Globals.Bobobase._jar.db: raise 'Version Error', ( '''You may not change the database cache age while working in a <em>version</em>''') self._cache_age=Globals.Bobobase._jar.cache.cache...
3,276
def cache_size(self): try: if self._p_jar.getVersion(): return self._vcache_size except: pass
defcache_size(self):try:ifself._p_jar.getVersion():returnself._vcache_sizeexcept:pass
3,277
def manage_cache_size(self,value,REQUEST): "set cache size" try: v=self._p_jar.getVersion() except: # BoboPOS2: if self._p_jar.db is not Globals.Bobobase._jar.db: raise 'Version Error', ( '''You may not change the database cache size while working in a <em>version</em>''') self._cache_size=Globals.Bobobase._jar.cache.c...
def manage_cache_size(self,value,REQUEST): "set cache size" try: v=self._p_jar.getVersion() except: # BoboPOS2: if self._p_jar.db is not Globals.Bobobase._jar.db: raise 'Version Error', ( '''You may not change the database cache size while working in a <em>version</em>''') self._cache_size=Globals.Bobobase._jar.cache.c...
3,278
def manage_full_sweep(self,value,REQUEST): "Perform a full sweep through the cache" try: db=self._p_jar.db() except: # BoboPOS2 Globals.Bobobase._jar.cache.full_sweep(value) else: db.cacheFullSweep(value)
def manage_full_sweep(self,value,REQUEST): "Perform a full sweep through the cache" try: db=self._p_jar.db() except: # BoboPOS2 Globals.Bobobase._jar.cache.full_sweep(value) else: db.cacheFullSweep(value)
3,279
def manage_minimize(self,value,REQUEST): "Perform a full sweep through the cache" try: db=self._p_jar.db() except: # BoboPOS2 Globals.Bobobase._jar.cache.minimize(value) else: db.cacheMinimize(value)
def manage_minimize(self,value,REQUEST): "Perform a full sweep through the cache" try: db=self._p_jar.db() except: # BoboPOS2 Globals.Bobobase._jar.cache.minimize(value) else: db.cacheMinimize(value)
3,280
def getLexicon(self): """Get the lexicon for this index """ if hasattr(aq_base(self), 'lexicon'): # Fix up old ZCTextIndexes by removing direct lexicon ref # and changing it to an ID lexicon = getattr(aq_parent(aq_inner(self)), self.lexicon.getId()) self.lexicon_id = lexicon.getId() del self.lexicon
def getLexicon(self): """Get the lexicon for this index """ if hasattr(aq_base(self), 'lexicon'): # Fix up old ZCTextIndexes by removing direct lexicon ref # and changing it to an ID lexicon = getattr(aq_parent(aq_inner(self)), self.lexicon.getId()) self.lexicon_id = lexicon.getId() del self.lexicon
3,281
def __init__(self,file,brains=NoBrains, parent=None, zbrains=None):
def __init__(self,file,brains=NoBrains, parent=None, zbrains=None):
3,282
for _def in defs: _def=strip(_def) if not _def: raise ValueError, ('Empty column definition for %s' % names[i]) if defre.match(_def) < 0: raise ValueError, ( 'Invalid column definition for, %s, for %s' % _def, names[i]) type=lower(defre.group(2)) width=defre.group(1) if width: width=atoi(width) else: width=8
for _def in defs: _def=strip(_def) if not _def: raise ValueError, ('Empty column definition for %s' % names[i]) if defre.match(_def) < 0: raise ValueError, ( 'Invalid column definition for, %s, for %s' % _def, names[i]) type=lower(defre.group(2)) width=defre.group(1) if width: width=atoi(width) else: width=8
3,283
for _def in defs: _def=strip(_def) if not _def: raise ValueError, ('Empty column definition for %s' % names[i]) if defre.match(_def) < 0: raise ValueError, ( 'Invalid column definition for, %s, for %s' % _def, names[i]) type=lower(defre.group(2)) width=defre.group(1) if width: width=atoi(width) else: width=8
for _def in defs: _def=strip(_def) if not _def: raise ValueError, ('Empty column definition for %s' % names[i]) if defre.match(_def) < 0: raise ValueError, ( 'Invalid column definition for, %s, for %s' % _def, names[i]) type=lower(defre.group(2)) width=defre.group(1) if width: width=atoi(width) else: width=8
3,284
def test_ftp_factory(self): factory = self.load_factory("""\ <ftp-server> address 84 </ftp-server> """) self.assert_(isinstance(factory, ZServer.datatypes.FTPServerFactory)) self.assertEqual(factory.host, '') self.assertEqual(factory.port, 84) self.check_prepare(factory) factory.create().close()
def test_ftp_factory(self): factory = self.load_factory("""\ <ftp-server> address 84 </ftp-server> """) self.assert_(isinstance(factory, ZServer.datatypes.FTPServerFactory)) self.assertEqual(factory.host, DEFAULT_HOSTNAME) self.assertEqual(factory.port, 84) self.check_prepare(factory) factory.create().close()
3,285
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...
3,286
def custom_default_report(id, result, action=''): columns=result._searchable_result_columns() heading=('<tr>\n%s</tr>' % string.joinfields( map(lambda c: '\t<th>%s</th>\n' % nicify(c['name']), columns), '' ) ) row=('<tr>\n%s</tr>' % string.joinfields( map(lambda c: '\t\t<td><!--#var %s%s--></td>\n' % (urllib.quote(c['n...
def custom_default_report(id, result, action=''): columns=result._searchable_result_columns() __traceback_info__=columns heading=('<tr>\n%s</tr>' % string.joinfields( map(lambda c: '\t<th>%s</th>\n' % nicify(c['name']), columns), '' ) ) row=('<tr>\n%s</tr>' % string.joinfields( map(lambda c: '\t\t<td><!--#var %s%s--></...
3,287
def manage_advanced(self, key, max_rows, max_cache, cache_time,
def manage_advanced(self, key, max_rows, max_cache, cache_time,
3,288
def addColumn(self, name, default_value=None): """ adds a row to the meta data schema """ schema = self.schema names = list(self.names)
def addColumn(self, name, default_value=None): """ adds a row to the meta data schema """ schema = self.schema names = list(self.names)
3,289
def uncatalogObject(self, uid): """
def uncatalogObject(self, uid): """
3,290
def sort_sequence(self, sequence):
def sort_sequence(self, sequence):
3,291
def manage_getPermissionMapping(self): """Return the permission mapping for the object
def manage_getPermissionMapping(self): """Return the permission mapping for the object
3,292
def _apply_index(self, request, cid=''): """Apply the index to query parameters given in the argument, request
def _apply_index(self, request, cid=''): """Apply the index to query parameters given in the argument, request
3,293
def manage_addVersion(self, id, title, REQUEST=None): """ """ self=self.this() self._setObject(id, Version(id,title,REQUEST)) if REQUEST is not None: REQUEST['RESPONSE'].redirect(self.absolute_url()+'/manage_main')
def manage_addVersion(self, id, title, REQUEST=None): """ """ self=self.this() self._setObject(id, Version(id,title,REQUEST)) if REQUEST is not None: REQUEST['RESPONSE'].redirect(self.absolute_url()+'/manage_main')
3,294
def manage_addVersion(self, id, title, REQUEST=None): """ """ self=self.this() self._setObject(id, Version(id,title,REQUEST)) if REQUEST is not None: REQUEST['RESPONSE'].redirect(self.absolute_url()+'/manage_main')
def manage_addVersion(self, id, title, REQUEST=None): """ """ self=self.this() self._setObject(id, Version(id,title,REQUEST)) if REQUEST is not None: REQUEST['RESPONSE'].redirect(self.absolute_url()+'/manage_main')
3,295
def __init__(self, id, title, REQUEST): self.id=id self.title=title
def __init__(self, id, title, REQUEST): self.id=id self.title=title
3,296
def discard(self, REQUEST=None): 'Discard changes made during the version' try: db=self._p_jar.db() except: # BoboPOS 2 Globals.VersionBase[self.cookie].abort() else: # ZODB 3 db.abortVersion(self.cookie)
def discard(self, remark='', REQUEST=None): 'Discard changes made during the version' try: db=self._p_jar.db() except: # BoboPOS 2 Globals.VersionBase[self.cookie].abort() else: # ZODB 3 db.abortVersion(self.cookie)
3,297
def undoable_transactions(self, AUTHENTICATION_PATH=None, first_transaction=None, last_transaction=None, PrincipiaUndoBatchSize=None):
def undoable_transactions(self, AUTHENTICATION_PATH=None, first_transaction=None, last_transaction=None, PrincipiaUndoBatchSize=None):
3,298
def validate(self, accessed, container, name, value, *args): if aq_base(accessed) is aq_base(container): raise Unauthorized, name return 0
def validate(self, accessed, container, name, value, *args): if aq_base(accessed) is aq_base(container): raise Unauthorized, name return 0
3,299