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, f return globals()['upload_'+ext](object, f) if verbose: print 'upload_file', f, ext call(object.manage_addFile, id=name, file=open(f))
|
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, f return globals()['upload_'+ext](object, f) if verbose: print 'upload_file', f, ext call(object.manage_addFile, id=name, file=open(f,'rb'))
| 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=name, title=title, file=body) # Now add META and other tags as property if head: object=object.__class__(object.url+'/'+name, username=object.username, password=object.password) call(object.manage_addProperty, id="loadsite-head", type="text", value=head)
|
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=name, title=title, file=body) # Now add META and other tags as property if head: object=object.__class__(object.url+'/'+name, username=object.username, password=object.password) call(object.manage_addProperty, id="loadsite-head", type="text", value=head)
| 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=name, title=title, file=body) # Now add META and other tags as property if head: object=object.__class__(object.url+'/'+name, username=object.username, password=object.password) call(object.manage_addProperty, id="loadsite-head", type="text", value=head)
|
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=name, title=title, file=body) # Now add META and other tags as property if head: object=object.__class__(object.url+'/'+name, username=object.username, password=object.password) call(object.manage_addProperty, id="loadsite-head", type="text", value=head)
| 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, 'unauthorized access to slice member' return v
|
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, 'unauthorized access to slice member' return v
| 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=getattr(products, name) if (ihasattr(old,'version') and old.version==fver and hasattr(old, '__import_error__') and old.__import_error__==ie): return except: pass try: f=CompressedInputFile(open(home+'/product.dat'),name+' shshsh') meta=cPickle.Unpickler(f).load() product=Globals.Bobobase._jar.import_file(f) product._objects=meta['_objects'] except: f=fver and (" (%s)" % fver) product=Product(name, 'Installed product %s%s' % (name,f)) if old is not None: products._delObject(name) products._setObject(name, product) product.__of__(products)._postCopy(products) product.manage_options=OFS.Folder.Folder.manage_options product.icon='p_/InstalledProduct_icon' product.version=fver product._distribution=None product.manage_distribution=None product.thisIsAnInstalledProduct=1 if ie: product.import_error_=ie product.title='Broken product %s' % name product.icon='p_/BrokenProduct_icon' product.manage_options=( {'label':'Traceback', 'action':'manage_traceback'}, ) if os.path.exists(os.path.join(home, 'README.txt')): product.manage_options=product.manage_options+( {'label':'README', 'action':'manage_readme'}, )
|
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(products, name) if (ihasattr(old,'version') and old.version==fver and hasattr(old, '__import_error__') and old.__import_error__==ie): return except: pass try: f=CompressedInputFile(open(home+'/product.dat'),name+' shshsh') meta=cPickle.Unpickler(f).load() product=Globals.Bobobase._jar.import_file(f) product._objects=meta['_objects'] except: f=fver and (" (%s)" % fver) product=Product(name, 'Installed product %s%s' % (name,f)) if old is not None: products._delObject(name) products._setObject(name, product) product.__of__(products)._postCopy(products) product.manage_options=Folder.manage_options product.icon='p_/InstalledProduct_icon' product.version=fver product._distribution=None product.manage_distribution=None product.thisIsAnInstalledProduct=1 if ie: product.import_error_=ie product.title='Broken product %s' % name product.icon='p_/BrokenProduct_icon' product.manage_options=( {'label':'Traceback', 'action':'manage_traceback'}, ) if os.path.exists(os.path.join(home, 'README.txt')): product.manage_options=product.manage_options+( {'label':'README', 'action':'manage_readme'}, )
| 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 find things in its dir try: module=imp.load_module(name, file, pathname, desc) except: (tb_t, tb_v, tb_tb) = sys.exc_info()
|
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 find things in its dir try: module=imp.load_module(name, file, pathname, desc) except: (tb_t, tb_v, tb_tb) = sys.exc_info()
| 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>', '', '', ', ' else: tr, _tr, td, _td, delim = '<tr>', '</tr>', '<td>', '</td>', '' if no_table: tr='<p>', '</p>' else: tr, _tr = '<tr>', '</tr>' row=('%s\n%s\t%s' % (tr,string.joinfields( map(lambda c, td=td, _td=_td: '\t%s<!--#var %s%s-->%s\n' % (td,urllib.quote(c['name']), c['type']!='s' and ' null=""' or '',_td), columns), delim), _tr)) return custom_default_report_src( id=id,heading=heading,row=row,action=action,no_table=no_table)
|
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, td, _td, delim = '<p>', '</p>', '', '', ', ' else: tr, _tr, td, _td, delim = '<tr>', '</tr>', '<td>', '</td>', '' if no_table: tr='<p>', '</p>' else: tr, _tr = '<tr>', '</tr>' row=('%s\n%s\t%s' % (tr,string.joinfields( map(lambda c, td=td, _td=_td: '\t%s<!--#var %s%s-->%s\n' % (td,urllib.quote(c['name']), c['type']!='s' and ' null=""' or '',_td), columns), delim), _tr)) return custom_default_report_src( id=id,heading=heading,row=row,action=action,no_table=no_table)
| 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>', '', '', ', ' else: tr, _tr, td, _td, delim = '<tr>', '</tr>', '<td>', '</td>', '' if no_table: tr='<p>', '</p>' else: tr, _tr = '<tr>', '</tr>' row=('%s\n%s\t%s' % (tr,string.joinfields( map(lambda c, td=td, _td=_td: '\t%s<!--#var %s%s-->%s\n' % (td,urllib.quote(c['name']), c['type']!='s' and ' null=""' or '',_td), columns), delim), _tr)) return custom_default_report_src( id=id,heading=heading,row=row,action=action,no_table=no_table)
|
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>', '', '', ', ' else: tr, _tr, td, _td, delim = '<tr>', '</tr>', '<td>', '</td>', '' if no_table: tr='<p>', '</p>' else: tr, _tr = '<tr>', '</tr>' row=('%s\n%s\t%s' % (tr,string.joinfields( map(lambda c, td=td, _td=_td: '\t%s<!--#var %s%s-->%s\n' % (td,urllib.quote(c['name']), c['type']!='s' and ' null=""' or '',_td), columns), delim), _tr)) return custom_default_report_src( id=id,heading=heading,row=row,action=action,no_table=no_table)
| 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("asc") elif l == 3: pass else: raise SyntaxError, "sort option must contains no more than 2 fields" f_name = f[1] # predefined function? if f_name == "cmp": func = cmp # builtin elif f_name == "nocase": func = nocase elif f_name in ("locale", "strcoll"): func = strcoll elif f_name in ("locale_nocase", "strcoll_nocase"): func = strcoll_nocase else: # no - look it up in the namespace func = _.getitem(f_name, 0) sort_order = f[2].lower() if sort_order == "asc": multiplier = +1 elif sort_order == "desc": multiplier = -1 else: raise SyntaxError, "sort oder must be either ASC or DESC" sf_list.append((f[0], func, multiplier)) return sf_list
|
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("asc") elif l == 3: pass else: raise SyntaxError, "sort option must contains no more than 2 fields" f_name = f[1] # predefined function? if f_name == "cmp": func = cmp # builtin elif f_name == "nocase": func = nocase elif f_name in ("locale", "strcoll"): func = strcoll elif f_name in ("locale_nocase", "strcoll_nocase"): func = strcoll_nocase else: # no - look it up in the namespace func = _.getitem(f_name, 0) sort_order = f[2].lower() if sort_order == "asc": multiplier = +1 elif sort_order == "desc": multiplier = -1 else: raise SyntaxError, "sort direction must be either ASC or DESC" sf_list.append((f[0], func, multiplier)) return sf_list
| 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 retained as blank strings. The default false value indicates that blank values are to be ignored and treated as if they were not included. strict_parsing: flag indicating what to do with parsing errors. If false (the default), errors are silently ignored. If true, errors raise a ValueError exception. Returns a list, as God intended. """ name_value_pairs = string.splitfields(qs, '&') r=[] for name_value in name_value_pairs: nv = string.splitfields(name_value, '=') if len(nv) != 2: if strict_parsing: raise ValueError, "bad query field: %s" % `name_value` continue name = urllib.unquote(string.replace(nv[0], '+', ' ')) value = urllib.unquote(string.replace(nv[1], '+', ' ')) r.append(name, value) return r
|
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 retained as blank strings. The default false value indicates that blank values are to be ignored and treated as if they were not included. strict_parsing: flag indicating what to do with parsing errors. If false (the default), errors are silently ignored. If true, errors raise a ValueError exception. Returns a list, as God intended. """ name_value_pairs = string.splitfields(qs, '&') r=[] for name_value in name_value_pairs: nv = string.splitfields(name_value, '=') if len(nv) != 2: if strict_parsing: raise ValueError, "bad query field: %s" % `name_value` continue name = urllib.unquote(string.replace(nv[0], '+', ' ')) value = urllib.unquote(string.replace(nv[1], '+', ' ')) r.append((name, value)) return r
| 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(offset) if majorOffset != 0 : minorOffset=abs(int((offset % majorOffset) * 60.0)) else: minorOffset = 0 m=majorOffset >= 0 and '+' or '' lz='%s%0.02d%0.02d' % (m, majorOffset, minorOffset) _localzone = _cache._zmap[lower('GMT%s' % lz)] except: _localzone = '' return _localzone def _calcSD(t): dd = t + EPOCH - 86400.0 d = dd / 86400.0 s = d - math.floor(d) return s, d def _calcDependentSecond(tz, t): fset = _tzoffset(tz, t) return fset + long(math.floor(t)) + long(EPOCH) - 86400L def _calcDependentSecond2(yr,mo,dy,hr,mn,sc): ss = int(hr) * 3600 + int(mn) * 60 + int(sc) x = long(_julianday(yr,mo,dy)-jd1901) * 86400 + ss return x def _calcIndependentSecondEtc(tz, x, ms): fsetAtEpoch = _tzoffset(tz, 0.0) nearTime = x - fsetAtEpoch - long(EPOCH) + 86400L + ms fset = long(_tzoffset(tz, nearTime)) x_adjusted = x - fset + ms d = x_adjusted / 86400.0 t = x_adjusted - long(EPOCH) + 86400L millis = (x + 86400 - fset) * 1000 + \ long(ms * 1000.0) - long(EPOCH * 1000.0) s = d - math.floor(d) return s,d,t,millis def _calcHMS(x, ms): hr = x / 3600 x = x - hr * 3600 mn = x / 60 sc = x - mn * 60 + ms return hr,mn,sc def _calcYMDHMS(x, ms): yr,mo,dy=_calendarday(x / 86400 + jd1901) x = int(x - (x / 86400) * 86400) hr = x / 3600 x = x - hr * 3600 mn = x / 60 sc = x - mn * 60 + ms return yr,mo,dy,hr,mn,sc def _julianday(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+1L)/10000L+d+1720994L+b def _calendarday(j): j=long(j) if(j < 2299160L): b=j+1525L else: a=(4L*j-7468861L)/146097L b=j+1526L+a-a/4L c=(20L*b-2442L)/7305L d=1461L*c/4L e=10000L*(b-d)/306001L dy=int(b-d-306001L*e/10000L) mo=(e < 14L) and int(e-1L) or int(e-13L) yr=(mo > 2) and (c-4716L) or (c-4715L) return int(yr),int(mo),int(dy) def _tzoffset(tz, t): try: return DateTime._tzinfo[tz].info(t)[0] except: if numericTimeZoneMatch(tz) > 0: return atoi(tz[1:3])*3600+atoi(tz[3:5])*60 else: return 0 def safegmtime(t): '''gmtime with a safety zone.''' try: t_int = int(t) except OverflowError: raise 'TimeError', 'The time %f is beyond the range ' \ 'of this Python implementation.' % float(t) rval = gmtime(t_int) return rval def safelocaltime(t): '''localtime with a safety zone.''' try: t_int = int(t) except OverflowError: raise 'TimeError', 'The time %f is beyond the range ' \ 'of this Python implementation.' % float(t) rval = localtime(t_int) return rval 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
| 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 None: millisecs = long(math.floor(t * 1000.0)) self._millis = millisecs newif millisecs is None: millisecs = long(math.floor(t * 1000.0)) self._millis = millisecs date-timeif millisecs is None: millisecs = long(math.floor(t * 1000.0)) self._millis = millisecs object
| 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 =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,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 =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,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 =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,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 =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,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 =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,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+1L)/10000L+d+1720994L+b
|
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+1L)/10000L+d+1720994L+b
| 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._second return self.__class__(yr,mo,dy,hr,mn,sc,tz,t,self._d,self.time) d=self._d+(self._tzinfo[tz].info(t)[0]/86400.0) yr,mo,dy=self._calendarday((d+jd1901)) s=(d-int(d))*86400.0 hr=int(s/3600) s=s-(hr*3600) mn=int(s/60) sc=s-(mn*60) if(hr==23 and mn==59 and sc>59.999): # Fix formatting for positives hr,mn,sc=0,0,0.0 else: # Fix formatting for negatives if hr<0: hr=23+hr if mn<0: mn=59+mn if sc<0: if (sc-int(sc)>=0.999): sc=round(sc) sc=59+sc return self.__class__(yr,mo,dy,hr,mn,sc,tz,t,self._d,self.time)
|
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._second return self.__class__(yr,mo,dy,hr,mn,sc,tz,t,self._d,self.time) d=self._d+(self._tzinfo[tz].info(t)[0]/86400.0) yr,mo,dy=self._calendarday((d+jd1901)) s=(d-int(d))*86400.0 hr=int(s/3600) s=s-(hr*3600) mn=int(s/60) sc=s-(mn*60) if(hr==23 and mn==59 and sc>59.999): # Fix formatting for positives hr,mn,sc=0,0,0.0 else: # Fix formatting for negatives if hr<0: hr=23+hr if mn<0: mn=59+mn if sc<0: if (sc-int(sc)>=0.999): sc=round(sc) sc=59+sc return self.__class__(yr,mo,dy,hr,mn,sc,tz,t,self._d,self.time)
| 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._second return self.__class__(yr,mo,dy,hr,mn,sc,tz,t,self._d,self.time) d=self._d+(self._tzinfo[tz].info(t)[0]/86400.0) yr,mo,dy=self._calendarday((d+jd1901)) s=(d-int(d))*86400.0 hr=int(s/3600) s=s-(hr*3600) mn=int(s/60) sc=s-(mn*60) if(hr==23 and mn==59 and sc>59.999): # Fix formatting for positives hr,mn,sc=0,0,0.0 else: # Fix formatting for negatives if hr<0: hr=23+hr if mn<0: mn=59+mn if sc<0: if (sc-int(sc)>=0.999): sc=round(sc) sc=59+sc return self.__class__(yr,mo,dy,hr,mn,sc,tz,t,self._d,self.time)
|
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._second return self.__class__(yr,mo,dy,hr,mn,sc,tz,t,self._d,self.time) d=self._d+(self._tzinfo[tz].info(t)[0]/86400.0) yr,mo,dy=self._calendarday((d+jd1901)) s=(d-int(d))*86400.0 hr=int(s/3600) s=s-(hr*3600) mn=int(s/60) sc=s-(mn*60) if(hr==23 and mn==59 and sc>59.999): # Fix formatting for positives hr,mn,sc=0,0,0.0 else: # Fix formatting for negatives if hr<0: hr=23+hr if mn<0: mn=59+mn if sc<0: if (sc-int(sc)>=0.999): sc=round(sc) sc=59+sc return self.__class__(yr,mo,dy,hr,mn,sc,tz,t,self._d,self.time)
| 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) except: return (self._t > t)
|
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 through comparison of long integer milliseconds. """ try: return (self.millis() > t.millis()) except: return (self._t > 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 (self._d >= t._d) except: return (self._t >= t)
|
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 more correct results through comparison of long integer milliseconds. """ try: return (self.millis() >= t.millis()) except: return (self._t >= t)
| 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: return (self._t == t)
|
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 comparison of long integer milliseconds. """ try: return (self.millis() == t.millis()) except: return (self._t == t)
| 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) except: return (self._t != t)
|
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 through comparison of long integer milliseconds. """ try: return (self.millis() != t.millis()) except: return (self._t != t)
| 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: return (self._t < t)
|
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 comparison of long integer milliseconds. """ try: return (self.millis() < t.millis()) except: return (self._t < t)
| 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._d <= t._d) except: return (self._t <= t)
|
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 correct results through comparison of long integer milliseconds. """ try: return (self.millis() <= t.millis()) except: return (self._t <= t)
| 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.0) yr,mo,dy=self._calendarday((x+jd1901)) s=(x-int(x))*86400.0 hr=int(s/3600) s=s-(hr*3600) mn=int(s/60) s=s-(mn*60) return self.__class__(yr,mo,dy,hr,mn,s,self._tz,t,d,(d-int(d)))
|
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.0) yr,mo,dy=self._calendarday((x+jd1901)) s=(x-int(x))*86400.0 hr=int(s/3600) s=s-(hr*3600) mn=int(s/60) s=s-(mn*60) return self.__class__(yr,mo,dy,hr,mn,s,self._tz,t,d,(d-int(d)))
| 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,mn,s,t) else: return '%4.4d/%2.2d/%2.2d' % (y,m,d)
|
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: pass return '%4.4d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d %s' % ( y,m,d,h,mn,s,t) return '%4.4d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d %s' % ( y,m,d,h,mn,s,t) else: return '%4.4d/%2.2d/%2.2d' % (y,m,d)
| 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 bound method. module -- The name of the file containing the function definition. The module normally resides in the 'Extensions' directory, however, the file name may have a prefix of 'product.', indicating that it should be found in a product directory. For example, if the module is: 'ACMEWidgets.foo', then an attempt will first be made to use the file 'lib/python/Products/ACMEWidgets/Extensions/foo.py'. If this failes, then the file 'Extensions/ACMEWidgets.foo.py' will be used. """
|
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 bound method. module -- The name of the file containing the function definition. The module normally resides in the 'Extensions' directory, however, the file name may have a prefix of 'product.', indicating that it should be found in a product directory. For example, if the module is: 'ACMEWidgets.foo', then an attempt will first be made to use the file 'lib/python/Products/ACMEWidgets/Extensions/foo.py'. If this failes, then the file 'Extensions/ACMEWidgets.foo.py' will be used. """
| 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 bound method. module -- The name of the file containing the function definition. The module normally resides in the 'Extensions' directory, however, the file name may have a prefix of 'product.', indicating that it should be found in a product directory. For example, if the module is: 'ACMEWidgets.foo', then an attempt will first be made to use the file 'lib/python/Products/ACMEWidgets/Extensions/foo.py'. If this failes, then the file 'Extensions/ACMEWidgets.foo.py' will be used. """
|
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 bound method. module -- The name of the file containing the function definition. The module normally resides in the 'Extensions' directory, however, the file name may have a prefix of 'product.', indicating that it should be found in a product directory. For example, if the module is: 'ACMEWidgets.foo', then an attempt will first be made to use the file 'lib/python/Products/ACMEWidgets/Extensions/foo.py'. If this failes, then the file 'Extensions/ACMEWidgets.foo.py' will be used. """
| 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 path[-1] for p in path: script="%s/%s" % (script, p) out.append('<a href="%s/manage_workspace">%s</a>' % (script, p)) out.append(last) return join(out,' / ')
|
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 path[-1] for p in path: script="%s/%s" % (script, p) out.append('<a href="%s/manage_workspace">%s</a>' % (script, p)) out.append(last) return join(out,' / ')
| 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.id=id i.title=title self._setObject(id,i) if createUserF: i.manage_addUserFolder() if createPublic: i.manage_addDocument(id='index_html',title='') if REQUEST: return self.manage_main(self,REQUEST,update_menu=1)
|
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.id=id i.title=title self._setObject(id,i) if createUserF: i.manage_addUserFolder() if createPublic: i.manage_addDocument(id='index_html',title='') if REQUEST: return self.manage_main(self,REQUEST,update_menu=1)
| 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=getattr(products, name) if (ihasattr(old,'version') and old.version==fver and hasattr(old, '__import_error__') and old.__import_error__==ie): return except: pass try: f=CompressedInputFile(open(home+'/product.dat'),name+' shshsh') meta=cPickle.Unpickler(f).load() product=Globals.Bobobase._jar.import_file(f) product._objects=meta['_objects'] except: f=fver and (" (%s)" % fver) product=Product(name, 'Installed product %s%s' % (name,f)) if old is not None: products._delObject(name) products._setObject(name, product) product.__of__(products)._postCopy(products) product.manage_options=Folder.manage_options product.icon='p_/InstalledProduct_icon' product.version=fver product._distribution=None product.manage_distribution=None product.thisIsAnInstalledProduct=1 if ie: product.import_error_=ie product.title='Broken product %s' % name product.icon='p_/BrokenProduct_icon' product.manage_options=( {'label':'Traceback', 'action':'manage_traceback'}, ) if os.path.exists(os.path.join(home, 'README.txt')): product.manage_options=product.manage_options+( {'label':'README', 'action':'manage_readme'}, )
|
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(products, name) if (ihasattr(old,'version') and old.version==fver and hasattr(old, '__import_error__') and old.__import_error__==ie): return except: pass try: f=CompressedInputFile(open(home+'/product.dat'),name+' shshsh') meta=cPickle.Unpickler(f).load() product=Globals.Bobobase._jar.import_file(f) product._objects=meta['_objects'] except: f=fver and (" (%s)" % fver) product=Product(name, 'Installed product %s%s' % (name,f)) if old is not None: products._delObject(name) products._setObject(name, product) product.__of__(products)._postCopy(products) product.manage_options=Folder.manage_options product.icon='p_/InstalledProduct_icon' product.version=fver product._distribution=None product.manage_distribution=None product.thisIsAnInstalledProduct=1 if ie: product.import_error_=ie product.title='Broken product %s' % name product.icon='p_/BrokenProduct_icon' product.manage_options=( {'label':'Traceback', 'action':'manage_traceback'}, ) if os.path.exists(os.path.join(home, 'README.txt')): product.manage_options=product.manage_options+( {'label':'README', 'action':'manage_readme'}, )
| 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=getattr(products, name) if (ihasattr(old,'version') and old.version==fver and hasattr(old, '__import_error__') and old.__import_error__==ie): return except: pass try: f=CompressedInputFile(open(home+'/product.dat'),name+' shshsh') meta=cPickle.Unpickler(f).load() product=Globals.Bobobase._jar.import_file(f) product._objects=meta['_objects'] except: f=fver and (" (%s)" % fver) product=Product(name, 'Installed product %s%s' % (name,f)) if old is not None: products._delObject(name) products._setObject(name, product) product.__of__(products)._postCopy(products) product.manage_options=Folder.manage_options product.icon='p_/InstalledProduct_icon' product.version=fver product._distribution=None product.manage_distribution=None product.thisIsAnInstalledProduct=1 if ie: product.import_error_=ie product.title='Broken product %s' % name product.icon='p_/BrokenProduct_icon' product.manage_options=( {'label':'Traceback', 'action':'manage_traceback'}, ) if os.path.exists(os.path.join(home, 'README.txt')): product.manage_options=product.manage_options+( {'label':'README', 'action':'manage_readme'}, )
|
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(products, name) if (ihasattr(old,'version') and old.version==fver and hasattr(old, 'import_error_') and old.import_error_==ie): return except: pass try: f=CompressedInputFile(open(home+'/product.dat'),name+' shshsh') meta=cPickle.Unpickler(f).load() product=Globals.Bobobase._jar.import_file(f) product._objects=meta['_objects'] except: f=fver and (" (%s)" % fver) product=Product(name, 'Installed product %s%s' % (name,f)) if old is not None: products._delObject(name) products._setObject(name, product) product.__of__(products)._postCopy(products) product.manage_options=Folder.manage_options product.icon='p_/InstalledProduct_icon' product.version=fver product._distribution=None product.manage_distribution=None product.thisIsAnInstalledProduct=1 if ie: product.import_error_=ie product.title='Broken product %s' % name product.icon='p_/BrokenProduct_icon' product.manage_options=( {'label':'Traceback', 'action':'manage_traceback'}, ) if os.path.exists(os.path.join(home, 'README.txt')): product.manage_options=product.manage_options+( {'label':'README', 'action':'manage_readme'}, )
| 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 should be # some sane protocol for this, but for now we'll use # brute force: global conflict_errors conflict_errors = conflict_errors + 1 method_name = REQUEST.get('PATH_INFO', '') err = ('ZODB conflict error at %s ' '(%s conflicts since startup at %s)') LOG(err % (method_name, conflict_errors, startup_time), INFO, '') LOG('Conflict traceback', BLATHER, '', error=sys.exc_info()) raise ZPublisher.Retry(t, v, traceback) if t is ZPublisher.Retry: v.reraise() try: log = aq_acquire(published, '__error_log__', containment=1) except AttributeError: error_log_url = '' else: error_log_url = log.raising((t, v, traceback)) if (getattr(REQUEST.get('RESPONSE', None), '_error_format', '') !='text/html'): raise if (published is None or published is app or type(published) is ListType): # At least get the top-level object published=app.__bobo_traverse__(REQUEST).__of__( RequestContainer(REQUEST)) get_transaction().begin() # Just to be sure. published=getattr(published, 'im_self', published) while 1: f=getattr(published, 'raise_standardErrorMessage', None) if f is None: published=getattr(published, 'aq_parent', None) if published is None: raise t, v, traceback else: break client=published while 1: if getattr(client, 'standard_error_message', None) is not None: break client=getattr(client, 'aq_parent', None) if client is None: raise t, v, traceback if REQUEST.get('AUTHENTICATED_USER', None) is None: REQUEST['AUTHENTICATED_USER']=AccessControl.User.nobody try: f(client, REQUEST, t, v, traceback, error_log_url=error_log_url) except TypeError: # Pre 2.6 call signature f(client, REQUEST, t, v, traceback) finally: traceback=None
|
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 should be # some sane protocol for this, but for now we'll use # brute force: global conflict_errors conflict_errors = conflict_errors + 1 method_name = REQUEST.get('PATH_INFO', '') err = ('ZODB conflict error at %s ' '(%s conflicts since startup at %s)') LOG(err % (method_name, conflict_errors, startup_time), INFO, '') LOG('Conflict traceback', BLATHER, '', error=sys.exc_info()) raise ZPublisher.Retry(t, v, traceback) if t is ZPublisher.Retry: v.reraise() try: log = aq_acquire(published, '__error_log__', containment=1) except AttributeError: error_log_url = '' else: error_log_url = log.raising((t, v, traceback)) if (getattr(REQUEST.get('RESPONSE', None), '_error_format', '') !='text/html'): raise t, v, traceback if (published is None or published is app or type(published) is ListType): # At least get the top-level object published=app.__bobo_traverse__(REQUEST).__of__( RequestContainer(REQUEST)) get_transaction().begin() # Just to be sure. published=getattr(published, 'im_self', published) while 1: f=getattr(published, 'raise_standardErrorMessage', None) if f is None: published=getattr(published, 'aq_parent', None) if published is None: raise t, v, traceback else: break client=published while 1: if getattr(client, 'standard_error_message', None) is not None: break client=getattr(client, 'aq_parent', None) if client is None: raise t, v, traceback if REQUEST.get('AUTHENTICATED_USER', None) is None: REQUEST['AUTHENTICATED_USER']=AccessControl.User.nobody try: f(client, REQUEST, t, v, traceback, error_log_url=error_log_url) except TypeError: # Pre 2.6 call signature f(client, REQUEST, t, v, traceback) finally: traceback=None
| 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_age=value else: if v: self._vcache_age=value self._p_jar.db().setVersionCacheDeactivateAfter(value) else: self._cache_age=value self._p_jar.db().setCacheDeactivateAfter(value)
|
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_age=value else: if v: self._vcache_age=value self._p_jar.db().setVersionCacheDeactivateAfter(value) else: self._cache_age=value self._p_jar.db().setCacheDeactivateAfter(value)
| 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.cache_size=value else: if v: self._vcache_size=value self._p_jar.db().setVersionCacheSize(value) else: self._cache_size=value self._p_jar.db().setCacheSize(value)
|
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.cache_size=value else: if v: self._vcache_size=value self._p_jar.db().setVersionCacheSize(value) else: self._cache_size=value self._p_jar.db().setCacheSize(value)
| 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_name # Let the app specify a realm if hasattr(module,'__bobo_realm__'): realm=module.__bobo_realm__ elif os.environ.has_key('BOBO_REALM'): realm=request.environ['BOBO_REALM'] else: realm=module_name # Check for debug mode if hasattr(module,'__bobo_debug_mode__'): debug_mode=not not module.__bobo_debug_mode__ elif os.environ.has_key('BOBO_DEBUG_MODE'): debug_mode=lower(os.environ['BOBO_DEBUG_MODE']) if debug_mode=='y' or debug_mode=='yes': debug_mode=1 else: try: debug_mode=atoi(debug_mode) except: debug_mode=None else: debug_mode=None # Check whether tracebacks should be hidden: if hasattr(module,'__bobo_hide_tracebacks__'): hide_tracebacks=not not module.__bobo_hide_tracebacks__ elif os.environ.has_key('BOBO_HIDE_TRACEBACKS'): hide_tracebacks=lower(os.environ['BOBO_HIDE_TRACEBACKS']) if hide_tracebacks=='y' or hide_tracebacks=='yes': hide_tracebacks=1 else: try: hide_tracebacks=atoi(hide_tracebacks) except: hide_tracebacks=None else: hide_tracebacks=1 # Reset response handling of tracebacks, if necessary: if debug_mode or not hide_tracebacks: def hack_response(): import Response Response._tbopen = '<PRE>' Response._tbclose = '</PRE>' hack_response() if hasattr(module,'__bobo_before__'): bobo_before=module.__bobo_before__ else: bobo_before=None if hasattr(module,'__bobo_after__'): bobo_after=module.__bobo_after__ else: bobo_after=None # Get request data from outermost environment: if hasattr(module,'__request_data__'): request_params=module.__request_data__ else: request_params=None # Get initial group data: inherited_groups=[] if hasattr(module,'__allow_groups__'): groups=module.__allow_groups__ inherited_groups.append(groups) else: groups=None web_objects=None roles=UNSPECIFIED_ROLES if hasattr(module,'bobo_application'): object=module.bobo_application if hasattr(object,'__allow_groups__'): groups=object.__allow_groups__ inherited_groups.append(groups) else: groups=None if hasattr(object,'__roles__'): roles=object.__roles__ else: if hasattr(module,'web_objects'): web_objects=module.web_objects object=web_objects else: object=module published=web_objects try: doc=module.__doc__ except: if web_objects is not None: doc=' ' else: doc=None info= (bobo_before, bobo_after, request_params, inherited_groups, groups, roles, object, doc, published, realm, module_name, debug_mode) modules[module_name]=modules[module_name+'.cgi']=info return info except: if hasattr(sys, 'exc_info'): t,v,tb=sys.exc_info() else: t, v, tb = sys.exc_type, sys.exc_value, sys.exc_traceback v=str(v) raise ImportError, (t, v), tb finally: tb=None release()
|
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_name # Let the app specify a realm if hasattr(module,'__bobo_realm__'): realm=module.__bobo_realm__ elif os.environ.has_key('BOBO_REALM'): realm=os.environ['BOBO_REALM'] else: realm=module_name # Check for debug mode if hasattr(module,'__bobo_debug_mode__'): debug_mode=not not module.__bobo_debug_mode__ elif os.environ.has_key('BOBO_DEBUG_MODE'): debug_mode=lower(os.environ['BOBO_DEBUG_MODE']) if debug_mode=='y' or debug_mode=='yes': debug_mode=1 else: try: debug_mode=atoi(debug_mode) except: debug_mode=None else: debug_mode=None # Check whether tracebacks should be hidden: if hasattr(module,'__bobo_hide_tracebacks__'): hide_tracebacks=not not module.__bobo_hide_tracebacks__ elif os.environ.has_key('BOBO_HIDE_TRACEBACKS'): hide_tracebacks=lower(os.environ['BOBO_HIDE_TRACEBACKS']) if hide_tracebacks=='y' or hide_tracebacks=='yes': hide_tracebacks=1 else: try: hide_tracebacks=atoi(hide_tracebacks) except: hide_tracebacks=None else: hide_tracebacks=1 # Reset response handling of tracebacks, if necessary: if debug_mode or not hide_tracebacks: def hack_response(): import Response Response._tbopen = '<PRE>' Response._tbclose = '</PRE>' hack_response() if hasattr(module,'__bobo_before__'): bobo_before=module.__bobo_before__ else: bobo_before=None if hasattr(module,'__bobo_after__'): bobo_after=module.__bobo_after__ else: bobo_after=None # Get request data from outermost environment: if hasattr(module,'__request_data__'): request_params=module.__request_data__ else: request_params=None # Get initial group data: inherited_groups=[] if hasattr(module,'__allow_groups__'): groups=module.__allow_groups__ inherited_groups.append(groups) else: groups=None web_objects=None roles=UNSPECIFIED_ROLES if hasattr(module,'bobo_application'): object=module.bobo_application if hasattr(object,'__allow_groups__'): groups=object.__allow_groups__ inherited_groups.append(groups) else: groups=None if hasattr(object,'__roles__'): roles=object.__roles__ else: if hasattr(module,'web_objects'): web_objects=module.web_objects object=web_objects else: object=module published=web_objects try: doc=module.__doc__ except: if web_objects is not None: doc=' ' else: doc=None info= (bobo_before, bobo_after, request_params, inherited_groups, groups, roles, object, doc, published, realm, module_name, debug_mode) modules[module_name]=modules[module_name+'.cgi']=info return info except: if hasattr(sys, 'exc_info'): t,v,tb=sys.exc_info() else: t, v, tb = sys.exc_type, sys.exc_value, sys.exc_traceback v=str(v) raise ImportError, (t, v), tb finally: tb=None release()
| 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['name']), c['type']!='s' and ' null=""' or '', ), columns), '' ) ) return custom_default_report_src( id=id,heading=heading,row=row,action=action)
|
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--></td>\n' % (urllib.quote(c['name']), c['type']!='s' and ' null=""' or '', ), columns), '' ) ) return custom_default_report_src( id=id,heading=heading,row=row,action=action)
| 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
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.