rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
"""Return the object in ISO standard format | """ Return the object in ISO standard format | def ISO(): """Return the object in ISO standard format | b8c350cc5b36f5ce907db3ed0e2c54460ed7de1c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b8c350cc5b36f5ce907db3ed0e2c54460ed7de1c/DateTime.py |
"""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 | """ Return the object in the format used in the HTML4.0 specification, one of the standard forms in ISO8601. See "HTML 4.0 Specification":http://www.w3.org/TR/NOTE-datetime | def HTML4(): """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 | b8c350cc5b36f5ce907db3ed0e2c54460ed7de1c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b8c350cc5b36f5ce907db3ed0e2c54460ed7de1c/DateTime.py |
T, Z are literal characters. The time is in UTC. """ | T, Z are literal characters. The time is in UTC. Permission -- Always available """ | def HTML4(): """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 | b8c350cc5b36f5ce907db3ed0e2c54460ed7de1c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b8c350cc5b36f5ce907db3ed0e2c54460ed7de1c/DateTime.py |
n=lower(name) if n != name: aliases.append((n, SQLAlias(name))) n=upper(name) if n != name: aliases.append((n, SQLAlias(name))) | schema[lower(name)]=i schema(upper(name)]=i | def __init__(self,file,brains=NoBrains, parent=None, zbrains=None): | d9587ee84b12f1cdd7c93acf5416db6695c45d54 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/d9587ee84b12f1cdd7c93acf5416db6695c45d54/RDB.py |
d=r.__dict__ for k, v in aliases: if not hasattr(r,k): d[k]=v | 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 | d9587ee84b12f1cdd7c93acf5416db6695c45d54 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/d9587ee84b12f1cdd7c93acf5416db6695c45d54/RDB.py |
|
if REQUEST: return self.manage_main(self,REQUEST) | if REQUEST is not None: REQUEST['RESPONSE'].redirect(self.absolute_url()+'/manage_main') | def add(self, id, title='', smtp_host=None, smtp_port=25, REQUEST=None): ' add a MailHost into the system ' id=str(id) title=str(title) if smtp_host is not None: smtp_host=str(smtp_host) if type(smtp_port) is not type(1): smtp_port=string.atoi(smtp_port) i=MailHost() #create new mail host i.id=id #give it id i.title=title #title i._init(smtp_host=smtp_host, smtp_port=smtp_port) self._setObject(id,i) #register it if REQUEST: return self.manage_main(self,REQUEST) | 330c85b275043ab1490778c815b72a02e1126449 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/330c85b275043ab1490778c815b72a02e1126449/MailHost.py |
if file: | if file and (type(file) is type('') or hasattr(file, 'content-type')): | def manage_edit(self, meta_type='', icon='', file='', REQUEST=None): """Set basic item properties. """ if meta_type: self.setClassAttr('meta_type', meta_type) | 80e1b4f2e0678811c1574140a7711a12624922f0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/80e1b4f2e0678811c1574140a7711a12624922f0/Basic.py |
return "text/" + (html_re.search(s) >= 0 and 'html' or 'plain') | if (lower(strip(s)[:6]) == '<html>' or find(s, '</') > 0): return 'text/html' return 'text/plain' | def text_type(s): return "text/" + (html_re.search(s) >= 0 and 'html' or 'plain') | a4036ced64653b36f02a710f625fef6133c00d75 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/a4036ced64653b36f02a710f625fef6133c00d75/content_types.py |
ex=fn[(rfind(fn,'.')+1):] if self._extmap.has_key(ex): ct=self._extmap[ex] else: ct=self._extmap[''] | ex=lower(fn[(rfind(fn,'.')+1):]) if self._extmap.has_key(ex): ct=self._extmap[ex] else: ct=self._extmap[''] | def __init__(self,*args): c=len(args) if c==1: name,val=None,args[0] elif c==2: name,val=args[0],args[1] else: raise ValueError, 'Invalid arguments' | df9e6f8bd821a6326d9006ae4da495922d7f54bb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/df9e6f8bd821a6326d9006ae4da495922d7f54bb/Client.py |
else: v=open(v) | else: v=open(v, 'rb') | def main(): import getopt from string import split user=None try: optlist, args = getopt.getopt(sys.argv[1:],'u:') url=args[0] u =filter(lambda o: o[0]=='-u', optlist) if u: [user, pw] = split(u[0][1],':') kw={} for arg in args[1:]: [name,v]=split(arg,'=') if name[-5:]==':file': name=name[:-5] if v=='-': v=sys.stdin else: v=open(v) kw[name]=v except: print usage sys.exit(1) # The "main" program for this module f=Function(url) if user: f.username, f.password = user, pw headers, body = apply(f,(),kw) sys.stderr.write(join(map(lambda h: "%s: %s\n" % h, headers.items()),"") +"\n\n") print body | df9e6f8bd821a6326d9006ae4da495922d7f54bb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/df9e6f8bd821a6326d9006ae4da495922d7f54bb/Client.py |
f = self.quick_dispatch[t] | f = self.dispatch[t] | def save(self, object, pers_save = 0): memo = self.memo | 971792dafe584efc723c3014ded6af302d155a6f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/971792dafe584efc723c3014ded6af302d155a6f/pickle.py |
if memo.has_key(d): self.write(self.get(memo[d])) | pid = self.inst_persistent_id(object) if pid is not None: self.save_pers(pid) | def save(self, object, pers_save = 0): memo = self.memo | 971792dafe584efc723c3014ded6af302d155a6f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/971792dafe584efc723c3014ded6af302d155a6f/pickle.py |
f = self.dispatch[t] | reduce = dispatch_table[t] | def save(self, object, pers_save = 0): memo = self.memo | 971792dafe584efc723c3014ded6af302d155a6f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/971792dafe584efc723c3014ded6af302d155a6f/pickle.py |
pid = self.inst_persistent_id(object) if pid is not None: self.save_pers(pid) return | def save(self, object, pers_save = 0): memo = self.memo | 971792dafe584efc723c3014ded6af302d155a6f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/971792dafe584efc723c3014ded6af302d155a6f/pickle.py |
|
reduce = dispatch_table[t] except KeyError: try: reduce = object.__reduce__ except AttributeError: raise PicklingError, \ "can't pickle %s objects" % `t.__name__` else: tup = reduce() | reduce = object.__reduce__ except AttributeError: raise PicklingError, \ "can't pickle %s objects" % `t.__name__` | def save(self, object, pers_save = 0): memo = self.memo | 971792dafe584efc723c3014ded6af302d155a6f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/971792dafe584efc723c3014ded6af302d155a6f/pickle.py |
tup = reduce(object) if (type(tup) is not TupleType): raise PicklingError, "Value returned by %s must be a " \ "tuple" % reduce l = len(tup) | tup = reduce() else: tup = reduce(object) if (type(tup) is not TupleType): raise PicklingError, "Value returned by %s must be a " \ "tuple" % reduce l = len(tup) | def save(self, object, pers_save = 0): memo = self.memo | 971792dafe584efc723c3014ded6af302d155a6f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/971792dafe584efc723c3014ded6af302d155a6f/pickle.py |
if ((l != 2) and (l != 3)): raise PicklingError, "tuple returned by %s must contain " \ "only two or three elements" % reduce callable = tup[0] arg_tup = tup[1] | if ((l != 2) and (l != 3)): raise PicklingError, "tuple returned by %s must contain " \ "only two or three elements" % reduce callable = tup[0] arg_tup = tup[1] | def save(self, object, pers_save = 0): memo = self.memo | 971792dafe584efc723c3014ded6af302d155a6f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/971792dafe584efc723c3014ded6af302d155a6f/pickle.py |
if (l > 2): state = tup[2] else: state = None if (type(arg_tup) is not TupleType): raise PicklingError, "Second element of tuple returned " \ "by %s must be a tuple" % reduce self.save_reduce(callable, arg_tup, state) return | if (l > 2): state = tup[2] else: state = None if (type(arg_tup) is not TupleType): raise PicklingError, "Second element of tuple returned " \ "by %s must be a tuple" % reduce self.save_reduce(callable, arg_tup, state) return | def save(self, object, pers_save = 0): memo = self.memo | 971792dafe584efc723c3014ded6af302d155a6f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/971792dafe584efc723c3014ded6af302d155a6f/pickle.py |
quick_dispatch = {} | def save_reduce(self, callable, arg_tup, state = None): write = self.write save = self.save | 971792dafe584efc723c3014ded6af302d155a6f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/971792dafe584efc723c3014ded6af302d155a6f/pickle.py |
|
quick_dispatch[NoneType] = save_none | dispatch[NoneType] = save_none | def save_none(self, object): self.write(NONE) | 971792dafe584efc723c3014ded6af302d155a6f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/971792dafe584efc723c3014ded6af302d155a6f/pickle.py |
quick_dispatch[IntType] = save_int | dispatch[IntType] = save_int | def save_int(self, object): if (self.bin): i = mdumps(object)[1:] if (i[-2:] == '\000\000'): if (i[-3] == '\000'): self.write(BININT1 + i[:-3]) return | 971792dafe584efc723c3014ded6af302d155a6f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/971792dafe584efc723c3014ded6af302d155a6f/pickle.py |
quick_dispatch[FloatType] = save_float | dispatch[FloatType] = save_float | def save_float(self, object): self.write(FLOAT + `object` + '\n') | 971792dafe584efc723c3014ded6af302d155a6f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/971792dafe584efc723c3014ded6af302d155a6f/pickle.py |
d = id(object) | def save_tuple(self, object): d = id(object) | 971792dafe584efc723c3014ded6af302d155a6f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/971792dafe584efc723c3014ded6af302d155a6f/pickle.py |
|
write(POP * len(object)) write(self.get(memo[d])) | write(POP * len(object) + self.get(memo[d])) | def save_tuple(self, object): d = id(object) | 971792dafe584efc723c3014ded6af302d155a6f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/971792dafe584efc723c3014ded6af302d155a6f/pickle.py |
using_appends = (self.bin and (len(object) > 1)) if (using_appends): write(MARK + LIST + MARK) | if (self.bin): write(EMPTY_LIST) | def save_list(self, object): d = id(object) | 971792dafe584efc723c3014ded6af302d155a6f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/971792dafe584efc723c3014ded6af302d155a6f/pickle.py |
using_setitems = (self.bin and (len(object) > 1)) if (using_setitems): write(MARK + DICT + MARK) | if (self.bin): write(EMPTY_DICT) | def save_dict(self, object): d = id(object) | 971792dafe584efc723c3014ded6af302d155a6f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/971792dafe584efc723c3014ded6af302d155a6f/pickle.py |
if name != '__main__' and \ hasattr(module, clsname) and \ getattr(module, clsname) is cls: | if hasattr(module, clsname) and \ getattr(module, clsname) is cls: | def whichmodule(cls, clsname): """Figure out the module in which a class occurs. Search sys.modules for the module. Cache in classmap. Return a module name. If the class cannot be found, return __main__. """ if classmap.has_key(cls): return classmap[cls] import sys for name, module in sys.modules.items(): if name != '__main__' and \ hasattr(module, clsname) and \ getattr(module, clsname) is cls: break else: name = '__main__' classmap[cls] = name return name | 971792dafe584efc723c3014ded6af302d155a6f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/971792dafe584efc723c3014ded6af302d155a6f/pickle.py |
len = mloads('i' + self.read(1)) | len = mloads('i' + self.read(1) + '\000\000\000') | def load_short_binstring(self): len = mloads('i' + self.read(1)) self.append(self.read(len)) | 971792dafe584efc723c3014ded6af302d155a6f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/971792dafe584efc723c3014ded6af302d155a6f/pickle.py |
(8, Dummy('g', date(2034,2,5))), (9, Dummy('h', datetime(2034,2,5,15,17,5))), | (8, Dummy('g', date(2034,2,5))), (9, Dummy('h', datetime(2034,2,5,15,20,5))), | def setUp(self): self._values = ( (0, Dummy('a', None)), # None (1, Dummy('b', DateTime(0))), # 1055335680 (2, Dummy('c', DateTime('2002-05-08 15:16:17'))), # 1072667236 (3, Dummy('d', DateTime('2032-05-08 15:16:17'))), # 1088737636 (4, Dummy('e', DateTime('2062-05-08 15:16:17'))), # 1018883325 (5, Dummy('e', DateTime('2062-05-08 15:16:17'))), # 1018883325 (6, Dummy('f', 1072742620.0)), # 1073545923 (7, Dummy('f', 1072742900)), # 1073545928 (8, Dummy('g', date(2034,2,5))), # 1073599200 (9, Dummy('h', datetime(2034,2,5,15,17,5))), # (1073600117UTC) (10, Dummy('i', datetime(2034,2,5,10,17,5, tzinfo=Eastern))), # 1073600117 ) self._index = DateIndex('date') self._noop_req = {'bar': 123} self._request = {'date': DateTime(0)} self._min_req = {'date': {'query': DateTime('2032-05-08 15:16:17'), 'range': 'min'}} self._max_req = {'date': {'query': DateTime('2032-05-08 15:16:17'), 'range': 'max'}} self._range_req = {'date': {'query':(DateTime('2002-05-08 15:16:17'), DateTime('2062-05-08 15:16:17')), 'range': 'min:max'}} self._zero_req = {'date': 0} self._none_req = {'date': None} self._float_req = {'date': 1072742620.0} self._int_req = {'date': 1072742900} | 830b6bd4d2ef80d72e6fa4b86e45995cdca416da /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/830b6bd4d2ef80d72e6fa4b86e45995cdca416da/test_DateIndex.py |
tzinfo=Eastern))), | tzinfo=Eastern))), | def setUp(self): self._values = ( (0, Dummy('a', None)), # None (1, Dummy('b', DateTime(0))), # 1055335680 (2, Dummy('c', DateTime('2002-05-08 15:16:17'))), # 1072667236 (3, Dummy('d', DateTime('2032-05-08 15:16:17'))), # 1088737636 (4, Dummy('e', DateTime('2062-05-08 15:16:17'))), # 1018883325 (5, Dummy('e', DateTime('2062-05-08 15:16:17'))), # 1018883325 (6, Dummy('f', 1072742620.0)), # 1073545923 (7, Dummy('f', 1072742900)), # 1073545928 (8, Dummy('g', date(2034,2,5))), # 1073599200 (9, Dummy('h', datetime(2034,2,5,15,17,5))), # (1073600117UTC) (10, Dummy('i', datetime(2034,2,5,10,17,5, tzinfo=Eastern))), # 1073600117 ) self._index = DateIndex('date') self._noop_req = {'bar': 123} self._request = {'date': DateTime(0)} self._min_req = {'date': {'query': DateTime('2032-05-08 15:16:17'), 'range': 'min'}} self._max_req = {'date': {'query': DateTime('2032-05-08 15:16:17'), 'range': 'max'}} self._range_req = {'date': {'query':(DateTime('2002-05-08 15:16:17'), DateTime('2062-05-08 15:16:17')), 'range': 'min:max'}} self._zero_req = {'date': 0} self._none_req = {'date': None} self._float_req = {'date': 1072742620.0} self._int_req = {'date': 1072742900} | 830b6bd4d2ef80d72e6fa4b86e45995cdca416da /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/830b6bd4d2ef80d72e6fa4b86e45995cdca416da/test_DateIndex.py |
try: self._p_jar.cache.incrgc() | try: self._p_jar.cache.incrgc() | def __bobo_traverse__(self, REQUEST, name=None): | 6560c3a0f864741509f002726a9d05089db0cfe5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/6560c3a0f864741509f002726a9d05089db0cfe5/Application.py |
if bobobase is None: return 1 | safe=bobobase.has_key('Application') | def lic_check(product_name): path_join =os.path.join product_dir=path_join(SOFTWARE_HOME,'lib/python/Products') package_dir=path_join(product_dir, product_name) bobobase =Globals.Bobobase if bobobase is None: return 1 try: f=open(path_join(package_dir,'%s.lic' % product_name), 'rb') except: try: product=getattr(__import__("Products.%s" % product_name), product_name) for s in pgetattr(product, 'classes', ()): p=rfind(s,'.') m='Products.%s.%s' % (product_name, s[:p]) c=s[p+1:] __import__(m) setattr(sys.modules[m], c, Expired) except: pass return 0 dat=f.read() f.close() rot=rotor.newrotor('\357\261\390\247\357\362\306\216\226', 13) dat=rot.decrypt(dat) dat=list(dat) dat.reverse() dat=join(dat,'') dat=marshal.loads(dat) del rot name=dat[0] val =dat[1] if name != product_name: return 0 if val is None: return 1 else: if not bobobase.has_key('_t_'): bobobase['_t_']={} get_transaction().commit() t=bobobase['_t_'] if not t.has_key(product_name): t[product_name]=time.time() bobobase['_t_']=t get_transaction().commit() if (t[product_name] + (86400.0 * val)) < time.time(): product=getattr(__import__("Products.%s" % product_name), product_name) for s in pgetattr(product, 'classes', ()): p=rfind(s,'.') m='Products.%s.%s' % (product_name, s[:p]) c=s[p+1:] try: __import__(m) except: m=s[:p] __import__(m) setattr(sys.modules[m], c, Expired) return 0 return 1 | 6560c3a0f864741509f002726a9d05089db0cfe5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/6560c3a0f864741509f002726a9d05089db0cfe5/Application.py |
get_transaction().commit() | if safe: get_transaction().commit() | def lic_check(product_name): path_join =os.path.join product_dir=path_join(SOFTWARE_HOME,'lib/python/Products') package_dir=path_join(product_dir, product_name) bobobase =Globals.Bobobase if bobobase is None: return 1 try: f=open(path_join(package_dir,'%s.lic' % product_name), 'rb') except: try: product=getattr(__import__("Products.%s" % product_name), product_name) for s in pgetattr(product, 'classes', ()): p=rfind(s,'.') m='Products.%s.%s' % (product_name, s[:p]) c=s[p+1:] __import__(m) setattr(sys.modules[m], c, Expired) except: pass return 0 dat=f.read() f.close() rot=rotor.newrotor('\357\261\390\247\357\362\306\216\226', 13) dat=rot.decrypt(dat) dat=list(dat) dat.reverse() dat=join(dat,'') dat=marshal.loads(dat) del rot name=dat[0] val =dat[1] if name != product_name: return 0 if val is None: return 1 else: if not bobobase.has_key('_t_'): bobobase['_t_']={} get_transaction().commit() t=bobobase['_t_'] if not t.has_key(product_name): t[product_name]=time.time() bobobase['_t_']=t get_transaction().commit() if (t[product_name] + (86400.0 * val)) < time.time(): product=getattr(__import__("Products.%s" % product_name), product_name) for s in pgetattr(product, 'classes', ()): p=rfind(s,'.') m='Products.%s.%s' % (product_name, s[:p]) c=s[p+1:] try: __import__(m) except: m=s[:p] __import__(m) setattr(sys.modules[m], c, Expired) return 0 return 1 | 6560c3a0f864741509f002726a9d05089db0cfe5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/6560c3a0f864741509f002726a9d05089db0cfe5/Application.py |
get_transaction().commit() | if safe: get_transaction().commit() | def lic_check(product_name): path_join =os.path.join product_dir=path_join(SOFTWARE_HOME,'lib/python/Products') package_dir=path_join(product_dir, product_name) bobobase =Globals.Bobobase if bobobase is None: return 1 try: f=open(path_join(package_dir,'%s.lic' % product_name), 'rb') except: try: product=getattr(__import__("Products.%s" % product_name), product_name) for s in pgetattr(product, 'classes', ()): p=rfind(s,'.') m='Products.%s.%s' % (product_name, s[:p]) c=s[p+1:] __import__(m) setattr(sys.modules[m], c, Expired) except: pass return 0 dat=f.read() f.close() rot=rotor.newrotor('\357\261\390\247\357\362\306\216\226', 13) dat=rot.decrypt(dat) dat=list(dat) dat.reverse() dat=join(dat,'') dat=marshal.loads(dat) del rot name=dat[0] val =dat[1] if name != product_name: return 0 if val is None: return 1 else: if not bobobase.has_key('_t_'): bobobase['_t_']={} get_transaction().commit() t=bobobase['_t_'] if not t.has_key(product_name): t[product_name]=time.time() bobobase['_t_']=t get_transaction().commit() if (t[product_name] + (86400.0 * val)) < time.time(): product=getattr(__import__("Products.%s" % product_name), product_name) for s in pgetattr(product, 'classes', ()): p=rfind(s,'.') m='Products.%s.%s' % (product_name, s[:p]) c=s[p+1:] try: __import__(m) except: m=s[:p] __import__(m) setattr(sys.modules[m], c, Expired) return 0 return 1 | 6560c3a0f864741509f002726a9d05089db0cfe5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/6560c3a0f864741509f002726a9d05089db0cfe5/Application.py |
buf = ("------\n" "%s %s %s %s\n%s" % (log_time(), severity_string(severity), subsystem, summary, detail)) else: buf = ("------\n" "%s %s %s %s" % (log_time(), severity_string(severity), subsystem, summary)) print >> _log_dest, buf | buf.append(str(detail)) | def log(self, subsystem, severity, summary, detail, error): if _log_dest is None or severity < _log_level: return | c2b166296200c88d7d5db513cb32eae27bebbf41 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/c2b166296200c88d7d5db513cb32eae27bebbf41/MinimalLogger.py |
print >> _log_dest, ''.join(lines) except: print >> _log_dest, "%s: %s" % error[:2] | buf.append(''.join(lines)) except '': buf.append("%s: %s" % error[:2]) buf.append("") _log_dest.write("\n".join(buf)) | def log(self, subsystem, severity, summary, detail, error): if _log_dest is None or severity < _log_level: return | c2b166296200c88d7d5db513cb32eae27bebbf41 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/c2b166296200c88d7d5db513cb32eae27bebbf41/MinimalLogger.py |
DocBookBook=DocBookClass.DocBookBook | DocBookBook=DocBookClass.DocBookBook() | def HTML(src, level=0, type=type, StringType=type('')): if type(src) is StringType: return ClassicHTML(src, level) return HTMLNG(src, level) | 1b24f247ebeb56949b3622db9538094469563c1a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/1b24f247ebeb56949b3622db9538094469563c1a/__init__.py |
copy=self.__class__(self.id, self.title, bases) | copy=self.__class__(self.id, self.title, bases, hasattr(self._zclass_, '_p_deactivate') ) | def _setBasesHoldOnToYourButts(self, bases): # Eeeek copy=self.__class__(self.id, self.title, bases) | 2db44df90f1fc5bad19b747f904c6a32321cd819 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/2db44df90f1fc5bad19b747f904c6a32321cd819/ZClass.py |
URLmatch=regex.compile('URL[0-9]$').match, BASEmatch=regex.compile('BASE[0-9]$').match, | URLmatch=regex.compile('URL[0-9]+$').match, BASEmatch=regex.compile('BASE[0-9]+$').match, | def __getitem__(self,key, default=_marker, # Any special internal marker will do URLmatch=regex.compile('URL[0-9]$').match, BASEmatch=regex.compile('BASE[0-9]$').match, ): """Get a variable value | 14717654d6c896278c14ffe2f422b8fd67e1c093 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/14717654d6c896278c14ffe2f422b8fd67e1c093/HTTPRequest.py |
n=ord(key[3])-ord('0') | n=atoi(key[3:]) | def __getitem__(self,key, default=_marker, # Any special internal marker will do URLmatch=regex.compile('URL[0-9]$').match, BASEmatch=regex.compile('BASE[0-9]$').match, ): """Get a variable value | 14717654d6c896278c14ffe2f422b8fd67e1c093 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/14717654d6c896278c14ffe2f422b8fd67e1c093/HTTPRequest.py |
n=ord(key[4])-ord('0') | n=atoi(key[4:]) | def __getitem__(self,key, default=_marker, # Any special internal marker will do URLmatch=regex.compile('URL[0-9]$').match, BASEmatch=regex.compile('BASE[0-9]$').match, ): """Get a variable value | 14717654d6c896278c14ffe2f422b8fd67e1c093 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/14717654d6c896278c14ffe2f422b8fd67e1c093/HTTPRequest.py |
if self.environ.get('SCRIPT_NAME',''): n=n-1 | n=n-1 | def __getitem__(self,key, default=_marker, # Any special internal marker will do URLmatch=regex.compile('URL[0-9]$').match, BASEmatch=regex.compile('BASE[0-9]$').match, ): """Get a variable value | 14717654d6c896278c14ffe2f422b8fd67e1c093 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/14717654d6c896278c14ffe2f422b8fd67e1c093/HTTPRequest.py |
lasturl = "" for n in "0123456789": key = "URL%s"%n try: if lasturl != self[key]: keys[key] = 1 lasturl = self[key] else: break except KeyError: pass for n in "0123456789": key = "BASE%s"%n try: if lasturl != self[key]: keys[key] = 1 lasturl = self[key] else: break except KeyError: pass return keys.keys() | keys=keys.keys() keys.sort() return keys | def keys(self): keys = {} keys.update(self.common) | 14717654d6c896278c14ffe2f422b8fd67e1c093 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/14717654d6c896278c14ffe2f422b8fd67e1c093/HTTPRequest.py |
except AttributeError, KeyError: akey = None | except (AttributeError, KeyError): akey = None | def sort(sequence, sort=(), _=None, mapping=0): """ - sequence is a sequence of objects to be sorted - sort is a sequence of tuples (key,func,direction) that define the sort order: - key is the name of an attribute to sort the objects by - func is the name of a comparison function. This parameter is optional allowed values: - "cmp" -- the standard comparison function (default) - "nocase" -- case-insensitive comparison - "strcoll" or "locale" -- locale-aware string comparison - "strcoll_nocase" or "locale_nocase" -- locale-aware case-insensitive string comparison - "xxx" -- a user-defined comparison function - direction -- defines the sort direction for the key (optional). (allowed values: "asc" (default) , "desc") """ need_sortfunc = 0 if sort: for s in sort: if len(s) > 1: # extended sort if there is reference to... # ...comparison function or sort order, even if they are "cmp" and "asc" need_sortfunc = 1 break sortfields = sort # multi sort = key1,key2 multsort = len(sortfields) > 1 # flag: is multiple sort if need_sortfunc: # prepare the list of functions and sort order multipliers sf_list = make_sortfunctions(sortfields, _) # clean the mess a bit if multsort: # More than one sort key. sortfields = map(lambda x: x[0], sf_list) else: sort = sf_list[0][0] elif sort: if multsort: # More than one sort key. sortfields = map(lambda x: x[0], sort) else: sort = sort[0][0] isort=not sort s=[] for client in sequence: k = None if type(client)==TupleType and len(client)==2: if isort: k=client[0] v=client[1] else: if isort: k=client v=client if sort: if multsort: # More than one sort key. k = [] for sk in sortfields: try: if mapping: akey = v[sk] else: akey = getattr(v, sk) except AttributeError, KeyError: akey = None if not basic_type(akey): try: akey = akey() except: pass k.append(akey) else: # One sort key. try: if mapping: k = v[sort] else: k = getattr(v, sort) except AttributeError, KeyError: k = None if not basic_type(type(k)): try: k = k() except: pass s.append((k,client)) if need_sortfunc: by = SortBy(multsort, sf_list) s.sort(by) else: s.sort() sequence=[] for k, client in s: sequence.append(client) return sequence | 72ae253aa5ea1704714334b5aa865c18c32840b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/72ae253aa5ea1704714334b5aa865c18c32840b2/SortEx.py |
for i in query(key,self).keys(): rr.insert(i) | for i,score in query(key,self).items(): if score: rr.insert(i) | def _apply_index(self, request, cid='', ListType=[]): | 4ddbd1b59bf5e901ed147cf779f71eb42cfd362b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4ddbd1b59bf5e901ed147cf779f71eb42cfd362b/TextIndex.py |
d=lp=len(p) | d=lp=9999 | def near(self, x): result = {} | 4ddbd1b59bf5e901ed147cf779f71eb42cfd362b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4ddbd1b59bf5e901ed147cf779f71eb42cfd362b/TextIndex.py |
for i in range(1, len(splitted), 2): splitted[i] = filter(None, split(splitted[i])) for j in range(1, len(splitted[i])): | for i in range(1,len(splitted),2): splitted[i] = filter(None, split(splitted[i])) for j in range(1, len(splitted[i])): | def quotes(s, ws = (string.whitespace,)): # split up quoted regions splitted = regsub.split(s, '[%s]*\"[%s]*' % (ws * 2)) split=string.split if (len(splitted) > 1): if ((len(splitted) % 2) == 0): raise QueryError, "Mismatched quotes" for i in range(1, len(splitted), 2): # split the quoted region into words splitted[i] = filter(None, split(splitted[i])) # put the Proxmity operator in between quoted words for j in range(1, len(splitted[i])): splitted[i][j : j] = [ Near ] splitted = filter(None, splitted) else: # No quotes, so just split the string into words splitted = filter(None, split(s)) return splitted | 4ddbd1b59bf5e901ed147cf779f71eb42cfd362b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4ddbd1b59bf5e901ed147cf779f71eb42cfd362b/TextIndex.py |
def get_operands(q, i, index, ListType=type([])): | def get_operands(q, i, index, ListType=type([]), StringType=type('')): | def get_operands(q, i, index, ListType=type([])): '''Evaluate and return the left and right operands for an operator''' try: left = q[i - 1] right = q[i + 1] except IndexError: raise QueryError, "Malformed query" if (type(left) is ListType): left = evaluate(left, index) else: left=index[left] if (type(right) is ListType): right = evaluate(right, index) else: right = index[right] return (left, right) | 4ddbd1b59bf5e901ed147cf779f71eb42cfd362b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4ddbd1b59bf5e901ed147cf779f71eb42cfd362b/TextIndex.py |
if (type(left) is ListType): left = evaluate(left, index) else: left=index[left] if (type(right) is ListType): right = evaluate(right, index) else: right = index[right] | t=type(left) if t is ListType: left = evaluate(left, index) elif t is StringType: left=index[left] t=type(right) if t is ListType: right = evaluate(right, index) elif t is StringType: right=index[right] | def get_operands(q, i, index, ListType=type([])): '''Evaluate and return the left and right operands for an operator''' try: left = q[i - 1] right = q[i + 1] except IndexError: raise QueryError, "Malformed query" if (type(left) is ListType): left = evaluate(left, index) else: left=index[left] if (type(right) is ListType): right = evaluate(right, index) else: right = index[right] return (left, right) | 4ddbd1b59bf5e901ed147cf779f71eb42cfd362b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4ddbd1b59bf5e901ed147cf779f71eb42cfd362b/TextIndex.py |
'ours', 'ourselves', 'out', 'over', 'own', 'part', 'per', 'perhaps', | 'ours', 'ourselves', 'out', 'over', 'own', 'per', 'perhaps', | def evaluate(q, index,ListType=type([])): '''Evaluate a parsed query''' if (len(q) == 1): if (type(q[0]) is ListType): return evaluate(q[0], index) return index[q[0]] i = 0 while (i < len(q)): if q[i] is AndNot: left, right = get_operands(q, i, index) val = left.and_not(right) q[(i - 1) : (i + 2)] = [ val ] else: i = i + 1 i = 0 while (i < len(q)): if q[i] is And: left, right = get_operands(q, i, index) val = left & right q[(i - 1) : (i + 2)] = [ val ] else: i = i + 1 i = 0 while (i < len(q)): if q[i] is Or: left, right = get_operands(q, i, index) val = left | right q[(i - 1) : (i + 2)] = [ val ] else: i = i + 1 i = 0 while (i < len(q)): if q[i] is Near: left, right = get_operands(q, i, index) val = left.near(right) q[(i - 1) : (i + 2)] = [ val ] else: i = i + 1 if (len(q) != 1): raise QueryError, "Malformed query" return q[0] | 4ddbd1b59bf5e901ed147cf779f71eb42cfd362b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4ddbd1b59bf5e901ed147cf779f71eb42cfd362b/TextIndex.py |
get_size=getSize | def getSize(self): """Get the size of a file or image. | 60d2408c7804e52f727045b38570996fdb2c6719 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/60d2408c7804e52f727045b38570996fdb2c6719/Image.py |
|
self.base="%s/%s" % (server_url,b) | if b: self.base="%s/%s" % (server_url,b) else: self.base=server_url | def __init__(self, stdin, environ, response, clean=0): # Avoid the overhead of scrubbing the environment in the # case of request cloning for traversal purposes. If the # clean flag is set, we know we can use the passed in # environ dict directly. | 9a1697da19bc6bf056b678c17b0069e43f49662d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/9a1697da19bc6bf056b678c17b0069e43f49662d/HTTPRequest.py |
self=self.__of__(container) | if vocab_id is not None and container is None: raise CatalogError, ("You cannot specify a vocab_id without " "also specifying a container.") if container is not None: self=self.__of__(container) | def __init__(self, id, title='', vocab_id=None, container=None): self=self.__of__(container) self.id=id self.title=title self.threshold = 10000 self._v_total = 0 | 167a4f4e8583e7e72f8ebb7c8c434f8b2d379193 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/167a4f4e8583e7e72f8ebb7c8c434f8b2d379193/ZCatalog.py |
pid=product.id | def _manage_add_product_permission( self, product, permission, methods=(), default=('Manager',) ): | 1999718b79917aabe57ded9ad7e4308ca0b0e94e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/1999718b79917aabe57ded9ad7e4308ca0b0e94e/ProductRegistry.py |
|
if not d.has_key('product'): d['product']=pid if d['product'] != pid: raise 'Type Exists', ( 'The permission <em>%s</em> is already defined.' % permission) d['methods']=methods d['default']=default return d={'name': permission, 'methods': methods, 'default': default} if permission: d['permission']=permission self._setProductRegistryData('permissions', permissions+(d,)) | raise 'Type Exists', ( 'The permission <em>%s</em> is already defined.' % permission) d={'name': permission, 'methods': methods, 'permission': permission, 'default': default, 'product': product.id} self._setProductRegistryData('permissions', permissions + (d,)) | def _manage_add_product_permission( self, product, permission, methods=(), default=('Manager',) ): | 1999718b79917aabe57ded9ad7e4308ca0b0e94e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/1999718b79917aabe57ded9ad7e4308ca0b0e94e/ProductRegistry.py |
def field2text(v, nl=re.compile('\r\n\|\n\r').search): | def field2text(v, nl=re.compile('\r\n|\n\r').search): | def field2text(v, nl=re.compile('\r\n\|\n\r').search): if hasattr(v,'read'): v=v.read() else: v=str(v) mo = nl(v) if mo is None: return v l = mo.start(0) r=[] s=0 while l >= s: r.append(v[s:l]) s=l+2 mo=nl(v,s) if mo is None: l=-1 else: l=mo.start(0) r.append(v[s:]) return join(r,'\n') | fde9020ddb0f73b7c6f3ffd56de513c6fbc9126e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/fde9020ddb0f73b7c6f3ffd56de513c6fbc9126e/Converters.py |
return '\n <n:lockentry>\n' \ ' <d:lockscope><d:exclusive/></d:lockscope>\n' \ ' <d:locktype><d:write/></d:locktype>\n' \ ' </n:lockentry>\n ' | vself = self.v_self() out = '\n' if WriteLockInterface.isImplementedBy(vself): out += (' <n:lockentry>\n' ' <d:lockscope><d:exclusive/></d:lockscope>\n' ' <d:locktype><d:write/></d:locktype>\n' ' </n:lockentry>\n ') return out | def dav__supportedlock(self): return '\n <n:lockentry>\n' \ ' <d:lockscope><d:exclusive/></d:lockscope>\n' \ ' <d:locktype><d:write/></d:locktype>\n' \ ' </n:lockentry>\n ' | bf1ee86ca7a7cf19803c6b1deb9d9e917824faed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/bf1ee86ca7a7cf19803c6b1deb9d9e917824faed/PropertySheets.py |
path=REQUEST['SCRIPT_NAME'], | path=(REQUEST['BASEPATH1'] or '/'), | def enter(self, REQUEST, RESPONSE): """Begin working in a version""" RESPONSE.setCookie( Globals.VersionNameName, self.cookie, path=REQUEST['SCRIPT_NAME'], ) if (REQUEST.has_key('SERVER_SOFTWARE') and REQUEST['SERVER_SOFTWARE'][:9]=='Microsoft'): # IIS doesn't handle redirect headers correctly return MessageDialog( action=REQUEST['URL1']+'/manage_main', message=('If cookies are enabled by your browser, then ' 'you should have joined version %s.' % self.id) ) return RESPONSE.redirect(REQUEST['URL1']+'/manage_main') | b09775f305024b846c82502c8837ea008f845f33 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b09775f305024b846c82502c8837ea008f845f33/Version.py |
func_defaults = ComputedAttribute(lambda self: self._v_func_defaults) func_code = ComputedAttribute(lambda self: self._v_func_code) | func_defaults = ComputedAttribute(lambda self: self.getFuncDefaults()) func_code = ComputedAttribute(lambda self: self.getFuncCode()) | def manage_addExternalMethod(self, id, title, module, function, REQUEST=None): """Add an external method to a folder Un 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. """ id=str(id) title=str(title) module=str(module) function=str(function) i=ExternalMethod(id,title,module,function) self._setObject(id,i) return self.manage_main(self,REQUEST) | 58331c88441a6815ad0ae9623947f02922399471 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/58331c88441a6815ad0ae9623947f02922399471/ExternalMethod.py |
def getFunction(self, reload=0): | 58331c88441a6815ad0ae9623947f02922399471 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/58331c88441a6815ad0ae9623947f02922399471/ExternalMethod.py |
||
def reloadIfChanged(self): ts=os.stat(self.filepath())[stat.ST_MTIME] if (not hasattr(self, '_v_last_read') or (ts != self._v_last_read)): self._v_f=self.getFunction(1) self._v_last_read=ts if DevelopmentMode: def getFuncDefaults(self): self.reloadIfChanged() if not hasattr(self, '_v_func_defaults'): self._v_f = self.getFunction() return self._v_func_defaults def getFuncCode(self): self.reloadIfChanged() if not hasattr(self, '_v_func_code'): self._v_f = self.getFunction() return self._v_func_code else: def getFuncDefaults(self): if not hasattr(self, '_v_func_defaults'): self._v_f = self.getFunction() return self._v_func_defaults def getFuncCode(self): if not hasattr(self, '_v_func_code'): self._v_f = self.getFunction() return self._v_func_code | def getFunction(self, reload=0): | 58331c88441a6815ad0ae9623947f02922399471 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/58331c88441a6815ad0ae9623947f02922399471/ExternalMethod.py |
|
def __call__(self, *args, **kw): """Call an ExternalMethod | 58331c88441a6815ad0ae9623947f02922399471 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/58331c88441a6815ad0ae9623947f02922399471/ExternalMethod.py |
||
ts=os.stat(self.filepath())[stat.ST_MTIME] if (not hasattr(self, '_v_last_read') or (ts != self._v_last_read)): self._v_f=self.getFunction(1) self._v_last_read=ts | self.reloadIfChanged() | def __call__(self, *args, **kw): """Call an ExternalMethod | 58331c88441a6815ad0ae9623947f02922399471 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/58331c88441a6815ad0ae9623947f02922399471/ExternalMethod.py |
def version_txt(self): | def version_txt(): | def version_txt(self): try: return open(os.path.join(SOFTWARE_HOME,'version.txt')).read() except: return '(unreleased version)' return self._v_version_txt | 08403910827a85754dd286f4e6fc34962c4dfdb1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/08403910827a85754dd286f4e6fc34962c4dfdb1/ApplicationManager.py |
CreateFactory=1) | CreateAFactory=1) | def __class_init__(self): pass | ed17f39764de88ba31bb7e5e8066416d4fed2d58 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/ed17f39764de88ba31bb7e5e8066416d4fed2d58/ZClass.py |
if CreateFactory and meta_type: | if CreateAFactory and meta_type: | def manage_addZClass(self, id, title='', baseclasses=[], meta_type='', CreateAFactory=0, REQUEST=None): """Add a Z Class """ bases=[] for b in baseclasses: if Products.meta_classes.has_key(b): bases.append(Products.meta_classes[b]) else: base=find_class(self, b) bases.append(base) Z=ZClass(id,title,bases) if meta_type: Z._zclass_.meta_type=meta_type self._setObject(id, Z) if CreateFactory and meta_type: self.manage_addDTMLMethod( id+'_addForm', id+' constructor input form', addFormDefault % {'id': id, 'meta_type': meta_type}, ) self.manage_addDTMLMethod( id+'_add', id+' constructor', addDefault % {'id': id}, ) self.manage_addPrincipiaFactory( id+'_factory', id+' factory', meta_type, id+'_addForm', ) if REQUEST is not None: return self.manage_main(self,REQUEST) | ed17f39764de88ba31bb7e5e8066416d4fed2d58 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/ed17f39764de88ba31bb7e5e8066416d4fed2d58/ZClass.py |
$Id: Publish.py,v 1.17 1996/08/30 17:08:53 jfulton Exp $""" | $Id: Publish.py,v 1.18 1996/08/30 23:40:40 jfulton Exp $""" | def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam | dd8f0382d4a94b6d1ee97592d30969acccafcfcf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/dd8f0382d4a94b6d1ee97592d30969acccafcfcf/Publish.py |
__version__='$Revision: 1.17 $'[11:-2] | __version__='$Revision: 1.18 $'[11:-2] | def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam | dd8f0382d4a94b6d1ee97592d30969acccafcfcf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/dd8f0382d4a94b6d1ee97592d30969acccafcfcf/Publish.py |
result.write('<d:response>\n<d:href>%s</d:href>\n' % url) | result.write('<d:response>\n<d:href>%s</d:href>\n' % quote(url)) | def apply(self, obj, url=None, depth=0, result=None, top=1): if result is None: result=StringIO() depth=self.depth url=urlfix(self.request['URL'], 'PROPFIND') url=urlbase(url) result.write('<?xml version="1.0" encoding="utf-8"?>\n' \ '<d:multistatus xmlns:d="DAV:">\n') iscol=hasattr(obj, '__dav_collection__') if iscol and url[-1] != '/': url=url+'/' result.write('<d:response>\n<d:href>%s</d:href>\n' % url) if hasattr(aq_base(obj), 'propertysheets'): propsets=obj.propertysheets.values() obsheets=obj.propertysheets else: davprops=DAVProps(obj) propsets=(davprops,) obsheets={'DAV:': davprops} if self.allprop: stats=[] for ps in propsets: if hasattr(aq_base(ps), 'dav__allprop'): stats.append(ps.dav__allprop()) stats=string.join(stats, '') or '<d:status>200 OK</d:status>\n' result.write(stats) elif self.propname: stats=[] for ps in propsets: if hasattr(aq_base(ps), 'dav__propnames'): stats.append(ps.dav__propnames()) stats=string.join(stats, '') or '<d:status>200 OK</d:status>\n' result.write(stats) elif self.propnames: rdict={} for name, ns in self.propnames: ps=obsheets.get(ns, None) if ps is not None and hasattr(aq_base(ps), 'dav__propstat'): stat=ps.dav__propstat(name, rdict) else: prop='<n:%s xmlns:n="%s"/>' % (name, ns) code='404 Not Found' if not rdict.has_key(code): rdict[code]=[prop] else: rdict[code].append(prop) keys=rdict.keys() keys.sort() for key in keys: result.write('<d:propstat>\n' \ ' <d:prop>\n' \ ) map(result.write, rdict[key]) result.write(' </d:prop>\n' \ ' <d:status>HTTP/1.1 %s</d:status>\n' \ '</d:propstat>\n' % key ) else: raise 'Bad Request', 'Invalid request' result.write('</d:response>\n') if depth in ('1', 'infinity') and iscol: for ob in obj.objectValues(): dflag=hasattr(ob, '_p_changed') and (ob._p_changed == None) if hasattr(ob, '__dav_resource__'): uri=os.path.join(url, absattr(ob.id)) depth=depth=='infinity' and depth or 0 self.apply(ob, uri, depth, result, top=0) if dflag: ob._p_deactivate() if not top: return result result.write('</d:multistatus>') return result.getvalue() | dd51a8080733d3cc2744f08686ba282e4b49317b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/dd51a8080733d3cc2744f08686ba282e4b49317b/davcmds.py |
'<d:href>%s</d:href>\n' % url) | '<d:href>%s</d:href>\n' % quote(url)) | def apply(self, obj): url=urlfix(self.request['URL'], 'PROPPATCH') if hasattr(obj, '__dav_collection__'): url=url+'/' result=StringIO() errors=[] result.write('<?xml version="1.0" encoding="utf-8"?>\n' \ '<d:multistatus xmlns:d="DAV:">\n' \ '<d:response>\n' \ '<d:href>%s</d:href>\n' % url) propsets=obj.propertysheets for value in self.values: status='200 OK' if len(value) > 2: name, ns, val, md=value propset=propsets.get(ns, None) if propset is None: propsets.manage_addPropertySheet('', ns) propset=propsets.get(ns) propdict=propset._propdict() if propset.hasProperty(name): try: propset._updateProperty(name, val, meta=md) except: errors.append(str(sys.exc_value)) status='409 Conflict' else: try: propset._setProperty(name, val, meta=md) except: errors.append(str(sys.exc_value)) status='409 Conflict' else: name, ns=value propset=propsets.get(ns, None) if propset is None or not propset.hasProperty(name): errors.append('Property not found: %s' % name) status='404 Not Found' else: try: propset._delProperty(name) except: errors.append('%s cannot be deleted.' % name) status='409 Conflict' if result != '200 OK': abort=1 result.write('<d:propstat xmlns:n="%s">\n' \ ' <d:prop>\n' \ ' <n:%s/>\n' \ ' </d:prop>\n' \ ' <d:status>HTTP/1.1 %s</d:status>\n' \ '</d:propstat>\n' % (ns, name, status)) errmsg=string.join(errors, '\n') or 'The operation succeded.' result.write('<d:responsedescription>\n' \ '%s\n' \ '</d:responsedescription>\n' \ '</d:response>\n' \ '</d:multistatus>' % errmsg) result=result.getvalue() if not errors: return result # This is lame, but I cant find a way to keep ZPublisher # from sticking a traceback into my xml response :( get_transaction().abort() result=string.replace(result, '200 OK', '424 Failed Dependency') return result | dd51a8080733d3cc2744f08686ba282e4b49317b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/dd51a8080733d3cc2744f08686ba282e4b49317b/davcmds.py |
if hasattr(self, 'aq_base') and hasattr(self.aq_base, 'index_html'): | if hasattr(self, 'index_html'): | def HEAD(self, REQUEST, RESPONSE): """Retrieve resource information without a response body.""" self.dav__init(REQUEST, RESPONSE) if hasattr(self, 'aq_base') and hasattr(self.aq_base, 'index_html'): if hasattr(self.index_html, 'HEAD'): return self.index_html.HEAD(REQUEST, RESPONSE) raise 'Method Not Allowed', ( 'Method not supported for this resource.' ) raise 'Not Found', 'The requested resource does not exist.' | 97e3d8562343dbb5e8e14805129c887ed57b9c77 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/97e3d8562343dbb5e8e14805129c887ed57b9c77/Collection.py |
def __str__(self): return self.name | e71adc76453e97819cef8a6aa0f2a7d240bc9c83 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e71adc76453e97819cef8a6aa0f2a7d240bc9c83/User.py |
||
prev_id=Moniker.absattr(obj.id) | try: r=obj.aq_parent._reserved_names except: r=() if prev_id in special: raise 'NotSupported', eNotSupported | def manage_paste(self, moniker, clip_id, REQUEST=None): """ """ | da429ab2d9bbb38922ecd94cd774b331679794dd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/da429ab2d9bbb38922ecd94cd774b331679794dd/CopySupport.py |
if type(keys) is not ListType: keys=[keys] | if type(keys) is type(''): if not keys or not strip(keys): return None keys=[keys] | def _apply_index(self, request, cid='', ListType=[]): | c6fb076591e9ec507cf51843363f406b3b21db9c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/c6fb076591e9ec507cf51843363f406b3b21db9c/TextIndex.py |
return intSet(), (id,) | def _apply_index(self, request, cid='', ListType=[]): | c6fb076591e9ec507cf51843363f406b3b21db9c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/c6fb076591e9ec507cf51843363f406b3b21db9c/TextIndex.py |
|
if password is not None and self.encrypt_passwords: | if password is not None and self.encrypt_passwords \ and not self._isPasswordEncrypted(password): | def _doAddUser(self, name, password, roles, domains, **kw): """Create a new user""" if password is not None and self.encrypt_passwords: password = self._encryptPassword(password) self.data[name]=User(name,password,roles,domains) | 94ef40ee4b2a816ea39b4da68d7bb7d1ef1e83e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/94ef40ee4b2a816ea39b4da68d7bb7d1ef1e83e5/User.py |
try: if hasattr(object,'__bobo_traverse__'): | if hasattr(object,'__bobo_traverse__'): try: | def publishTraverse(self, request, name): object = self.context URL=request['URL'] | f3734c4f7951b5508cd803627891478738f04cd5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/f3734c4f7951b5508cd803627891478738f04cd5/BaseRequest.py |
parents[-1:] = list(subobject[:-1]) object, subobject = subobject[-2:] | request['PARENTS'][-1:] = list(subobject[:-1]) object, subobject = subobject[-2:] except (AttributeError, KeyError, NotFound), e: subobject = queryMultiAdapter((object, request), Interface, name) if subobject is not None: request.response.setStatus(200) return subobject.__of__(object) raise e else: if hasattr(aq_base(object), name): subobject = getattr(object, name) | def publishTraverse(self, request, name): object = self.context URL=request['URL'] | f3734c4f7951b5508cd803627891478738f04cd5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/f3734c4f7951b5508cd803627891478738f04cd5/BaseRequest.py |
if hasattr(aq_base(object), name): subobject = getattr(object, name) else: subobject=object[name] except (AttributeError, KeyError, NotFound), e: subobject = queryMultiAdapter((object, request), Interface, name) if subobject is not None: request.response.setStatus(200) return subobject.__of__(object) | subobject = queryMultiAdapter((object, request), Interface, name) if subobject is not None: return subobject.__of__(object) | def publishTraverse(self, request, name): object = self.context URL=request['URL'] | f3734c4f7951b5508cd803627891478738f04cd5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/f3734c4f7951b5508cd803627891478738f04cd5/BaseRequest.py |
if not hasattr(object,'__bobo_traverse__'): | def publishTraverse(self, request, name): object = self.context URL=request['URL'] | f3734c4f7951b5508cd803627891478738f04cd5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/f3734c4f7951b5508cd803627891478738f04cd5/BaseRequest.py |
|
raise e | subobject = object[name] | def publishTraverse(self, request, name): object = self.context URL=request['URL'] | f3734c4f7951b5508cd803627891478738f04cd5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/f3734c4f7951b5508cd803627891478738f04cd5/BaseRequest.py |
return whrandom.choice(salt_choices) | return whrandom.choice(salt_choices)+whrandom.choice(salt_choices) | def generate_salt(): """Generate a salt value for the crypt function.""" salt_choices = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" \ "abcdefghijklmnopqrstuvwxyz" \ "0123456789./" return whrandom.choice(salt_choices) | 40430ab5f60addf5f55a58de0450eaabcfa0a613 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/40430ab5f60addf5f55a58de0450eaabcfa0a613/zpasswd.py |
""" need to be consistent with the interface """ | """ needed to be consistent with the interface """ | def uniqueValues(self,name=None,withLength=0): """ need to be consistent with the interface """ | 783d0f95f3e77efab631b6fc2335b1f393716e28 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/783d0f95f3e77efab631b6fc2335b1f393716e28/PathIndex.py |
def uniqueValues(self,name=None,withLength=0): """ need to be consistent with the interface """ | 783d0f95f3e77efab631b6fc2335b1f393716e28 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/783d0f95f3e77efab631b6fc2335b1f393716e28/PathIndex.py |
||
def availableSplitter(self): | def availableSplitters(self): | def availableSplitter(self): """ splitter we can add """ return Splitter.availableSplitters | fa6133bc34f4051342345000f969926e3ef7baf7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/fa6133bc34f4051342345000f969926e3ef7baf7/ZCatalog.py |
result=self(REQUEST) | try: result=self(REQUEST) result=custom_default_report(self.id, result) except: result=( '<hr><strong>Error, <em>%s</em>:</strong> %s' % (sys.exc_type, sys.exc_value)) | def manage_test(self, REQUEST): | ad3bca87d90e9aa77e7261ddf70ab15ece9c8509 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/ad3bca87d90e9aa77e7261ddf70ab15ece9c8509/DA.py |
% custom_default_report(self.id, result)) | % result) | def manage_test(self, REQUEST): | ad3bca87d90e9aa77e7261ddf70ab15ece9c8509 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/ad3bca87d90e9aa77e7261ddf70ab15ece9c8509/DA.py |
self._run_check("""<a a.b='v' c:d='v' e-f='v'/>""", [ ("starttag", "a", ["a.b", "v", "c:d", "v", "e-f", "v"]), | self._run_check("""<a a.b='v' e-f='v'/>""", [ ("starttag", "a", ["a.b", "v", "e-f", "v"]), | def check_attr_funky_names(self): self._run_check("""<a a.b='v' c:d='v' e-f='v'/>""", [ ("starttag", "a", ["a.b", "v", "c:d", "v", "e-f", "v"]), ("endtag", "a"), ]) | 8a23bcd019b861672cdb793a324da1154f3aaf66 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/8a23bcd019b861672cdb793a324da1154f3aaf66/test_xmlparser.py |
if v!=key: raise AttributeError, v | if str(v) != key: raise AttributeError, v | def __bobo_traverse__(self, REQUEST, key): name=self._name da=self.__dict__['_da'] args=self._args if name: if args.has_key(name): v=args[name] if type(v) is not ListType: v=[v] v.append(key) key=v | d35d2753d5d5ebbe85f6f05179f3b3c071e1c0a7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/d35d2753d5d5ebbe85f6f05179f3b3c071e1c0a7/DA.py |
def __getitem__(self,index): | 22ca43a2d5ac84f3f411741d7b6cc318a7e2004b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/22ca43a2d5ac84f3f411741d7b6cc318a7e2004b/Zope.py |
||
except 'Unauthorized', vv: | except Unauthorized, vv: | def __getitem__(self,index): | 22ca43a2d5ac84f3f411741d7b6cc318a7e2004b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/22ca43a2d5ac84f3f411741d7b6cc318a7e2004b/Zope.py |
self.title = str(item.children[0]) | self.title = item.children[0].astext() | def render(self): ''' Render the source to HTML ''' # format with strings pub = docutils.core.Publisher() pub.set_reader('standalone', None, 'restructuredtext') pub.set_writer('html') | ab0b7c1d16781cf360dfb3cb1fe4f437397225b0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/ab0b7c1d16781cf360dfb3cb1fe4f437397225b0/ZReST.py |
lg = logger.syslog_logger(string.split(os.environ['ZSYSLOG_SERVER'], ':')) | (addr, port) = string.split(os.environ['ZSYSLOG_SERVER'], ':') lg = logger.syslog_logger((addr, int(port)) | def set_locale(val): try: import locale except: raise SystemExit, ( 'The locale module could not be imported.\n' 'To use localization options, you must ensure\n' 'that the locale module is compiled into your\n' 'Python installation.' ) try: locale.setlocale(locale.LC_ALL, val) except: raise SystemExit, ( 'The specified locale is not supported by your system.\n' 'See your operating system documentation for more\n' 'information on locale support.' ) | 6da1e1f2262ca680c0d548ef28d70b13d643d3b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/6da1e1f2262ca680c0d548ef28d70b13d643d3b9/z2.py |
return '<a href="http://www.zope.org/Credits"><img ' \ | return '<a href="http://www.zope.org/Credits" target="_top"><img ' \ | def ZopeAttributionButton(self): """Returns an HTML fragment that displays the 'powered by zope' button along with a link to the Zope site.""" return '<a href="http://www.zope.org/Credits"><img ' \ 'src="%s/p_/ZopeButton" width="115" height="50" ' \ 'border="0" alt="Powered by Zope"></a>' % self.REQUEST.BASE1 | 6a75bd86f04a234ee4b32a17fd61f0988fe3d8a8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/6a75bd86f04a234ee4b32a17fd61f0988fe3d8a8/Application.py |
if path: path=[script]+path else: path=[script] | if script: path=[script]+path if not path: return '' | 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 path: path=[script]+path else: path=[script] script='' last=path[-1] del path[-1] for p in path: script="%s/%s" % (script, p) out.append('<a href="%s/manage_main">%s</a>' % (script, p)) out.append(last) return join(out,' / ') | ba18308550ff19bbd37afeaa6d7c644b398ff881 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/ba18308550ff19bbd37afeaa6d7c644b398ff881/Management.py |
return parse(text[l:],prefix,result) | return parse(text[l:],result) | def parse(text, result=None, unparmre=regex.compile( '\([\0- ]*\([^\0- =\"]+\)\)'), parmre=regex.compile( '\([\0- ]*\([^\0- =\"]+\)=\([^\0- =\"]+\)\)'), qparmre=regex.compile( '\([\0- ]*\([^\0- =\"]+\)="\([^"]+\)\"\)'), ): if result is None: result = {} __traceback_info__=text if parmre.match(text) >= 0: name=parmre.group(2) value={'default':parmre.group(3)} l=len(parmre.group(1)) elif qparmre.match(text) >= 0: name=qparmre.group(2) value={'default':qparmre.group(3)} l=len(qparmre.group(1)) elif unparmre.match(text) >= 0: name=unparmre.group(2) l=len(unparmre.group(1)) value={} else: if not text or not strip(text): return result raise InvalidParameter, text lt=string.find(name,':') if lt > 0: value['type']=name[lt+1:] name=name[:lt] result[name]=value return parse(text[l:],prefix,result) | bccfdb17be3f5559933a70ca78efbccc71ae1b48 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/bccfdb17be3f5559933a70ca78efbccc71ae1b48/Aqueduct.py |
if hasattr(self.aq_base,'manage_FTPget'): | if hasattr(self.aq_base,'manage_FTPget') and \ hasattr(self.manage_FTPget, '__roles__'): | def manage_FTPstat(self,REQUEST): "psuedo stat, used by FTP for directory listings" from AccessControl.User import nobody mode=0100000 # check read permissions if hasattr(self.aq_base,'manage_FTPget'): if REQUEST['AUTHENTICATED_USER'].allowed(self.manage_FTPget, self.manage_FTPget.__roles__): mode=mode | 0440 if nobody.allowed(self.manage_FTPget, self.manage_FTPget.__roles__): mode=mode | 0004 # check write permissions if hasattr(self.aq_base,'PUT'): if REQUEST['AUTHENTICATED_USER'].allowed(self.PUT, self.PUT.__roles__): mode=mode | 0220 if nobody.allowed(self.PUT, self.PUT.__roles__): mode=mode | 0002 # get size if hasattr(self,'manage_FTPget'): size=len(self.manage_FTPget()) else: size=0 # get modification time mtime=self.bobobase_modification_time().timeTime() return marshal.dumps((mode,0,0,1,0,0,size,mtime,mtime,mtime)) | d6407826189bc19856c4e91520f58e265eda47d4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/d6407826189bc19856c4e91520f58e265eda47d4/SimpleItem.py |
if hasattr(self.aq_base,'PUT'): | if hasattr(self.aq_base,'PUT') and hasattr(self.PUT, '__roles__'): | def manage_FTPstat(self,REQUEST): "psuedo stat, used by FTP for directory listings" from AccessControl.User import nobody mode=0100000 # check read permissions if hasattr(self.aq_base,'manage_FTPget'): if REQUEST['AUTHENTICATED_USER'].allowed(self.manage_FTPget, self.manage_FTPget.__roles__): mode=mode | 0440 if nobody.allowed(self.manage_FTPget, self.manage_FTPget.__roles__): mode=mode | 0004 # check write permissions if hasattr(self.aq_base,'PUT'): if REQUEST['AUTHENTICATED_USER'].allowed(self.PUT, self.PUT.__roles__): mode=mode | 0220 if nobody.allowed(self.PUT, self.PUT.__roles__): mode=mode | 0002 # get size if hasattr(self,'manage_FTPget'): size=len(self.manage_FTPget()) else: size=0 # get modification time mtime=self.bobobase_modification_time().timeTime() return marshal.dumps((mode,0,0,1,0,0,size,mtime,mtime,mtime)) | d6407826189bc19856c4e91520f58e265eda47d4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/d6407826189bc19856c4e91520f58e265eda47d4/SimpleItem.py |
""" underscores in literals shouldn't do unterlining """ | """ underscores in literals shouldn't do underlining """ | def testUnderscoresInLiteral1(self): """ underscores in literals shouldn't do unterlining """ | 3f6e2ae459b5a30ba3ce41daba7d96cdd1fe0431 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/3f6e2ae459b5a30ba3ce41daba7d96cdd1fe0431/testStructuredText.py |
""" underscores in literals shouldn't do unterlining """ | """ underscores in literals shouldn't do underlining """ | def testUnderscoresInLiteral2(self): """ underscores in literals shouldn't do unterlining """ | 3f6e2ae459b5a30ba3ce41daba7d96cdd1fe0431 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/3f6e2ae459b5a30ba3ce41daba7d96cdd1fe0431/testStructuredText.py |
Subsets and Splits