rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
(ts_regex.compile('&'), '&amp;'), (ts_regex.compile("<"), '&lt;' ), (ts_regex.compile(">"), '&gt;' ), (ts_regex.compile('"'), '&quot;'))):
(regex.compile('&'), '&amp;'), (regex.compile("<"), '&lt;' ), (regex.compile(">"), '&gt;' ), (regex.compile('"'), '&quot;') )):
def html_quote(v, character_entities=( (ts_regex.compile('&'), '&amp;'), (ts_regex.compile("<"), '&lt;' ), (ts_regex.compile(">"), '&gt;' ), (ts_regex.compile('"'), '&quot;'))): #" text=str(v) for re,name in character_entities: text=gsub(re,name,text) return text
b0fc40be7f6311ce8b53427d0435318a0e976412 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b0fc40be7f6311ce8b53427d0435318a0e976412/StructuredText.py
if not self._unindex.has_key(id): self._unindex[id] = OOSet() self._unindex[id].insert( (comp,level) )
def insertEntry(self,comp,id,level): """ k is a path component (generated by splitPath() ) v is the documentId level is the level of the component inside the path """
8e8571b5653325f034f965dd369c22564b473ddf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/8e8571b5653325f034f965dd369c22564b473ddf/PathIndex.py
self._length = BTrees.Length.Length()
def __init__(self, vocabulary=None, brains=None): # Catalogs no longer care about vocabularies and lexicons # so the vocabulary argument is ignored. (Casey)
b2b4441820939b3b841e67ac23415ce614428aaa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b2b4441820939b3b841e67ac23415ce614428aaa/Catalog.py
self._length.set(0)
self._length = BTrees.Length.Length()
def clear(self): """ clear catalog """
b2b4441820939b3b841e67ac23415ce614428aaa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b2b4441820939b3b841e67ac23415ce614428aaa/Catalog.py
return self.setBody(
tb=self.setBody(
def exception(self, fatal=0):
72f20540fc3547c58fb79e4ff090792bf0b9a5a5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/72f20540fc3547c58fb79e4ff090792bf0b9a5a5/Response.py
return self.setBody(
tb=self.setBody(
def exception(self, fatal=0):
72f20540fc3547c58fb79e4ff090792bf0b9a5a5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/72f20540fc3547c58fb79e4ff090792bf0b9a5a5/Response.py
if type(b) is not types.StringType or regex.search('[ \t\n]',b) < 0: return self.setBody(
elif type(b) is not types.StringType or regex.search('[a-zA-Z]>',b) < 0: tb=self.setBody(
def exception(self, fatal=0):
72f20540fc3547c58fb79e4ff090792bf0b9a5a5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/72f20540fc3547c58fb79e4ff090792bf0b9a5a5/Response.py
if self.isHTML(b): return self.setBody(b+self._traceback(t,v,tb)) return self.setBody((str(t),b+self._traceback(t,v,tb)))
elif self.isHTML(b): tb=self.setBody(b+self._traceback(t,v,tb)) else: tb=self.setBody((str(t),b+self._traceback(t,v,tb))) return tb
def exception(self, fatal=0):
72f20540fc3547c58fb79e4ff090792bf0b9a5a5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/72f20540fc3547c58fb79e4ff090792bf0b9a5a5/Response.py
'Invalid cookie attribute, %s' % name)
'Invalid cookie attribute, <em>%s</em>' % name)
def _cookie_list(self):
72f20540fc3547c58fb79e4ff090792bf0b9a5a5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/72f20540fc3547c58fb79e4ff090792bf0b9a5a5/Response.py
try: roles=self.__roles__
try: roles=self.aq_self.__roles__
def selectedRoles(self):
d0d9ec96f7c1696daaa9bcc53b7d8d2848f6858c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/d0d9ec96f7c1696daaa9bcc53b7d8d2848f6858c/Role.py
try: del self.__roles__ except: pass
if hasattr(self,'aq_self'): try: del self.aq_self.__roles__ except: pass
def manage_editRoles(self,REQUEST,acl_type='A',acl_roles=[]): """ """
d0d9ec96f7c1696daaa9bcc53b7d8d2848f6858c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/d0d9ec96f7c1696daaa9bcc53b7d8d2848f6858c/Role.py
def oldmanage_editRoles(self,REQUEST,roles=[]): try: del self.__roles__ except: pass if not roles: return self.manage_rolesForm(self,REQUEST) if roles==['Public',]: self.__roles__=None return self.manage_rolesForm(self,REQUEST) if ('Acquire' in roles) or ('Public' in roles): raise 'Bad Request',('<EM>Acquired</EM> and <EM>Public</EM> ' \ 'cannot be combined with other roles!') self.__roles__=roles return self.manage_rolesForm(self,REQUEST)
def oldmanage_editRoles(self,REQUEST,roles=[]):
d0d9ec96f7c1696daaa9bcc53b7d8d2848f6858c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/d0d9ec96f7c1696daaa9bcc53b7d8d2848f6858c/Role.py
try: del self.__roles__ except: pass
if hasattr(self,'aq_self'): try: del self.aq_self.__roles__ except: pass
def _setRoles(self,acl_type,acl_roles):
d0d9ec96f7c1696daaa9bcc53b7d8d2848f6858c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/d0d9ec96f7c1696daaa9bcc53b7d8d2848f6858c/Role.py
def publish(script,path_info,u=None,p=None,d=None,t=None,e={},s=None):
def publish(script,path_info,u=None,p=None,d=None,t=None,e={},s=None,pm=0):
def publish(script,path_info,u=None,p=None,d=None,t=None,e={},s=None): import sys, os, getopt, string profile=p debug=d timeit=t silent=s if not script: script='+Main' if script[0]=='+': script='../../lib/python/'+script[1:] env=e env['SERVER_NAME']='bobo.server' env['SERVER_PORT']='80' env['REQUEST_METHOD']='GET' env['REMOTE_ADDR']='204.183.226.81 ' env['REMOTE_HOST']='bobo.remote.host' env['HTTP_USER_AGENT']='Bobo/%s' % __version__ env['HTTP_HOST']='ninny.digicool.com:8081 ' env['SERVER_SOFTWARE']='Bobo/%s' % __version__ env['SERVER_PROTOCOL']='HTTP/1.0 ' env['HTTP_ACCEPT']='image/gif, image/x-xbitmap, image/jpeg, */* ' env['SERVER_HOSTNAME']='bobo.server.host' env['GATEWAY_INTERFACE']='CGI/1.1 ' env['SCRIPT_NAME']=script p=string.split(path_info,'?') if len(p)==1: env['PATH_INFO'] = p[0] elif len(p)==2: [env['PATH_INFO'], env['QUERY_STRING']]=p else: raise TypeError, '' if u: import base64 env['HTTP_AUTHORIZATION']="Basic %s" % base64.encodestring(u) dir,file=os.path.split(script) cdir=os.path.join(dir,'Components') sys.path[0:0]=[dir,cdir,os.path.join(cdir,sys.platform)] # We delay import to here, in case cgi_module_publisher is part of the # application distribution. from cgi_module_publisher import publish_module if profile: import __main__ __main__.publish_module=publish_module __main__.file=file __main__.env=env print profile publish_module(file, environ=env, stdout=open('/dev/null','w')) c=("for i in range(%s): " "publish_module(file, environ=env, stdout=open('/dev/null','w'))" % repeat_count ) if profile: run(c,profile) else: run(c) elif debug: import cgi_module_publisher from cgi_module_publisher import ModulePublisher import pdb class Pdb(pdb.Pdb): def do_pub(self,arg): if hasattr(self,'done_pub'): print 'pub already done.' else: self.do_s('') self.do_s('') self.do_c('') self.done_pub=1 def do_ob(self,arg): if hasattr(self,'done_ob'): print 'ob already done.' else: self.do_pub('') self.do_c('') self.done_ob=1 import codehack db=Pdb() def fbreak(db,meth,codehack=codehack): try: meth=meth.im_func except AttributeError: pass code=meth.func_code lineno = codehack.getlineno(code) filename = code.co_filename db.set_break(filename,lineno) fbreak(db,ModulePublisher.publish) fbreak(db,ModulePublisher.call_object) #fbreak(db,cgi_module_publisher.new_find_object) #fbreak(db,cgi_module_publisher.old_find_object) dbdata={'breakpoints':(), 'env':env} b='' try: b=open('.bobodb','r').read() except: pass if b: exec b in dbdata for b in dbdata['breakpoints']: if type(b) is type(()): apply(db.set_break,b) else: fbreak(db,b) db.prompt='pdb> ' # db.set_continue() print ( '* Type "s<cr>c<cr>" to jump to beginning of real publishing process.\n' '* Then type c<cr> to jump to the beginning of the URL traversal\n' ' algorithm.\n' '* Then type c<cr> to jump to published object call.' ) db.run('publish_module(file,environ=env,debug=1)', cgi_module_publisher.__dict__, {'file':file, 'env':env}) elif timeit: stdout=sys.stdout t= time(publish_module,file, stdout=open('/dev/null','w'), environ=env) stdout.write('%s milliseconds\n' % t) else: if silent: stdout=open('/dev/null','w') else: stdout=sys.stdout publish_module(file, environ=env, stdout=stdout) print '\n%s\n' % ('_'*60)
4ceb750ab28fc81faa3c553d6262754c4e316458 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4ceb750ab28fc81faa3c553d6262754c4e316458/Test.py
if Globals.DatabaseVersion!='3': return
if not dbVersionEquals('3'): return
def changeClassId(self, newid=None): if Globals.DatabaseVersion!='3': return if newid is None: newid=self._new_class_id() self._unregister() if newid: if not newid[:1] == '*': newid='*'+newid self.setClassAttr('__module__', newid) self._register()
bacc1f0af392a63a114390d006b7582caf145b78 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/bacc1f0af392a63a114390d006b7582caf145b78/ZClass.py
if Globals.DatabaseVersion!='3': return
if not dbVersionEquals('3'): return
def _register(self): if Globals.DatabaseVersion!='3': return z=self._zclass_ class_id=z.__module__ if not class_id: return
bacc1f0af392a63a114390d006b7582caf145b78 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/bacc1f0af392a63a114390d006b7582caf145b78/ZClass.py
if Globals.DatabaseVersion!='3': return
if not dbVersionEquals('3'): return
def _unregister(self): if Globals.DatabaseVersion!='3': return class_id=self._zclass_.__module__ if not class_id: return globals=self._p_jar.root()['ZGlobals'] if globals.has_key(class_id): del globals[class_id]
bacc1f0af392a63a114390d006b7582caf145b78 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/bacc1f0af392a63a114390d006b7582caf145b78/ZClass.py
def _unregister(self): if Globals.DatabaseVersion!='3': return class_id=self._zclass_.__module__ if not class_id: return globals=self._p_jar.root()['ZGlobals'] if globals.has_key(class_id): del globals[class_id]
bacc1f0af392a63a114390d006b7582caf145b78 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/bacc1f0af392a63a114390d006b7582caf145b78/ZClass.py
if Globals.DatabaseVersion!='3': return
if not dbVersionEquals('3'): return
def manage_afterAdd(self, item, container): if Globals.DatabaseVersion!='3': return if not self._zclass_.__module__: self.setClassAttr('__module__', self._new_class_id()) self._register() self.propertysheets.methods.manage_afterAdd(item, container)
bacc1f0af392a63a114390d006b7582caf145b78 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/bacc1f0af392a63a114390d006b7582caf145b78/ZClass.py
if Globals.DatabaseVersion!='3': return
if not dbVersionEquals('3'): return
def manage_beforeDelete(self, item, container): if Globals.DatabaseVersion!='3': return self._unregister() self.propertysheets.methods.manage_beforeDelete(item, container)
bacc1f0af392a63a114390d006b7582caf145b78 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/bacc1f0af392a63a114390d006b7582caf145b78/ZClass.py
if rawdata[j:j+2] == "/>": return j + 2
if next == "/": s = rawdata[j:j+2] if s == "/>": return j + 2 if s == "/": return -1 self.updatepos(i, j + 1) raise HTMLParseError("malformed empty start tag", self.getpos())
def check_for_whole_start_tag(self, i): rawdata = self.rawdata m = locatestarttagend.match(rawdata, i) if m: j = m.end() next = rawdata[j:j+1] if next == ">": return j + 1 if rawdata[j:j+2] == "/>": return j + 2 if next == "": # end of input return -1 if next in ("abcdefghijklmnopqrstuvwxyz=" "ABCDEFGHIJKLMNOPQRSTUVWXYZ"): # end of input in or before attribute value return -1 self.updatepos(i, j) raise HTMLParseError("malformed start tag", self.getpos()) raise AssertionError("we should not gt here!")
1ca0eb845dc915d9ce5dc80795f67a4fc940a0eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/1ca0eb845dc915d9ce5dc80795f67a4fc940a0eb/HTMLParser.py
if next in ("abcdefghijklmnopqrstuvwxyz="
if next in ("abcdefghijklmnopqrstuvwxyz=/"
def check_for_whole_start_tag(self, i): rawdata = self.rawdata m = locatestarttagend.match(rawdata, i) if m: j = m.end() next = rawdata[j:j+1] if next == ">": return j + 1 if rawdata[j:j+2] == "/>": return j + 2 if next == "": # end of input return -1 if next in ("abcdefghijklmnopqrstuvwxyz=" "ABCDEFGHIJKLMNOPQRSTUVWXYZ"): # end of input in or before attribute value return -1 self.updatepos(i, j) raise HTMLParseError("malformed start tag", self.getpos()) raise AssertionError("we should not gt here!")
1ca0eb845dc915d9ce5dc80795f67a4fc940a0eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/1ca0eb845dc915d9ce5dc80795f67a4fc940a0eb/HTMLParser.py
def check_for_whole_start_tag(self, i): rawdata = self.rawdata m = locatestarttagend.match(rawdata, i) if m: j = m.end() next = rawdata[j:j+1] if next == ">": return j + 1 if rawdata[j:j+2] == "/>": return j + 2 if next == "": # end of input return -1 if next in ("abcdefghijklmnopqrstuvwxyz=" "ABCDEFGHIJKLMNOPQRSTUVWXYZ"): # end of input in or before attribute value return -1 self.updatepos(i, j) raise HTMLParseError("malformed start tag", self.getpos()) raise AssertionError("we should not gt here!")
1ca0eb845dc915d9ce5dc80795f67a4fc940a0eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/1ca0eb845dc915d9ce5dc80795f67a4fc940a0eb/HTMLParser.py
Shared.DC.xml.xmllib.XMLParser.__init__(self) self.root=None self.node=None
pass
def __init__(self): Shared.DC.xml.xmllib.XMLParser.__init__(self) self.root=None self.node=None
e4679cb4de3e61d889e778f09116cd5b6da0fcf9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e4679cb4de3e61d889e778f09116cd5b6da0fcf9/xmltools.py
if not data.startswith("<?xml"): data = '<?xml version="1.0" ?>\n' + data self.feed(data) self.close() return self.root def add(self, node): self.node.addNode(node) def push(self, node): self.node.addNode(node) self.node=self.node.__nodes__[-1] def pop(self): self.node=self.node.aq_parent def unknown_starttag(self, name, attrs): node=Element(name, attrs) self.push(node) self.node.fixup() def unknown_endtag(self, name): self.pop() def handle_xml(self, encoding, stdalone): self.root=Document(encoding, stdalone) self.node=self.root def handle_doctype(self, tag, pubid, syslit, data): pass def handle_entity(self, name, strval, pubid, syslit, ndata): self.add(Entity(name, strval, pubid, syslit, ndata)) def handle_cdata(self, data): self.add(CData(data)) def handle_proc(self, name, data): self.add(ProcInst(name, data)) def handle_comment(self, data): self.add(Comment(data)) def handle_data(self, data): self.add(Text(data)) def unknown_entityref(self, data): self.add(EntityRef(data)) def escape(data, rmap={}): data=data.replace( "&", "&amp;") data=data.replace( "<", "&lt;") data=data.replace( ">", "&gt;") for key, val in rmap.items(): data=data.replace( key, val) return data def remap(data, dict={'DAV:': 'd'}): root=XmlParser().parse(data) root.elements()[0].remap(dict, 0) return root.toxml()
self.dom=minidom.parseString(data) return Node(self.dom)
def parse(self, data): # prepending a XML preample to make xmllib happy # (Collector #863) if not data.startswith("<?xml"): data = '<?xml version="1.0" ?>\n' + data self.feed(data) self.close() return self.root
e4679cb4de3e61d889e778f09116cd5b6da0fcf9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e4679cb4de3e61d889e778f09116cd5b6da0fcf9/xmltools.py
manage_workspace__roles__=('Anonymous',)
manage_workspace__roles__=('Authenticated',)
def filtered_manage_options(self, REQUEST=None):
4ffa7ebb313d6db69f04197aa4804a104044af33 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4ffa7ebb313d6db69f04197aa4804a104044af33/Management.py
from AccessControl.User import nobody if aq_base(getSecurityManager().getUser()) is aq_base(nobody): raise 'Unauthorized', ( 'You are not authorized to view this object.')
def manage_workspace(self, REQUEST): """Dispatch to first interface in manage_options """ from AccessControl.User import nobody if aq_base(getSecurityManager().getUser()) is aq_base(nobody): # No authentication credentials presented. raise 'Unauthorized', ( 'You are not authorized to view this object.') options=self.filtered_manage_options(REQUEST) try: m=options[0]['action'] if m=='manage_workspace': raise TypeError except: raise 'Unauthorized', ( 'You are not authorized to view this object.<p>')
4ffa7ebb313d6db69f04197aa4804a104044af33 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4ffa7ebb313d6db69f04197aa4804a104044af33/Management.py
def manage_cutObjects(self, ids, REQUEST=None):
def manage_cutObjects(self, ids=None, REQUEST=None):
def manage_cutObjects(self, ids, REQUEST=None): """Put a reference to the objects named in ids in the clip board""" if type(ids) is type(''): ids=[ids] oblist=[] for id in ids: ob=self._getOb(id) if not ob.cb_isMoveable(): raise CopyError, eNotSupported % id m=Moniker.Moniker(ob) oblist.append(m.dump()) cp=(1, oblist) cp=_cb_encode(cp) if REQUEST is not None: resp=REQUEST['RESPONSE'] resp.setCookie('__cp', cp, path='%s' % REQUEST['SCRIPT_NAME']) return self.manage_main(self, REQUEST, cb_dataValid=1) return cp
899adda86e50259921f0b5cbc127d19326f9a32d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/899adda86e50259921f0b5cbc127d19326f9a32d/CopySupport.py
def manage_copyObjects(self, ids, REQUEST=None, RESPONSE=None):
def manage_copyObjects(self, ids=None, REQUEST=None, RESPONSE=None):
def manage_copyObjects(self, ids, REQUEST=None, RESPONSE=None): """Put a reference to the objects named in ids in the clip board""" if type(ids) is type(''): ids=[ids] oblist=[] for id in ids: ob=self._getOb(id) if not ob.cb_isCopyable(): raise CopyError, eNotSupported % id m=Moniker.Moniker(ob) oblist.append(m.dump()) cp=(0, oblist) cp=_cb_encode(cp) if REQUEST is not None: resp=REQUEST['RESPONSE'] resp.setCookie('__cp', cp, path='%s' % REQUEST['SCRIPT_NAME']) return self.manage_main(self, REQUEST, cb_dataValid=1) return cp
899adda86e50259921f0b5cbc127d19326f9a32d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/899adda86e50259921f0b5cbc127d19326f9a32d/CopySupport.py
return []
return ['Shared']
def getRoles(self):
389b31e02a899905308f14eb939a696dcaac04d3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/389b31e02a899905308f14eb939a696dcaac04d3/Role.py
(path and hasattr(self.aq_explicit, path[-1])) ):
(path and hasattr(self.aq_base, path[-1])) ):
def __before_publishing_traverse__(self, self2, request): path = request['TraversalRequestNameStack'] names = self.getBindingAssignments() if (not names.isNameAssigned('name_subpath') or (path and hasattr(self.aq_explicit, path[-1])) ): return subpath = path[:] path[:] = [] subpath.reverse() request.set('traverse_subpath', subpath)
408741a21695c0601c85bd182919ac4679f16f01 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/408741a21695c0601c85bd182919ac4679f16f01/Bindings.py
def constructSessionDataManager(self, id, title='', path=None, automatic=None,
def constructSessionDataManager(self, id, title='', path=None, requestName=None,
def constructSessionDataManager(self, id, title='', path=None, automatic=None, REQUEST=None): """ """ ob = SessionDataManager(id, path, title, automatic) self._setObject(id, ob) if REQUEST is not None: return self.manage_main(self, REQUEST, update_menu=1)
19985ee3fa2b5130bfb09a7ea7bf8aa014e8257c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/19985ee3fa2b5130bfb09a7ea7bf8aa014e8257c/SessionDataManager.py
ob = SessionDataManager(id, path, title, automatic)
ob = SessionDataManager(id, path, title, requestName)
def constructSessionDataManager(self, id, title='', path=None, automatic=None, REQUEST=None): """ """ ob = SessionDataManager(id, path, title, automatic) self._setObject(id, ob) if REQUEST is not None: return self.manage_main(self, REQUEST, update_menu=1)
19985ee3fa2b5130bfb09a7ea7bf8aa014e8257c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/19985ee3fa2b5130bfb09a7ea7bf8aa014e8257c/SessionDataManager.py
def __init__(self, id, path=None, title='', automatic=None):
def __init__(self, id, path=None, title='', requestName=None):
def __init__(self, id, path=None, title='', automatic=None): self.id = id self.setContainerPath(path) self.setTitle(title)
19985ee3fa2b5130bfb09a7ea7bf8aa014e8257c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/19985ee3fa2b5130bfb09a7ea7bf8aa014e8257c/SessionDataManager.py
if automatic: self._requestSessionName='SESSION'
if requestName: self._requestSessionName=requestName
def __init__(self, id, path=None, title='', automatic=None): self.id = id self.setContainerPath(path) self.setTitle(title)
19985ee3fa2b5130bfb09a7ea7bf8aa014e8257c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/19985ee3fa2b5130bfb09a7ea7bf8aa014e8257c/SessionDataManager.py
def manage_changeSDM(self, title, path=None, automatic=None, REQUEST=None):
def manage_changeSDM(self, title, path=None, requestName=None, REQUEST=None):
def manage_changeSDM(self, title, path=None, automatic=None, REQUEST=None): """ """ self.setContainerPath(path) self.setTitle(title) if automatic: self.updateTraversalData('SESSION') else: self.updateTraversalData(None) if REQUEST is not None: return self.manage_sessiondatamgr(self, REQUEST)
19985ee3fa2b5130bfb09a7ea7bf8aa014e8257c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/19985ee3fa2b5130bfb09a7ea7bf8aa014e8257c/SessionDataManager.py
if automatic: self.updateTraversalData('SESSION')
if requestName: self.updateTraversalData(requestName)
def manage_changeSDM(self, title, path=None, automatic=None, REQUEST=None): """ """ self.setContainerPath(path) self.setTitle(title) if automatic: self.updateTraversalData('SESSION') else: self.updateTraversalData(None) if REQUEST is not None: return self.manage_sessiondatamgr(self, REQUEST)
19985ee3fa2b5130bfb09a7ea7bf8aa014e8257c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/19985ee3fa2b5130bfb09a7ea7bf8aa014e8257c/SessionDataManager.py
security.declareProtected(MGMT_SCREEN_PERM, 'getAutomatic') def getAutomatic(self): """ """ if hasattr(self,'_hasTraversalHook'): return 1 return 0
security.declareProtected(MGMT_SCREEN_PERM, 'getrequestName') def getrequestName(self): """ """ return self._requestSessionName or ''
def _getSessionDataContainer(self): """ Do not cache the results of this call. Doing so breaks the transactions for mounted storages. """ if self.obpath is None: err = 'Session data container is unspecified in %s' % self.getId() if DEBUG: LOG('Session Tracking', 0, err) raise SessionIdManagerErr, err # return an external data container try: # This should arguably use restrictedTraverse, but it # currently fails for mounted storages. This might # be construed as a security hole, albeit a minor one. # unrestrictedTraverse is also much faster. if DEBUG and not hasattr(self, '_v_wrote_dc_type'): args = string.join(self.obpath, '/') LOG('Session Tracking', 0, 'External data container at %s in use' % args) self._v_wrote_dc_type = 1 return self.unrestrictedTraverse(self.obpath) except: raise SessionDataManagerErr, ( "External session data container '%s' not found." % string.join(self.obpath,'/') )
19985ee3fa2b5130bfb09a7ea7bf8aa014e8257c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/19985ee3fa2b5130bfb09a7ea7bf8aa014e8257c/SessionDataManager.py
for path in self.path2docid.keys(f.name):
for path in list(self.path2docid.keys(f.name)):
def updatefolder(self, f, msgs): self.watchfolders[f.name] = self.getmtime(f.name) for n in msgs: path = "%s/%s" % (f.name, n) docid = self.path2docid.get(path, 0) if docid and self.getmtime(path) == self.doctimes.get(docid, 0): print "unchanged", docid, path continue docid = self.newdocid(path) try: m = f.openmessage(n) except IOError: print "disappeared", docid, path self.unindexpath(path) continue text = self.getmessagetext(m, f.name) if not text: self.unindexpath(path) continue print "indexing", docid, path self.index.index_text(docid, text) self.maycommit() # Remove messages from the folder that no longer exist for path in self.path2docid.keys(f.name): if not path.startswith(f.name + "/"): break if self.getmtime(path) == 0: self.unindexpath(path) print "done."
0fe8faf6e361d654829e74e2f1badf074767a09c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/0fe8faf6e361d654829e74e2f1badf074767a09c/mhindex.py
(('&'), '&amp;'), (("<"), '&lt;' ), ((">"), '&gt;' ), (('"'), '&quot;'))):
(('&'), '&amp;'), (('<'), '&lt;' ), (('>'), '&gt;' ), (('\213'), '&lt;' ), (('\233'), '&gt;' ), (('"'), '&quot;'))):
def html_quote(v, name='(Unknown name)', md={}, character_entities=( (('&'), '&amp;'), (("<"), '&lt;' ), ((">"), '&gt;' ), (('"'), '&quot;'))): #" text=str(v) for re,name in character_entities: if find(text, re) >= 0: text=join(split(text,re),name) return text
c54a17e081b2c9bfc73dada35790cfbbd3979739 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/c54a17e081b2c9bfc73dada35790cfbbd3979739/DT_Util.py
def _roles_debug(self,hier,expected_roles,got_roles):
def _roles_debug(self,hier,got_roles,expected_roles):
def _roles_debug(self,hier,expected_roles,got_roles):
6c1d1cbb18a3f55e249a369072946227f2310f32 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/6c1d1cbb18a3f55e249a369072946227f2310f32/SecurityBase.py
r=apply(HTML.__call__, (self, self, REQUEST), kw)
r=apply(HTML.__call__, (self, bself, REQUEST), kw)
def __call__(self, client=None, REQUEST={}, RESPONSE=None, **kw): """Render the document given a client object, REQUEST mapping, Response, and key word arguments.""" kw['document_id'] =self.id kw['document_title']=self.title if client is None: # Called as subtemplate, so don't need error propigation! r=apply(HTML.__call__, (self, self, REQUEST), kw) if RESPONSE is None: return r return decapitate(r, RESPONSE) try: r=apply(HTML.__call__, (self, (client, self), REQUEST), kw) except: if self.id()=='standard_error_message': raise sys.exc_type, sys.exc_value, sys.exc_traceback return self.raise_standardErrorMessage(client, REQUEST) if RESPONSE is None: return r RESPONSE.setHeader('Last-Modified', rfc1123_date(self._p_mtime)) return decapitate(r, RESPONSE)
9e5ac014324461bb9c09c9fd86425a5cae06e065 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/9e5ac014324461bb9c09c9fd86425a5cae06e065/DTMLDocument.py
try: r=apply(HTML.__call__, (self, (client, self), REQUEST), kw)
try: r=apply(HTML.__call__, (self, (client, bself), REQUEST), kw)
def __call__(self, client=None, REQUEST={}, RESPONSE=None, **kw): """Render the document given a client object, REQUEST mapping, Response, and key word arguments.""" kw['document_id'] =self.id kw['document_title']=self.title if client is None: # Called as subtemplate, so don't need error propigation! r=apply(HTML.__call__, (self, self, REQUEST), kw) if RESPONSE is None: return r return decapitate(r, RESPONSE) try: r=apply(HTML.__call__, (self, (client, self), REQUEST), kw) except: if self.id()=='standard_error_message': raise sys.exc_type, sys.exc_value, sys.exc_traceback return self.raise_standardErrorMessage(client, REQUEST) if RESPONSE is None: return r RESPONSE.setHeader('Last-Modified', rfc1123_date(self._p_mtime)) return decapitate(r, RESPONSE)
9e5ac014324461bb9c09c9fd86425a5cae06e065 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/9e5ac014324461bb9c09c9fd86425a5cae06e065/DTMLDocument.py
' - %s [%s] "%s" %d %d "%s" "%s"\n' % (
'- %s [%s] "%s" %d %d "%s" "%s"\n' % (
def log (self, bytes): user_agent=self.get_header('user-agent') if not user_agent: user_agent='' referer=self.get_header('referer') if not referer: referer='' auth=self.get_header('Authorization') name='Anonymous' if auth is not None: if string.lower(auth[:6]) == 'basic ': try: decoded=base64.decodestring(auth[6:]) except base64.binascii.Error: decoded='' t = string.split(decoded, ':', 1) if len(t) < 2: name = 'Unknown (bad auth string)' else: name = t[0]
b283c1e90d54941e1e19374579b336409ce9f13d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b283c1e90d54941e1e19374579b336409ce9f13d/http_server.py
try: _localzone =_cache._zmap[lower(tzname[0])] except: _localzone=''
try: _localzone=_cache._zmap[lower(tzname[0])] except: try: t=time() localzone=mktime(gmtime(t))-t localzone=int(round(-localzone/(60*60))) if localzone >= 0: zn='+%d' % localzone else: lz=str(localzone) _localzone=_cache._zmap[lower('GMT%s' % lz)] except: _localzone=''
def __init__(self,*args): """Return a new date-time object
cbbac0098713fd4c6c3244cebb19ed1e2cf68de3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cbbac0098713fd4c6c3244cebb19ed1e2cf68de3/DateTime.py
security.declareProtected('Edit ReStructuredText', 'manage_editForm')
security.declareProtected('Edit ReStructuredText', 'manage_main')
def source_txt(self, REQUEST=None): ''' Getting the source text ''' REQUEST.RESPONSE.setHeader('content-type', 'text/plain; charset=%s' % self.input_encoding) return self.source
26fe0868f0b7fe5683736782f5318b7100fadae9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/26fe0868f0b7fe5683736782f5318b7100fadae9/ZReST.py
if unicode and is8bit(data):
if unicode and encoding and is8bit(data):
def _decode(data, encoding, is8bit=re.compile("[\x80-\xff]").search): # decode non-ascii string (if possible) if unicode and is8bit(data): data = unicode(data, encoding) return data
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
__version__ = "0.9.9"
def escape(s, replace=string.replace): s = replace(s, "&", "&amp;") s = replace(s, "<", "&lt;") return replace(s, ">", "&gt;",) MAXINT = 2L**31-1 MININT = -2L**31 if unicode: def _stringify(string): try: return str(string) except UnicodeError: return string else: def _stringify(string): return string __version__ = "1.0.0"
def _decode(data, encoding, is8bit=re.compile("[\x80-\xff]").search): # decode non-ascii string (if possible) if unicode and is8bit(data): data = unicode(data, encoding) return data
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
class Error: pass
class Error(Exception): """Base class for client errors.""" def __str__(self): return repr(self)
def _decode(data, encoding, is8bit=re.compile("[\x80-\xff]").search): # decode non-ascii string (if possible) if unicode and is8bit(data): data = unicode(data, encoding) return data
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
"""Indicates an HTTP protocol error."""
def _decode(data, encoding, is8bit=re.compile("[\x80-\xff]").search): # decode non-ascii string (if possible) if unicode and is8bit(data): data = unicode(data, encoding) return data
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
"""Indicates a broken response package."""
def __repr__(self): return ( "<ProtocolError for %s: %s %s>" % (self.url, self.errcode, self.errmsg) )
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
"""Indicates an XML-RPC fault package."""
def __repr__(self): return ( "<ProtocolError for %s: %s %s>" % (self.url, self.errcode, self.errmsg) )
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
def __repr__(self): return ( "<Fault %s: %s>" % (self.faultCode, repr(self.faultString)) )
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
def __repr__(self): return ( "<Fault %s: %s>" % (self.faultCode, repr(self.faultString)) )
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
"""Convert any Python value to XML-RPC 'boolean'."""
def boolean(value, truefalse=(False, True)): # convert any Python value to XML-RPC boolean return truefalse[operator.truth(value)]
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
def boolean(value, truefalse=(False, True)): # convert any Python value to XML-RPC boolean return truefalse[operator.truth(value)]
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
def datetime(data): value = DateTime() value.decode(data) return value
def encode(self, out): out.write("<value><dateTime.iso8601>") out.write(self.value) out.write("</dateTime.iso8601></value>\n")
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
def encode(self, out): import base64, StringIO out.write("<value><base64>\n") base64.encode(StringIO.StringIO(self.data), out) out.write("</base64></value>\n")
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
if sgmlop: class FastParser:
try: import _xmlrpclib FastParser = _xmlrpclib.Parser FastUnmarshaller = _xmlrpclib.Unmarshaller except (AttributeError, ImportError): FastParser = FastUnmarshaller = None try: import sgmlop if not hasattr(sgmlop, "XMLParser"): raise ImportError except ImportError: SgmlopParser = None else: class SgmlopParser:
def encode(self, out): import base64, StringIO out.write("<value><base64>\n") base64.encode(StringIO.StringIO(self.data), out) out.write("</base64></value>\n")
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
FastParser = None class SlowParser(xmllib.XMLParser):
class ExpatParser: def __init__(self, target): self._parser = parser = expat.ParserCreate(None, None) self._target = target parser.StartElementHandler = target.start parser.EndElementHandler = target.end parser.CharacterDataHandler = target.data encoding = None if not parser.returns_unicode: encoding = "utf-8" target.xml(encoding, None) def feed(self, data): self._parser.Parse(data, 0) def close(self): self._parser.Parse("", 1) del self._target, self._parser class SlowParser: """Default XML parser (based on xmllib.XMLParser)."""
def handle_entityref(self, entity): # <string> entity try: self.handle_data(self.entity[entity]) except KeyError: self.handle_data("&%s;" % entity)
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
xmllib.XMLParser.__init__(self)
try: xmllib.XMLParser.__init__(self, accept_utf8=1) except TypeError: xmllib.XMLParser.__init__(self)
def __init__(self, target): self.handle_xml = target.xml self.unknown_starttag = target.start self.handle_data = target.data self.unknown_endtag = target.end xmllib.XMLParser.__init__(self)
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
"""Generate an XML-RPC params chunk from a Python data structure"""
"""Generate an XML-RPC params chunk from a Python data structure. Create a Marshaller instance for each set of parameters, and use the "dumps" method to convert your data (represented as a tuple) to an XML-RPC params chunk. To write a fault response, pass a Fault instance instead. You may prefer to use the "dumps" module function for this purpose. """
def __init__(self, target): self.handle_xml = target.xml self.unknown_starttag = target.start self.handle_data = target.data self.unknown_endtag = target.end xmllib.XMLParser.__init__(self)
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
self.write("<value><double>%s</double></value>\n" % value)
self.write("<value><double>%s</double></value>\n" % repr(value))
def dump_double(self, value): self.write("<value><double>%s</double></value>\n" % value)
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
def dump_string(self, value):
def dump_string(self, value, escape=escape):
def dump_string(self, value): self.write("<value><string>%s</string></value>\n" % escape(value))
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
def dump_unicode(self, value):
def dump_unicode(self, value, escape=escape):
def dump_unicode(self, value): value = value.encode(self.encoding) self.write("<value><string>%s</string></value>\n" % escape(value))
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
def container(self, value):
def opencontainer(self, value):
def container(self, value): if value: i = id(value) if self.memo.has_key(i): raise TypeError, "cannot marshal recursive data structures" self.memo[i] = None
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
self.container(value)
self.opencontainer(value)
def dump_array(self, value): self.container(value) write = self.write write("<value><array><data>\n") for v in value: self.__dump(v) write("</data></array></value>\n")
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
self.__dump(v)
dump(v)
def dump_array(self, value): self.container(value) write = self.write write("<value><array><data>\n") for v in value: self.__dump(v) write("</data></array></value>\n")
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
def dump_struct(self, value): self.container(value)
def dump_struct(self, value, escape=escape): self.opencontainer(value)
def dump_struct(self, value): self.container(value) write = self.write write("<value><struct>\n") for k, v in value.items(): write("<member>\n") if type(k) is not StringType: raise TypeError, "dictionary key must be string" write("<name>%s</name>\n" % escape(k)) self.__dump(v) write("</member>\n") write("</struct></value>\n")
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
self.__dump(v)
dump(v)
def dump_struct(self, value): self.container(value) write = self.write write("<value><struct>\n") for k, v in value.items(): write("<member>\n") if type(k) is not StringType: raise TypeError, "dictionary key must be string" write("<name>%s</name>\n" % escape(k)) self.__dump(v) write("</member>\n") write("</struct></value>\n")
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
"""Unmarshal an XML-RPC response, based on incoming XML event messages (start, data, end). Call close() to get the resulting data structure. Note that this reader is fairly tolerant, and gladly accepts bogus XML-RPC data without complaining (but not bogus XML). """
def dump_instance(self, value): # check for special wrappers if value.__class__ in WRAPPERS: value.encode(self) else: # store instance attributes as a struct (really?) self.dump_struct(value.__dict__)
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
self._encoding = encoding or "utf-8"
self._encoding = encoding
def xml(self, encoding, standalone): self._encoding = encoding or "utf-8" # FIXME: assert standalone == 1 ???
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
if tag in ("array", "struct"):
if tag == "array" or tag == "struct":
def start(self, tag, attrs): # prepare to handle this element if tag in ("array", "struct"): self._marks.append(len(self._stack)) self._data = [] self._value = (tag == "value")
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
dispatch = {} def end(self, tag):
def end(self, tag, join=string.join):
def data(self, text): self._data.append(text)
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
return f(self)
return f(self, join(self._data, "")) def end_dispatch(self, tag, data): try: f = self.dispatch[tag] except KeyError: pass else: return f(self, data)
def end(self, tag): # call the appropriate end tag handler try: f = self.dispatch[tag] except KeyError: pass # unknown tag ? else: return f(self)
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
def end_boolean(self, join=string.join): value = join(self._data, "") if value == "0":
dispatch = {} def end_boolean(self, data): if data == "0":
def end_boolean(self, join=string.join): value = join(self._data, "") if value == "0": self.append(False) elif value == "1": self.append(True) else: raise TypeError, "bad boolean value" self._value = 0
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
elif value == "1":
elif data == "1":
def end_boolean(self, join=string.join): value = join(self._data, "") if value == "0": self.append(False) elif value == "1": self.append(True) else: raise TypeError, "bad boolean value" self._value = 0
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
def end_int(self, join=string.join): self.append(int(join(self._data, "")))
def end_int(self, data): self.append(int(data))
def end_int(self, join=string.join): self.append(int(join(self._data, ""))) self._value = 0
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
def end_double(self, join=string.join): self.append(float(join(self._data, "")))
def end_double(self, data): self.append(float(data))
def end_double(self, join=string.join): self.append(float(join(self._data, ""))) self._value = 0
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
def end_string(self, join=string.join): data = join(self._data, "")
def end_string(self, data):
def end_string(self, join=string.join): data = join(self._data, "") if self._encoding: data = _decode(data, self._encoding) self.append(data) self._value = 0
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
self.append(data)
self.append(_stringify(data))
def end_string(self, join=string.join): data = join(self._data, "") if self._encoding: data = _decode(data, self._encoding) self.append(data) self._value = 0
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
def end_array(self):
def end_array(self, data):
def end_array(self): mark = self._marks[-1] del self._marks[-1] # map arrays to Python lists self._stack[mark:] = [self._stack[mark:]] self._value = 0
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
def end_struct(self):
def end_struct(self, data):
def end_struct(self): mark = self._marks[-1] del self._marks[-1] # map structs to Python dictionaries dict = {} items = self._stack[mark:] for i in range(0, len(items), 2): dict[items[i]] = items[i+1] self._stack[mark:] = [dict] self._value = 0
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
dict[items[i]] = items[i+1]
dict[_stringify(items[i])] = items[i+1]
def end_struct(self): mark = self._marks[-1] del self._marks[-1] # map structs to Python dictionaries dict = {} items = self._stack[mark:] for i in range(0, len(items), 2): dict[items[i]] = items[i+1] self._stack[mark:] = [dict] self._value = 0
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
def end_base64(self, join=string.join):
def end_base64(self, data):
def end_base64(self, join=string.join): value = Binary() value.decode(join(self._data, "")) self.append(value) self._value = 0
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
value.decode(join(self._data, ""))
value.decode(data)
def end_base64(self, join=string.join): value = Binary() value.decode(join(self._data, "")) self.append(value) self._value = 0
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
def end_dateTime(self, join=string.join):
def end_dateTime(self, data):
def end_dateTime(self, join=string.join): value = DateTime() value.decode(join(self._data, "")) self.append(value)
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
value.decode(join(self._data, ""))
value.decode(data)
def end_dateTime(self, join=string.join): value = DateTime() value.decode(join(self._data, "")) self.append(value)
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
def end_value(self):
def end_value(self, data):
def end_value(self): # if we stumble upon an value element with no internal # elements, treat it as a string element if self._value: self.end_string()
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
self.end_string()
self.end_string(data)
def end_value(self): # if we stumble upon an value element with no internal # elements, treat it as a string element if self._value: self.end_string()
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
def end_params(self):
def end_params(self, data):
def end_params(self): self._type = "params"
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
def end_fault(self):
def end_fault(self, data):
def end_fault(self): self._type = "fault"
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
def end_methodName(self, join=string.join): data = join(self._data, "")
def end_methodName(self, data):
def end_methodName(self, join=string.join): data = join(self._data, "") if self._encoding: data = _decode(data, self._encoding) self._methodname = data
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
Create an instance of the fastest available parser, and attach it to an unmarshalling object. Return both objects.
Create an instance of the fastest available parser, and attach it to an unmarshalling object. Return both objects.
def getparser(): """getparser() -> parser, unmarshaller Create an instance of the fastest available parser, and attach it to an unmarshalling object. Return both objects. """ target = Unmarshaller() if FastParser: return FastParser(target), target return SlowParser(target), target
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
target = Unmarshaller() if FastParser: return FastParser(target), target return SlowParser(target), target
if FastParser and FastUnmarshaller: target = FastUnmarshaller(True, False, binary, datetime) parser = FastParser(target) else: target = Unmarshaller() if FastParser: parser = FastParser(target) elif SgmlopParser: parser = SgmlopParser(target) elif ExpatParser: parser = ExpatParser(target) else: parser = SlowParser(target) return parser, target
def getparser(): """getparser() -> parser, unmarshaller Create an instance of the fastest available parser, and attach it to an unmarshalling object. Return both objects. """ target = Unmarshaller() if FastParser: return FastParser(target), target return SlowParser(target), target
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
Convert a tuple or a fault object to an XML-RPC request (or response, if the methodsresponse option is used). In addition to the data object, the following options can be given as keyword arguments:
Convert an argument tuple or a Fault instance to an XML-RPC request (or response, if the methodresponse option is used). In addition to the data object, the following options can be given as keyword arguments:
def dumps(params, methodname=None, methodresponse=None, encoding=None): """data [,options] -> marshalled data Convert a tuple or a fault object to an XML-RPC request (or response, if the methodsresponse option is used). In addition to the data object, the following options can be given as keyword arguments: methodname: the method name for a methodCall packet methodresponse: true to create a methodResponse packet encoding: the packet encoding (default is UTF-8) All 8-bit strings in the data structure are assumed to use the packet encoding. Unicode strings are automatically converted, as necessary. """ assert type(params) == TupleType or isinstance(params, Fault),\ "argument must be tuple or Fault instance" if not encoding: encoding = "utf-8" m = Marshaller(encoding) data = m.dumps(params) if encoding != "utf-8": xmlheader = "<?xml version='1.0' encoding=%s?>\n" % repr(encoding) else: xmlheader = "<?xml version='1.0'?>\n" # utf-8 is default # standard XML-RPC wrappings if methodname: # a method call if not isinstance(methodname, StringType): methodname = methodname.encode(encoding) data = ( xmlheader, "<methodCall>\n" "<methodName>", methodname, "</methodName>\n", data, "</methodCall>\n" ) elif methodresponse or isinstance(params, Fault): # a method response data = ( xmlheader, "<methodResponse>\n", data, "</methodResponse>\n" ) else: return data # return as is return string.join(data, "")
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
methodresponse: true to create a methodResponse packet
methodresponse: true to create a methodResponse packet. If this option is used with a tuple, the tuple must be a singleton (i.e. it can contain only one element).
def dumps(params, methodname=None, methodresponse=None, encoding=None): """data [,options] -> marshalled data Convert a tuple or a fault object to an XML-RPC request (or response, if the methodsresponse option is used). In addition to the data object, the following options can be given as keyword arguments: methodname: the method name for a methodCall packet methodresponse: true to create a methodResponse packet encoding: the packet encoding (default is UTF-8) All 8-bit strings in the data structure are assumed to use the packet encoding. Unicode strings are automatically converted, as necessary. """ assert type(params) == TupleType or isinstance(params, Fault),\ "argument must be tuple or Fault instance" if not encoding: encoding = "utf-8" m = Marshaller(encoding) data = m.dumps(params) if encoding != "utf-8": xmlheader = "<?xml version='1.0' encoding=%s?>\n" % repr(encoding) else: xmlheader = "<?xml version='1.0'?>\n" # utf-8 is default # standard XML-RPC wrappings if methodname: # a method call if not isinstance(methodname, StringType): methodname = methodname.encode(encoding) data = ( xmlheader, "<methodCall>\n" "<methodName>", methodname, "</methodName>\n", data, "</methodCall>\n" ) elif methodresponse or isinstance(params, Fault): # a method response data = ( xmlheader, "<methodResponse>\n", data, "</methodResponse>\n" ) else: return data # return as is return string.join(data, "")
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
as necessary.
where necessary.
def dumps(params, methodname=None, methodresponse=None, encoding=None): """data [,options] -> marshalled data Convert a tuple or a fault object to an XML-RPC request (or response, if the methodsresponse option is used). In addition to the data object, the following options can be given as keyword arguments: methodname: the method name for a methodCall packet methodresponse: true to create a methodResponse packet encoding: the packet encoding (default is UTF-8) All 8-bit strings in the data structure are assumed to use the packet encoding. Unicode strings are automatically converted, as necessary. """ assert type(params) == TupleType or isinstance(params, Fault),\ "argument must be tuple or Fault instance" if not encoding: encoding = "utf-8" m = Marshaller(encoding) data = m.dumps(params) if encoding != "utf-8": xmlheader = "<?xml version='1.0' encoding=%s?>\n" % repr(encoding) else: xmlheader = "<?xml version='1.0'?>\n" # utf-8 is default # standard XML-RPC wrappings if methodname: # a method call if not isinstance(methodname, StringType): methodname = methodname.encode(encoding) data = ( xmlheader, "<methodCall>\n" "<methodName>", methodname, "</methodName>\n", data, "</methodCall>\n" ) elif methodresponse or isinstance(params, Fault): # a method response data = ( xmlheader, "<methodResponse>\n", data, "</methodResponse>\n" ) else: return data # return as is return string.join(data, "")
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
assert type(params) == TupleType or isinstance(params, Fault),\
assert isinstance(params, TupleType) or isinstance(params, Fault),\
def dumps(params, methodname=None, methodresponse=None, encoding=None): """data [,options] -> marshalled data Convert a tuple or a fault object to an XML-RPC request (or response, if the methodsresponse option is used). In addition to the data object, the following options can be given as keyword arguments: methodname: the method name for a methodCall packet methodresponse: true to create a methodResponse packet encoding: the packet encoding (default is UTF-8) All 8-bit strings in the data structure are assumed to use the packet encoding. Unicode strings are automatically converted, as necessary. """ assert type(params) == TupleType or isinstance(params, Fault),\ "argument must be tuple or Fault instance" if not encoding: encoding = "utf-8" m = Marshaller(encoding) data = m.dumps(params) if encoding != "utf-8": xmlheader = "<?xml version='1.0' encoding=%s?>\n" % repr(encoding) else: xmlheader = "<?xml version='1.0'?>\n" # utf-8 is default # standard XML-RPC wrappings if methodname: # a method call if not isinstance(methodname, StringType): methodname = methodname.encode(encoding) data = ( xmlheader, "<methodCall>\n" "<methodName>", methodname, "</methodName>\n", data, "</methodCall>\n" ) elif methodresponse or isinstance(params, Fault): # a method response data = ( xmlheader, "<methodResponse>\n", data, "</methodResponse>\n" ) else: return data # return as is return string.join(data, "")
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py
elif methodresponse or isinstance(params, Fault):
elif methodresponse:
def dumps(params, methodname=None, methodresponse=None, encoding=None): """data [,options] -> marshalled data Convert a tuple or a fault object to an XML-RPC request (or response, if the methodsresponse option is used). In addition to the data object, the following options can be given as keyword arguments: methodname: the method name for a methodCall packet methodresponse: true to create a methodResponse packet encoding: the packet encoding (default is UTF-8) All 8-bit strings in the data structure are assumed to use the packet encoding. Unicode strings are automatically converted, as necessary. """ assert type(params) == TupleType or isinstance(params, Fault),\ "argument must be tuple or Fault instance" if not encoding: encoding = "utf-8" m = Marshaller(encoding) data = m.dumps(params) if encoding != "utf-8": xmlheader = "<?xml version='1.0' encoding=%s?>\n" % repr(encoding) else: xmlheader = "<?xml version='1.0'?>\n" # utf-8 is default # standard XML-RPC wrappings if methodname: # a method call if not isinstance(methodname, StringType): methodname = methodname.encode(encoding) data = ( xmlheader, "<methodCall>\n" "<methodName>", methodname, "</methodName>\n", data, "</methodCall>\n" ) elif methodresponse or isinstance(params, Fault): # a method response data = ( xmlheader, "<methodResponse>\n", data, "</methodResponse>\n" ) else: return data # return as is return string.join(data, "")
cd906440fbd0694e165a09262268a608df82deeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd906440fbd0694e165a09262268a608df82deeb/xmlrpclib.py