rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
def decapitate(html, RESPONSE=None, header_re=ts_regex.compile( '\(\(' '[^\n\0\- <>:]+:[^\n]*\n' '\|' '[ \t]+[^\0\- ][^\n]*\n' '\)+\)[ \t]*\n\([\0-\377]+\)' ), space_re=ts_regex.compile('\([ \t]+\)'), name_re=ts_regex.compile('\([^\0\- <>:]+\):\([^\n]*\)'), ): ts_results = header_re.match_group(html, (1,3)) if not ts_results: return html headers, html = ts_results[1] headers=split(headers,'\n') i=1 while i < len(headers): if not headers[i]: del headers[i] continue ts_results = space_re.match_group(headers[i], (1,)) if ts_results: headers[i-1]="%s %s" % (headers[i-1], headers[i][len(ts_results[1]):]) del headers[i] continue i=i+1 for i in range(len(headers)): ts_results = name_re.match_group(headers[i], (1,2)) if ts_results: k, v = ts_results[1] v=strip(v) else: raise ValueError, 'Invalid Header (%d): %s ' % (i,headers[i]) RESPONSE.setHeader(k,v) return html
import re from string import find, strip token = "[a-zA-Z0-9! hdr_start = re.compile('(%s):(.*)' % token).match def decapitate(html, RESPONSE=None): headers = [] spos = 0 while 1: m = hdr_start(html, spos) if not m: if html[spos:spos+1] == '\n': break return html header = list(m.groups()) headers.append(header) spos = m.end() + 1 while spos < len(html) and html[spos] in ' \t': eol = find(html, '\n', spos) if eol < 0: return html header.append(strip(html[spos:eol])) spos = eol + 1 if RESPONSE is not None: for header in headers: hkey = header.pop(0) RESPONSE.setHeader(hkey, join(header, ' ')) return html[spos + 1:]
def manage_FTPget(self): "Get source for FTP download" return self.read()
cd288967056f2e11201b3588a8777d84f89a4698 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd288967056f2e11201b3588a8777d84f89a4698/DTMLMethod.py
if REQUEST: return self.manage_main(self,REQUEST,update_menu=1)
if REQUEST is not None: REQUEST['RESPONSE'].redirect(self.absolute_url()+'/manage_main')
def manage_addUserFolder(self,dtself=None,REQUEST=None,**ignored): """ """ f=UserFolder() self=self.this() try: self._setObject('acl_users', f) except: return MessageDialog( title ='Item Exists', message='This object already contains a User Folder', action ='%s/manage_main' % REQUEST['URL1']) self.__allow_groups__=f if REQUEST: return self.manage_main(self,REQUEST,update_menu=1)
22bc9f54caa28fa5a3ab184a02e659f970ff7cb8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/22bc9f54caa28fa5a3ab184a02e659f970ff7cb8/User.py
if self.precondition and hasattr(self,self.precondition):
if self.precondition and hasattr(self, str(self.precondition)):
def index_html(self, REQUEST, RESPONSE): """ The default view of the contents of a File or Image.
7109384bbfc8e6b0e9150f2caf5c8e0db02d0ff2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/7109384bbfc8e6b0e9150f2caf5c8e0db02d0ff2/Image.py
c=getattr(self,self.precondition)
c=getattr(self, str(self.precondition))
def index_html(self, REQUEST, RESPONSE): """ The default view of the contents of a File or Image.
7109384bbfc8e6b0e9150f2caf5c8e0db02d0ff2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/7109384bbfc8e6b0e9150f2caf5c8e0db02d0ff2/Image.py
"(?:\s|^)'"
"(?:\s|^)'"
def doc_literal( self, s, expr=re.compile( "(?:\s|^)'" # open "([^ \t\n\r\f\v']|[^ \t\n\r\f\v'][^\n']*[^ \t\n\r\f\v'])" # contents "'(?:\s|[,.;:!?]|$)" # close ).search): r=expr(s) if r: start, end = r.span(1) return (StructuredTextLiteral(s[start:end]), start-1, end+1) else: return None
d45abe8bf30b7e2af039d05528cd6fdfee21f4c6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/d45abe8bf30b7e2af039d05528cd6fdfee21f4c6/ClassicDocumentClass.py
"'(?:\s|[,.;:!?]|$)"
"'(?:\s|[,.;:!?]|$)"
def doc_literal( self, s, expr=re.compile( "(?:\s|^)'" # open "([^ \t\n\r\f\v']|[^ \t\n\r\f\v'][^\n']*[^ \t\n\r\f\v'])" # contents "'(?:\s|[,.;:!?]|$)" # close ).search): r=expr(s) if r: start, end = r.span(1) return (StructuredTextLiteral(s[start:end]), start-1, end+1) else: return None
d45abe8bf30b7e2af039d05528cd6fdfee21f4c6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/d45abe8bf30b7e2af039d05528cd6fdfee21f4c6/ClassicDocumentClass.py
expr = re.compile('\s*\*([ \na-zA-Z0-9.:/;,\'\"\?]+)\*(?!\*|-)').search
expr = re.compile('\s*\*([ \na-zA-Z0-9.:/;,\'\"\?\=\-\>\<\(\)]+)\*(?!\*|-)').search
def doc_emphasize( self, s, expr = re.compile('\s*\*([ \na-zA-Z0-9.:/;,\'\"\?]+)\*(?!\*|-)').search ):
d45abe8bf30b7e2af039d05528cd6fdfee21f4c6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/d45abe8bf30b7e2af039d05528cd6fdfee21f4c6/ClassicDocumentClass.py
return cmp((self.co_argcount, self.co_varnames), (other.co_argcount, other.co_varnames))
if other is None: return 1 try: return cmp((self.co_argcount, self.co_varnames), (other.co_argcount, other.co_varnames)) except: return 1
def __cmp__(self,other): return cmp((self.co_argcount, self.co_varnames), (other.co_argcount, other.co_varnames))
181ed4ff00a1149332af49373107da2e06eaba66 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/181ed4ff00a1149332af49373107da2e06eaba66/Extensions.py
cookies=None
cookies={}
def __init__(self,
3de30f23364f835981023d1b9b152caf0df2e237 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/3de30f23364f835981023d1b9b152caf0df2e237/Publish.py
find(ob.PrincipiaSearchSource(), obj_searchterm) >= 0
string.find(ob.PrincipiaSearchSource(), obj_searchterm) >= 0
def ZopeFindAndApply(self, obj, obj_ids=None, obj_metatypes=None, obj_searchterm=None, obj_expr=None, obj_mtime=None, obj_mspec=None, obj_permission=None, obj_roles=None, search_sub=0, REQUEST=None, result=None, pre='', apply_func=None, apply_path=''): """Zope Find interface and apply
7a7e961113aa82943bda0b80ae0d82c6e931a54d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/7a7e961113aa82943bda0b80ae0d82c6e931a54d/ZCatalog.py
query=self.template(self,REQUEST)
query=self.template(self,argdata)
def query_data(self,REQUEST):
8b8f79e0c677ac7cb6dfb57b13ae35babc1f0c67 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/8b8f79e0c677ac7cb6dfb57b13ae35babc1f0c67/DA.py
query=self.template(self,REQUEST)
query=self.template(self,argdata)
def manage_test(self,REQUEST):
8b8f79e0c677ac7cb6dfb57b13ae35babc1f0c67 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/8b8f79e0c677ac7cb6dfb57b13ae35babc1f0c67/DA.py
return self.counter
return self.counter - 1
def set(self, word): """ return the word id of 'word' """
3688d0dca8b290c41269b270612ffcfb6e352991 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/3688d0dca8b290c41269b270612ffcfb6e352991/Lexicon.py
time.sleep(2)
deadline = time.time() + 60 is_started = False while time.time() < deadline: response = send_action('status\n', zdrun_socket) if response is None: time.sleep(0.05) else: is_started = True break self.assert_(is_started, "spawned process failed to start in a minute")
def testRunIgnoresParentSignals(self): # Spawn a process which will in turn spawn a zdrun process. # We make sure that the zdrun process is still running even if # its parent process receives an interrupt signal (it should # not be passed to zdrun). zdrun_socket = os.path.join(self.here, 'testsock') zdctlpid = os.spawnvp( os.P_NOWAIT, sys.executable, [sys.executable, os.path.join(self.here, 'parent.py')] ) time.sleep(2) # race condition possible here os.kill(zdctlpid, signal.SIGINT) try: response = send_action('status\n', zdrun_socket) or '' except socket.error, msg: response = '' params = response.split('\n') self.assert_(len(params) > 1, repr(response)) # kill the process send_action('exit\n', zdrun_socket)
cb922396b8bfd8e41e8be5d016329eef69da2124 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cb922396b8bfd8e41e8be5d016329eef69da2124/testzdrun.py
try: response = send_action('status\n', zdrun_socket) or '' except socket.error, msg: response = '' params = response.split('\n') self.assert_(len(params) > 1, repr(response))
time.sleep(0.25) response = send_action('status\n', zdrun_socket) self.assert_(response is not None and '\n' in response)
def testRunIgnoresParentSignals(self): # Spawn a process which will in turn spawn a zdrun process. # We make sure that the zdrun process is still running even if # its parent process receives an interrupt signal (it should # not be passed to zdrun). zdrun_socket = os.path.join(self.here, 'testsock') zdctlpid = os.spawnvp( os.P_NOWAIT, sys.executable, [sys.executable, os.path.join(self.here, 'parent.py')] ) time.sleep(2) # race condition possible here os.kill(zdctlpid, signal.SIGINT) try: response = send_action('status\n', zdrun_socket) or '' except socket.error, msg: response = '' params = response.split('\n') self.assert_(len(params) > 1, repr(response)) # kill the process send_action('exit\n', zdrun_socket)
cb922396b8bfd8e41e8be5d016329eef69da2124 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cb922396b8bfd8e41e8be5d016329eef69da2124/testzdrun.py
def cacheStatistics(self): return self._getDB().cacheStatistics()
def manage_cache_size(self,value,REQUEST): "set cache size" db = self._getDB() if self._inVersion(): db.setVersionCacheSize(value) else: db.setCacheSize(value)
7016ec3b40f6bdda497de7389db3092b0a4b2267 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/7016ec3b40f6bdda497de7389db3092b0a4b2267/CacheManager.py
elif type(data) is not ListType: data=list(data)
else: data=list(data)
def setRoles(self, roles):
53db5d280081df203bdbd9473317837a3b48693a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/53db5d280081df203bdbd9473317837a3b48693a/Role.py
elif type(data) is not ListType: data=list(data)
else: data=list(data)
def delRoles(self, roles):
53db5d280081df203bdbd9473317837a3b48693a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/53db5d280081df203bdbd9473317837a3b48693a/Role.py
exc_info=exc_info())
exc_info=True)
def __setstate__(self, state): Globals.Persistent.__setstate__(self, state) if self.connection_string: try: self.connect(self.connection_string) except: LOG.error('Error connecting to relational database.', exc_info=exc_info())
22fc36df966e5da4ef7fcfe985822891dfd0b767 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/22fc36df966e5da4ef7fcfe985822891dfd0b767/Connection.py
exc_info=exc_info())
exc_info=True)
def manage_close_connection(self, REQUEST=None): " " try: if hasattr(self,'_v_database_connection'): self._v_database_connection.close() except: LOG.error('Error closing relational database connection.', exc_info=exc_info()) self._v_connected='' if REQUEST is not None: return self.manage_main(self, REQUEST)
22fc36df966e5da4ef7fcfe985822891dfd0b767 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/22fc36df966e5da4ef7fcfe985822891dfd0b767/Connection.py
l=version.rfind(/')
l=version.rfind('/')
def __init__(self, id, baseid, PATH_INFO): self.id=id self._refid=baseid version=PATH_INFO l=version.rfind(/') if l >= 0: version=version[:l] self._version="%s/%s" % (version, id) self.users__draft__=uf=AccessControl.User.UserFolder() self.__allow_groups__=uf
f5367679e7e82f783b2a13da1dfc38c67e48c1c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/f5367679e7e82f783b2a13da1dfc38c67e48c1c9/Draft.py
other[key] = URL = '/'.join(path)
other[key] = URL
def get(self, key, default=None, returnTaints=0, URLmatch=re.compile('URL(PATH)?([0-9]+)$').match, BASEmatch=re.compile('BASE(PATH)?([0-9]+)$').match, ): """Get a variable value
1b197cef79d4bcd99614e14829510af215cbe1b5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/1b197cef79d4bcd99614e14829510af215cbe1b5/HTTPRequest.py
other[key] = URL = '/'.join(v)
other[key] = URL
def get(self, key, default=None, returnTaints=0, URLmatch=re.compile('URL(PATH)?([0-9]+)$').match, BASEmatch=re.compile('BASE(PATH)?([0-9]+)$').match, ): """Get a variable value
1b197cef79d4bcd99614e14829510af215cbe1b5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/1b197cef79d4bcd99614e14829510af215cbe1b5/HTTPRequest.py
manage=manage_main=Globals.DTMLFile('dtml/brokenEdit',globals()) manage_workspace=manage
manage=Globals.DTMLFile('dtml/brokenEdit',globals()) manage_main=Globals.DTMLFile('dtml/brokenEdit',globals()) manage_workspace=Globals.DTMLFile('dtml/brokenEdit',globals())
def __getattr__(self, name): if name[:3]=='_p_': return BrokenClass.inheritedAttribute('__getattr__')(self, name) raise AttributeError, escape(name)
977f54210e5b748e92c6cdb88b5bd367d646f28f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/977f54210e5b748e92c6cdb88b5bd367d646f28f/Uninstalled.py
else: name=method.__name__
else: name=os.path.split(method.__name__)[-1]
def registerClass(self, instance_class=None, meta_type='', permission=None, constructors=(), icon=None, permissions=None, legacy=(), ): """Register a constructor
31f007145926a0716500bcdb1b2b427e8f0ed261 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/31f007145926a0716500bcdb1b2b427e8f0ed261/ProductContext.py
self._p_changed=0 self._p_deactivate() self.__setstate__(state) self._p_changed=1
base = aq_base(self) base._p_changed=0 base._p_deactivate() base.__setstate__(state) base._p_changed=1
def manage_historyCopy(self, keys=[], RESPONSE=None, URL1=None): "Copy a selected revision to the present" if not keys: raise HistorySelectionError, ( "No historical revision was selected.<p>")
9aa8feeebbe996706f936d0c7a9836d26528f1a2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/9aa8feeebbe996706f936d0c7a9836d26528f1a2/History.py
name=user.getName()
name=user.getUserName()
def _setObject(self,id,object,roles=None,user=None, set_owner=1): v=self._checkId(id) if v is not None: id=v try: t=object.meta_type except: t=None
618b2b5556dc5c8affab8a5b54b2da8d970aad6c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/618b2b5556dc5c8affab8a5b54b2da8d970aad6c/ObjectManager.py
sc=sc+(t-int(t)) s=(hr/24.0+mn/1440.0+sc/86400.0)
s=(hr/24.0+mn/1440.0+(sc+ms)/86400.0)
def __init__(self,*args): """Return a new date-time object
92b0ff07ac42eb6719c4d212edd1adf91e39d066 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/92b0ff07ac42eb6719c4d212edd1adf91e39d066/DateTime.py
sc=sc+(t-int(t))
sc=sc+ms
def __init__(self,*args): """Return a new date-time object
92b0ff07ac42eb6719c4d212edd1adf91e39d066 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/92b0ff07ac42eb6719c4d212edd1adf91e39d066/DateTime.py
sc=sc+(t-int(t)) s=(hr/24.0+mn/1440.0+sc/86400.0)
s=(hr/24.0+mn/1440.0+(sc+ms)/86400.0)
def __init__(self,*args): """Return a new date-time object
92b0ff07ac42eb6719c4d212edd1adf91e39d066 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/92b0ff07ac42eb6719c4d212edd1adf91e39d066/DateTime.py
_d=d+(self._tzinfo[tz].info(t)[0]/86400.0) yr,mo,dy=self._calendarday(_d+jd1901) _s=(_d-int(_d))*86400.0 hr=int(_s/3600) _s=_s-(hr*3600) mn=int(_s/60) sc=_s-(mn*60) if(hr==23 and mn==59 and sc>59.999): hr,mn,sc=0,0,0.0 else: if hr<0: hr=23+hr if mn<0: mn=59+mn if sc<0: if (sc-int(sc)>=0.999): sc=round(sc) sc=59+sc
x=d+(self._tzinfo[tz].info(t)[0]/86400.0) yr,mo,dy=self._calendarday(x+jd1901) x=(x-int(x))*86400.0 hr=int(x/3600) x=x-(hr*3600) mn=int(x/60) sc=x-(mn*60)
def __init__(self,*args): """Return a new date-time object
92b0ff07ac42eb6719c4d212edd1adf91e39d066 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/92b0ff07ac42eb6719c4d212edd1adf91e39d066/DateTime.py
tza=self._tzinfo[tz].info(t)[0] d,t=d-(tza/86400.0),t-tza
a=self._tzinfo[tz].info(t)[0] d,t=d-(a/86400.0),t-a
def __init__(self,*args): """Return a new date-time object
92b0ff07ac42eb6719c4d212edd1adf91e39d066 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/92b0ff07ac42eb6719c4d212edd1adf91e39d066/DateTime.py
sc=sc+(t-int(t)) s=(hr/24.0+mn/1440.0+sc/86400.0)
s=(hr/24.0+mn/1440.0+(sc+ms)/86400.0)
def __init__(self,*args): """Return a new date-time object
92b0ff07ac42eb6719c4d212edd1adf91e39d066 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/92b0ff07ac42eb6719c4d212edd1adf91e39d066/DateTime.py
sc=sc+(t-int(t))
sc=sc+ms
def __init__(self,*args): """Return a new date-time object
92b0ff07ac42eb6719c4d212edd1adf91e39d066 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/92b0ff07ac42eb6719c4d212edd1adf91e39d066/DateTime.py
tza=self._tzinfo[tz].info(t)[0] d,t=arg-(tza/86400.0),t-tza
a=self._tzinfo[tz].info(t)[0] d,t=arg-(a/86400.0),t-a
def __init__(self,*args): """Return a new date-time object
92b0ff07ac42eb6719c4d212edd1adf91e39d066 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/92b0ff07ac42eb6719c4d212edd1adf91e39d066/DateTime.py
sc=sc+(t-int(t)) s=(hr/24.0+mn/1440.0+sc/86400.0)
s=(hr/24.0+mn/1440.0+(sc+ms)/86400.0)
def __init__(self,*args): """Return a new date-time object
92b0ff07ac42eb6719c4d212edd1adf91e39d066 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/92b0ff07ac42eb6719c4d212edd1adf91e39d066/DateTime.py
_d=d+(self._tzinfo[tz].info(t)[0]/86400.0) yr,mo,dy=self._calendarday(_d+jd1901) _s=(_d-int(_d))*86400.0 hr=int(_s/3600) _s=_s-(hr*3600) mn=int(_s/60) sc=_s-(mn*60)
x=d+(self._tzinfo[tz].info(t)[0]/86400.0) yr,mo,dy=self._calendarday(x+jd1901) x=(x-int(x))*86400.0 hr=int(x/3600) x=x-(hr*3600) mn=int(x/60) sc=x-(mn*60)
def __init__(self,*args): """Return a new date-time object
92b0ff07ac42eb6719c4d212edd1adf91e39d066 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/92b0ff07ac42eb6719c4d212edd1adf91e39d066/DateTime.py
_s=(d-int(d))*86400.0 hr=int(_s/3600) _s=_s-(hr*3600) mn=int(_s/60) sc=_s-(mn*60)
x=(d-int(d))*86400.0 hr=int(x/3600) x=x-(hr*3600) mn=int(x/60) sc=x-(mn*60)
def __init__(self,*args): """Return a new date-time object
92b0ff07ac42eb6719c4d212edd1adf91e39d066 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/92b0ff07ac42eb6719c4d212edd1adf91e39d066/DateTime.py
tza=self._tzinfo[tz].info(t)[0] d,t=d-(tza/86400.0),t-tza
a=self._tzinfo[tz].info(t)[0] d,t=d-(a/86400.0),t-a
def __init__(self,*args): """Return a new date-time object
92b0ff07ac42eb6719c4d212edd1adf91e39d066 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/92b0ff07ac42eb6719c4d212edd1adf91e39d066/DateTime.py
def pCommonZ(self):
92b0ff07ac42eb6719c4d212edd1adf91e39d066 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/92b0ff07ac42eb6719c4d212edd1adf91e39d066/DateTime.py
def __add__(self,other):
92b0ff07ac42eb6719c4d212edd1adf91e39d066 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/92b0ff07ac42eb6719c4d212edd1adf91e39d066/DateTime.py
d=self._d+o t=self._t+(o*86400.0) _d=d+(self._tzinfo[self._localzone].info(self._t)[0]/86400.0) yr,mo,dy=self._calendarday((_d+jd1901)) s=(_d-int(_d))*86400.0
d,t,tz=(self._d+o),(self._t+(o*86400.0)),self._tz x=d+(self._tzinfo[tz].info(t)[0]/86400.0) yr,mo,dy=self._calendarday((x+jd1901)) s=(x-int(x))*86400.0
def __add__(self,other):
92b0ff07ac42eb6719c4d212edd1adf91e39d066 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/92b0ff07ac42eb6719c4d212edd1adf91e39d066/DateTime.py
sc=s-(mn*60) if(hr==23 and mn==59 and sc>59.999): hr,mn,sc=0,0,0.0 else: if hr<0: hr=23+hr if mn<0: mn=59+mn if sc<0: if (sc-int(sc)>=0.999): sc=round(sc) sc=59+sc return self.__class__(yr,mo,dy,hr,mn,sc,self._tz,t,d,(d-int(d)))
s=s-(mn*60) return self.__class__(yr,mo,dy,hr,mn,s,self._tz,t,d,(d-int(d)))
def __add__(self,other):
92b0ff07ac42eb6719c4d212edd1adf91e39d066 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/92b0ff07ac42eb6719c4d212edd1adf91e39d066/DateTime.py
path=REQUEST['SCRIPT_NAME'],
path=(REQUEST['BASEPATH1'] or '/'),
def leave(self, REQUEST, RESPONSE): """Temporarily stop working in a version""" RESPONSE.setCookie( Globals.VersionNameName,'No longer active', expires="Mon, 25-Jan-1999 23:59:59 GMT", 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 left version %s.' % self.id) ) return RESPONSE.redirect(REQUEST['URL1']+'/manage_main')
61b5c39ff1fba839ce9b4a840ca8f308ccdf92c7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/61b5c39ff1fba839ce9b4a840ca8f308ccdf92c7/Version.py
def evaluateBoolean(self, expr): return not not self.evaluate(expr)
evaluateBoolean = evaluate
def evaluate(self, expression, isinstance=isinstance, StringType=StringType): if isinstance(expression, StringType): expression = self._engine.compile(expression) __traceback_supplement__ = ( TALESTracebackSupplement, self, expression) return expression(self)
52b72a695593671624fc9e235ee2204f3eeee5fc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/52b72a695593671624fc9e235ee2204f3eeee5fc/TALES.py
write_inituser(inituser, user, password)
if user and password: write_inituser(inituser, user, password)
def main(): try: opts, args = getopt.getopt(sys.argv[1:], "hu:d:s:", ["help", "user=", "dir=", "skelsrc="] ) except getopt.GetoptError, msg: usage(sys.stderr, msg) sys.exit(2) script = os.path.abspath(sys.argv[0]) user = None password = None skeltarget = None skelsrc = None for opt, arg in opts: if opt in ("-d", "--dir"): skeltarget = os.path.abspath(os.path.expanduser(arg)) if not skeltarget: usage(sys.stderr, "dir must not be empty") sys.exit(2) if opt in ("-s", "--skelsrc"): skelsrc = os.path.abspath(os.path.expanduser(arg)) if not skelsrc: usage(sys.stderr, "skelsrc must not be empty") sys.exit(2) if opt in ("-h", "--help"): usage(sys.stdout) sys.exit() if opt in ("-u", "--user"): if not arg: usage(sys.stderr, "user must not be empty") sys.exit(2) if not ":" in arg: usage(sys.stderr, "user must be specified as name:password") sys.exit(2) user, password = arg.split(":", 1) if not skeltarget: # interactively ask for skeltarget and initial user name/passwd. # cant set custom instancehome in interactive mode, we default # to skeltarget. skeltarget = instancehome = os.path.abspath( os.path.expanduser(get_skeltarget()) ) instancehome = skeltarget zopehome = os.path.dirname(os.path.dirname(script)) softwarehome = os.path.join(zopehome, "lib", "python") configfile = os.path.join(instancehome, 'etc', 'zope.conf') if skelsrc is None: # default to using stock Zope skeleton source skelsrc = os.path.join(zopehome, "skel") inituser = os.path.join(instancehome, "inituser") if not (user or os.path.exists(inituser)): user, password = get_inituser() # we need to distinguish between python.exe and pythonw.exe under # Windows in order to make Zope run using python.exe when run in a # console window and pythonw.exe when run as a service, so we do a bit # of sniffing here. psplit = os.path.split(sys.executable) exedir = os.path.join(*psplit[:-1]) pythonexe = os.path.join(exedir, 'python.exe') pythonwexe = os.path.join(exedir, 'pythonw.exe') if ( os.path.isfile(pythonwexe) and os.path.isfile(pythonexe) and (sys.executable in [pythonwexe, pythonexe]) ): # we're using a Windows build with both python.exe and pythonw.exe # in the same directory PYTHON = pythonexe PYTHONW = pythonwexe else: # we're on UNIX or we have a nonstandard Windows setup PYTHON = PYTHONW = sys.executable kw = { "PYTHON":PYTHON, "PYTHONW":PYTHONW, "INSTANCE_HOME": instancehome, "SOFTWARE_HOME": softwarehome, "ZOPE_HOME": zopehome, } copyzopeskel.copyskel(skelsrc, skeltarget, None, None, **kw) write_inituser(inituser, user, password)
d512a2dc91f38069b9d020a8ff3d05f2fc0e9f2b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/d512a2dc91f38069b9d020a8ff3d05f2fc0e9f2b/mkzopeinstance.py
reverse=0)
reverse=1)
def __init__(self, blocks): tname, args, section = blocks[0] args=parse_params(args, name='', start='1',end='-1',size='10', orphan='3',overlap='1',mapping=1, skip_unauthorized=1, previous=1, next=1, expr='', sort='', reverse=0) self.args=args has_key=args.has_key
a11e488a40fe29b8c2d4d4b817045ae8f5fb46ea /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/a11e488a40fe29b8c2d4d4b817045ae8f5fb46ea/DT_In.py
self.reverse=1 self.sort='' else: self.reverse=0
self.reverse=args['reverse']
def __init__(self, blocks): tname, args, section = blocks[0] args=parse_params(args, name='', start='1',end='-1',size='10', orphan='3',overlap='1',mapping=1, skip_unauthorized=1, previous=1, next=1, expr='', sort='', reverse=0) self.args=args has_key=args.has_key
a11e488a40fe29b8c2d4d4b817045ae8f5fb46ea /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/a11e488a40fe29b8c2d4d4b817045ae8f5fb46ea/DT_In.py
if self.sort is not None: sequence=self.sort_sequence(sequence)
if self.sort is not None: sequence=self.sort_sequence(sequence) if self.reverse is not None: sequence.reverse()
def renderwb(self, md): expr=self.expr name=self.__name__ if expr is None: sequence=md[name] cache={ name: sequence } else: sequence=expr(md) cache=None
a11e488a40fe29b8c2d4d4b817045ae8f5fb46ea /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/a11e488a40fe29b8c2d4d4b817045ae8f5fb46ea/DT_In.py
section=self.section
section=self.section
def renderwob(self, md): expr=self.expr name=self.__name__ if expr is None: sequence=md[name] cache={ name: sequence } else: sequence=expr(md) cache=None
a11e488a40fe29b8c2d4d4b817045ae8f5fb46ea /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/a11e488a40fe29b8c2d4d4b817045ae8f5fb46ea/DT_In.py
if self.sort is not None: sequence=self.sort_sequence(sequence)
if self.sort is not None: sequence=self.sort_sequence(sequence) if self.reverse is not None: sequence.reverse()
def renderwob(self, md): expr=self.expr name=self.__name__ if expr is None: sequence=md[name] cache={ name: sequence } else: sequence=expr(md) cache=None
a11e488a40fe29b8c2d4d4b817045ae8f5fb46ea /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/a11e488a40fe29b8c2d4d4b817045ae8f5fb46ea/DT_In.py
if self.reverse: s.reverse()
def sort_sequence(self, sequence):
a11e488a40fe29b8c2d4d4b817045ae8f5fb46ea /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/a11e488a40fe29b8c2d4d4b817045ae8f5fb46ea/DT_In.py
imp = getattr(self.aq_parent, '%s__roles__' % self.__name__) return imp.__of__(self)
imp = getattr(self.aq_inner.aq_parent, '%s__roles__' % self.__name__) if hasattr(imp, '__of__'): return imp.__of__(self) return imp
def _get__roles__(self): imp = getattr(self.aq_parent, '%s__roles__' % self.__name__) return imp.__of__(self)
42affe51ebaa124742e49af806001fdbd06f83f8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/42affe51ebaa124742e49af806001fdbd06f83f8/special_dtml.py
try: self.ids.remove(Id) except: pass
try: self.ids.remove(documentId) except KeyError: pass
def unindex_object(self,documentId): try: self.ids.remove(Id) except: pass
28236201efcfe819d3fa32894b53c3e504f28b67 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/28236201efcfe819d3fa32894b53c3e504f28b67/FilteredSet.py
id=id.strip()
def _setProperty(self, id, value, type='string'): # for selection and multiple selection properties # the value argument indicates the select variable # of the property id=id.strip() self._wrapperCheck(value) if not self.valid_property_id(id): raise 'Bad Request', 'Invalid or duplicate property id'
f9d24c8ba287485350f7daf54f2855de21bafc13 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/f9d24c8ba287485350f7daf54f2855de21bafc13/PropertyManager.py
self._setProperty(id, value, type)
self._setProperty(id.strip(), value, type)
def manage_addProperty(self, id, value, type, REQUEST=None): """Add a new property via the web. Sets a new property with the given id, type, and value.""" if type_converters.has_key(type): value=type_converters[type](value) self._setProperty(id, value, type) if REQUEST is not None: return self.manage_propertiesForm(self, REQUEST)
f9d24c8ba287485350f7daf54f2855de21bafc13 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/f9d24c8ba287485350f7daf54f2855de21bafc13/PropertyManager.py
self._context = context
self._context_ref = ref(context)
def __init__(self, name, seq, context): ZTUtils.Iterator.__init__(self, seq) self.name = name self._context = context
a6cfcc00aeae1e7b7c82981e3652ea62df0b90f9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/a6cfcc00aeae1e7b7c82981e3652ea62df0b90f9/TALES.py
self._context.setLocal(self.name, self.item)
context = self._context_ref() if context is not None: context.setLocal(self.name, self.item)
def next(self): if ZTUtils.Iterator.next(self): self._context.setLocal(self.name, self.item) return 1 return 0
a6cfcc00aeae1e7b7c82981e3652ea62df0b90f9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/a6cfcc00aeae1e7b7c82981e3652ea62df0b90f9/TALES.py
lexicon_id = lexicon_id or extra.lexicon_idp
lexicon_id = lexicon_id or extra.lexicon_id
def __init__(self, id, extra=None, caller=None, index_factory=None, field_name=None, lexicon_id=None): self.id = id
fffa0a8e120a9bf1d8948d75df5f2b2d26309389 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/fffa0a8e120a9bf1d8948d75df5f2b2d26309389/ZCTextIndex.py
{'icon':icon, 'label':'Properties', 'action':'manage_main', 'target':'manage_main'}, {'icon':icon, 'label':'Try It', 'action':'', 'target':'manage_main'}, {'icon':'AccessControl/AccessControl_icon.gif', 'label':'Access Control', 'action':'manage_rolesForm', 'target':'manage_main'},
{'label':'Properties', 'action':'manage_main'}, {'label':'Try It', 'action':''}, {'label':'Access Control', 'action':'manage_access'},
def add(self, id, title, external_name, REQUEST=None): """Add an external method to a folder""" names=split(external_name,'.') module, function = join(names[:-1],'.'), names[-1] i=ExternalMethod(id,title,module,function) self._setObject(id,i) return self.manage_main(self,REQUEST)
da5be84f009aaec4548df6684d9cd24910f2ca79 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/da5be84f009aaec4548df6684d9cd24910f2ca79/ExternalMethod.py
dbtab.databases.update(getattr(DB, 'databases', {})) DB.databases = dbtab.databases else: DB = ZODB.DB(m.Storage, databases=dbtab.databases)
databases.update(getattr(DB, 'databases', {})) DB.databases = databases else: DB = ZODB.DB(m.Storage, databases=databases)
def startup(): global app # Import products OFS.Application.import_products() configuration = getConfiguration() # Open the database dbtab = configuration.dbtab try: # Try to use custom storage try: m=imp.find_module('custom_zodb',[configuration.testinghome]) except: m=imp.find_module('custom_zodb',[configuration.instancehome]) except: # if there is no custom_zodb, use the config file specified databases DB = dbtab.getDatabase('/', is_root=1) else: m=imp.load_module('Zope2.custom_zodb', m[0], m[1], m[2]) sys.modules['Zope2.custom_zodb']=m if hasattr(m,'DB'): DB=m.DB dbtab.databases.update(getattr(DB, 'databases', {})) DB.databases = dbtab.databases else: DB = ZODB.DB(m.Storage, databases=dbtab.databases) Globals.BobobaseName = DB.getName() if DB.getActivityMonitor() is None: from ZODB.ActivityMonitor import ActivityMonitor DB.setActivityMonitor(ActivityMonitor()) Globals.DB = DB # Ick, this is temporary until we come up with some registry Zope2.DB = DB # Hook for providing multiple transaction object manager undo support: Globals.UndoManager=DB Globals.opened.append(DB) import ClassFactory DB.classFactory = ClassFactory.ClassFactory # "Log on" as system user newSecurityManager(None, AccessControl.User.system) # Set up the "app" object that automagically opens # connections app = App.ZApplication.ZApplicationWrapper( DB, 'Application', OFS.Application.Application, (), Globals.VersionNameName) Zope2.bobo_application = app # Initialize the app object application = app() OFS.Application.initialize(application) if Globals.DevelopmentMode: # Set up auto-refresh. from App.RefreshFuncs import setupAutoRefresh setupAutoRefresh(application._p_jar) application._p_jar.close() # "Log off" as system user noSecurityManager() global startup_time startup_time = asctime() Zope2.zpublisher_transactions_manager = TransactionsManager() Zope2.zpublisher_exception_hook = zpublisher_exception_hook Zope2.zpublisher_validated_hook = validated_hook Zope2.__bobo_before__ = noSecurityManager
e2f258ba099ecfe726cc86d02c77b9e09d73049d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e2f258ba099ecfe726cc86d02c77b9e09d73049d/startup.py
path to the ZCatalog (since two Zope object's cannot have the same
path to the ZCatalog (since two Zope objects cannot have the same
def manage_addZCatalog(id, title, vocab_id=None): """ Add a ZCatalog object. 'vocab_id' is the name of a Vocabulary object this catalog should use. A value of None will cause the Catalog to create its own private vocabulary. """
f23bdff299c7ee2e4d7c5154348886768be3ed1b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/f23bdff299c7ee2e4d7c5154348886768be3ed1b/ZCatalog.py
del self._index[entry]
try: del self._index[entry] except KeyError: pass if isinstance(self.__len__, BTrees.Length.Length): self._length = self.__len__ del self.__len__
def removeForwardIndexEntry(self, entry, documentId): """Take the entry provided and remove any reference to documentId in its entry in the index. """ indexRow = self._index.get(entry, _marker) if indexRow is not _marker: try: indexRow.remove(documentId) if not indexRow: del self._index[entry] self._length.change(-1)
c17f27d8f7ee0bbc90f2954d0a3d49145dbc9639 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/c17f27d8f7ee0bbc90f2954d0a3d49145dbc9639/UnIndex.py
self._length.change(1)
try: self._length.change(1) except AttributeError: if isinstance(self.__len__, BTrees.Length.Length): self._length = self.__len__ del self.__len__ self._length.change(1)
def insertForwardIndexEntry(self, entry, documentId): """Take the entry provided and put it in the correct place in the forward index.
c17f27d8f7ee0bbc90f2954d0a3d49145dbc9639 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/c17f27d8f7ee0bbc90f2954d0a3d49145dbc9639/UnIndex.py
% lexicon.getId())
% repr(lexicon))
def getLexicon(self): """Get the lexicon for this index """ if hasattr(aq_base(self), 'lexicon'): # Fix up old ZCTextIndexes by removing direct lexicon ref # and changing it to an ID lexicon = getattr(aq_parent(aq_inner(self)), self.lexicon.getId()) self.lexicon_id = lexicon.getId() del self.lexicon
f8d8c81098dcfa9621492892764af1d49ad41006 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/f8d8c81098dcfa9621492892764af1d49ad41006/ZCTextIndex.py
e.registerType('provider', TALESProviderExpression)
e.registerType('provider', Z2ProviderExpression)
def createZopeEngine(): e = ZopeEngine() e.iteratorFactory = PathIterator for pt in ZopePathExpr._default_type_names: e.registerType(pt, ZopePathExpr) e.registerType('string', StringExpr) e.registerType('python', ZRPythonExpr.PythonExpr) e.registerType('not', NotExpr) e.registerType('defer', DeferExpr) e.registerType('lazy', LazyExpr) e.registerType('provider', TALESProviderExpression) e.registerBaseName('modules', SecureModuleImporter) return e
a96829785a6aa3a45ae8f4266f7daaace863d274 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/a96829785a6aa3a45ae8f4266f7daaace863d274/Expressions.py
def get_module_info(module_name, modules={}, acquire=_l.acquire, release=_l.release, ): if modules.has_key(module_name): return modules[module_name] if module_name[-4:]=='.cgi': module_name=module_name[:-4] acquire() try: module=__import__(module_name) realm=module_name # Let the app specify a realm if hasattr(module,'__bobo_realm__'): realm=module.__bobo_realm__ else: realm=module_name # Check whether tracebacks should be hidden: if (hasattr(module,'__bobo_hide_tracebacks__') and not module.__bobo_hide_tracebacks__): CGIResponse._tbopen, CGIResponse._tbclose = '<PRE>', '</PRE>' if hasattr(module,'__bobo_before__'): bobo_before=module.__bobo_before__ else: bobo_before=None if hasattr(module,'__bobo_after__'): bobo_after=module.__bobo_after__ else: bobo_after=None # Get request data from outermost environment: if hasattr(module,'__request_data__'): request_params=module.__request_data__ else: request_params=None # Get initial group data: inherited_groups=[] if hasattr(module,'__allow_groups__'): groups=module.__allow_groups__ inherited_groups.append(groups) else: groups=None web_objects=None roles=UNSPECIFIED_ROLES if hasattr(module,'bobo_application'): object=module.bobo_application if hasattr(object,'__allow_groups__'): groups=object.__allow_groups__ inherited_groups.append(groups) else: groups=None if hasattr(object,'__roles__'): roles=object.__roles__ else: if hasattr(module,'web_objects'): web_objects=module.web_objects object=web_objects else: object=module published=web_objects try: doc=module.__doc__ except: if web_objects is not None: doc=' ' else: doc=None info= (bobo_before, bobo_after, request_params, inherited_groups, groups, roles, object, doc, published, realm, module_name) modules[module_name]=modules[module_name+'.cgi']=info return info finally: release()
068d933d7af5867cba2f5739a6794d1c40fa9f23 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/068d933d7af5867cba2f5739a6794d1c40fa9f23/Publish.py
def setProperty(self, id, value, type='string', meta=None):
def _setProperty(self, id, value, type='string', meta=None):
def setProperty(self, id, value, type='string', meta=None): # Set a new property with the given id, value and optional type. # Note that different property sets may support different typing # systems. if not self.valid_property_id(id): raise 'Bad Request', 'Invalid property id.' self=self.v_self() if meta is None: meta={} prop={'id':id, 'type':type, 'meta':meta} self._properties=self._properties+(prop,) setattr(self, id, value)
4439ae48b5e95794878f9c4bbfbe1eabd161d57e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4439ae48b5e95794878f9c4bbfbe1eabd161d57e/PropertySheets.py
def updateProperty(self, id, value):
def _updateProperty(self, id, value):
def updateProperty(self, id, value): # Update the value of an existing property. If value is a string, # an attempt will be made to convert the value to the type of the # existing property. if not self.hasProperty(id): raise 'Bad Request', 'The property %s does not exist.' % id if type(value)==type(''): proptype=self.propertyInfo(id).get('type', 'string') if type_converters.has_key(proptype): value=type_converters[proptype](value) setattr(self.v_self(), id, value)
4439ae48b5e95794878f9c4bbfbe1eabd161d57e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4439ae48b5e95794878f9c4bbfbe1eabd161d57e/PropertySheets.py
def delProperty(self, id):
def _delProperty(self, id):
def delProperty(self, id): # Delete the property with the given id. If a property with the # given id does not exist, a ValueError is raised. if not self.hasProperty(id): raise ValueError, 'The property %s does not exist.' % id self=self.v_self() delattr(self, id) self._properties=tuple(filter(lambda i, n=id: i['id'] != n, self._properties))
4439ae48b5e95794878f9c4bbfbe1eabd161d57e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4439ae48b5e95794878f9c4bbfbe1eabd161d57e/PropertySheets.py
self.setProperty(id, value, type)
self._setProperty(id, value, type)
def manage_addProperty(self, id, value, type, REQUEST=None): """Add a new property via the web. Sets a new property with the given id, type, and value.""" if type_converters.has_key(type): value=type_converters[type](value) self.setProperty(id, value, type) if REQUEST is not None: return self.manage_propertiesForm(self, REQUEST)
4439ae48b5e95794878f9c4bbfbe1eabd161d57e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4439ae48b5e95794878f9c4bbfbe1eabd161d57e/PropertySheets.py
vself.updateProperty(name, value)
vself._updateProperty(name, value)
def manage_changeProperties(self, REQUEST=None, **kw): """Change existing object properties by passing either a mapping object of name:value pairs {'foo':6} or passing name=value parameters.""" if REQUEST is None: props={} else: props=REQUEST if kw: for name, value in kw.items(): props[name]=value propdict=self.propdict() vself=self.v_self() for name, value in props.items(): if self.hasProperty(name): if not 'w' in propdict[name].get('mode', 'wd'): raise 'BadRequest', '%s cannot be changed.' % name vself.updateProperty(name, value) if REQUEST is not None: return MessageDialog( title ='Success!', message='Your changes have been saved.', action ='manage_propertiesForm')
4439ae48b5e95794878f9c4bbfbe1eabd161d57e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4439ae48b5e95794878f9c4bbfbe1eabd161d57e/PropertySheets.py
self.delProperty(id)
self._delProperty(id)
def manage_delProperties(self, ids=None, REQUEST=None): """Delete one or more properties specified by 'ids'.""" if ids is None: return MessageDialog( title='No property specified', message='No properties were specified!', action ='./manage_propertiesForm',) propdict=self.propdict() vself=self.v_self() if hasattr(vself, '_reserved_names'): nd=vself._reserved_names else: nd=() for id in ids: if not propdict.has_key(id): raise 'BadRequest', ( 'The property <em>%s</em> does not exist.' % id) if (not 'd' in propdict[id].get('mode', 'wd')) or (id in nd): return MessageDialog( title ='Cannot delete %s' % id, message='The property <em>%s</em> cannot be deleted.' % id, action ='manage_propertiesForm') self.delProperty(id) if REQUEST is not None: return self.manage_propertiesForm(self, REQUEST)
4439ae48b5e95794878f9c4bbfbe1eabd161d57e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4439ae48b5e95794878f9c4bbfbe1eabd161d57e/PropertySheets.py
def setProperty(self, id, value, type='string', meta=None):
def _setProperty(self, id, value, type='string', meta=None):
def setProperty(self, id, value, type='string', meta=None): raise ValueError, 'Property cannot be set.'
4439ae48b5e95794878f9c4bbfbe1eabd161d57e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4439ae48b5e95794878f9c4bbfbe1eabd161d57e/PropertySheets.py
def updateProperty(self, id, value):
def _updateProperty(self, id, value):
def updateProperty(self, id, value): raise ValueError, 'Property cannot be set.'
4439ae48b5e95794878f9c4bbfbe1eabd161d57e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4439ae48b5e95794878f9c4bbfbe1eabd161d57e/PropertySheets.py
def delProperty(self, id):
def _delProperty(self, id):
def delProperty(self, id): raise ValueError, 'Property cannot be deleted.'
4439ae48b5e95794878f9c4bbfbe1eabd161d57e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4439ae48b5e95794878f9c4bbfbe1eabd161d57e/PropertySheets.py
if find(s,'\\') < 0 or (find(s,'\\t') < 0 and find(s,'\\n') < 0): return s
if find(s,'\\') < 0 and (find(s,'\\t') < 0 and find(s,'\\n') < 0): return s
def parse_text(s): if find(s,'\\') < 0 or (find(s,'\\t') < 0 and find(s,'\\n') < 0): return s r=[] for x in split(s,'\\\\'): x=join(split(x,'\\n'),'\n') r.append(join(split(x,'\\t'),'\t')) return join(r,'\\')
8007a3573b1453f34a8abe9cbf5efbc94d4e52a5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/8007a3573b1453f34a8abe9cbf5efbc94d4e52a5/RDB.py
warnings.warn('Using the zLOG module is deprecated (to be removed in '
warnings.warn('The zLOG package is deprecated and will be removed in '
def LOG(subsystem, severity, summary, detail='', error=None, reraise=None): """Log some information The required arguments are: subsystem -- The subsystem generating the message (e.g. ZODB) severity -- The "severity" of the event. This may be an integer or a floating point number. Logging back ends may consider the int() of this value to be significant. For example, a backend may consider any severity whos integer value is WARNING to be a warning. summary -- A short summary of the event detail -- A detailed description error -- A three-element tuple consisting of an error type, value, and traceback. If provided, then a summary of the error is added to the detail. reraise -- If provided with a true value, then the error given by error is reraised. """ warnings.warn('Using the zLOG module is deprecated (to be removed in ' 'Zope 2.12. Use the Python logging module instead.', DeprecationWarning, stacklevel=2) log_write(subsystem, severity, summary, detail, error) if reraise and error: raise error[0], error[1], error[2]
cab0059b6a4a7e95fba037699694c68e827157a7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cab0059b6a4a7e95fba037699694c68e827157a7/__init__.py
return '\n <n:src>%s</n:src>\n' \ ' <n:dst>%s/document_src</n:dst>\n ' % (url, url)
return '\n <n:link>\n' \ ' <n:src>%s</n:src>\n' \ ' <n:dst>%s/document_src</n:dst>\n' \ ' </n:link>\n ' % (url, url)
def dav__source(self): vself=self.v_self() if hasattr(vself, 'meta_type') and vself.meta_type in \ ('Document', 'DTML Document', 'DTML Method'): url=vself.absolute_url() return '\n <n:src>%s</n:src>\n' \ ' <n:dst>%s/document_src</n:dst>\n ' % (url, url) return ''
bfa547755ead70ef43bdaf106331c736eb43c41d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/bfa547755ead70ef43bdaf106331c736eb43c41d/PropertySheets.py
i._init(smtpHost=smtp_host, smtpPort=smtp_port)
i._init(smtp_host=smtp_host, smtp_port=smtp_port)
def add(self, id, title='', smtp_host=None, smtp_port=25, REQUEST=None): ' add a MailHost into the system ' i=MailHost() #create new mail host i.id=id #give it id i.title=title #title i._init(smtpHost=smtp_host, smtpPort=smtp_port) self._setObject(id,i) #register it if REQUEST: return self.manage_main(self,REQUEST)
461223c7f2e9e331b7ecd4fac798e4a7bbfee80f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/461223c7f2e9e331b7ecd4fac798e4a7bbfee80f/MailHost.py
def _init(self, smtpHost, smtpPort): self.smtpHost=smtpHost self.smtpPort=smtpPort def manage_makeChanges(self,title,smtpHost,smtpPort, REQUEST=None):
def _init(self, smtp_host, smtp_port): self.smtp_host=smtp_host self.smtp_port=smtp_port def manage_makeChanges(self,title,smtp_host,smtp_port, REQUEST=None):
def _init(self, smtpHost, smtpPort): self.smtpHost=smtpHost self.smtpPort=smtpPort
461223c7f2e9e331b7ecd4fac798e4a7bbfee80f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/461223c7f2e9e331b7ecd4fac798e4a7bbfee80f/MailHost.py
self.smtpHost=smtpHost self.smtpPort=smtpPort
self.smtp_host=smtp_host self.smtp_port=smtp_port
def manage_makeChanges(self,title,smtpHost,smtpPort, REQUEST=None): 'make the changes' self.title=title self.smtpHost=smtpHost self.smtpPort=smtpPort if REQUEST: return MessageDialog( title ='Changed %s' % self.__name__, message='%s has been updated' % self.id, action =REQUEST['URL2']+'/manage_main', target ='manage_main')
461223c7f2e9e331b7ecd4fac798e4a7bbfee80f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/461223c7f2e9e331b7ecd4fac798e4a7bbfee80f/MailHost.py
mailserver = SMTP(trueself.smtpHost, trueself.smtpPort)
mailserver = SMTP(trueself.smtp_host, trueself.smtp_port)
def sendTemplate(trueself, self, messageTemplate, statusTemplate=None, mto=None, mfrom=None, encode=None, REQUEST=None): 'render a mail template, then send it...' mtemplate = getattr(self, messageTemplate) messageText = mtemplate(self, trueself.REQUEST) messageText=_encode(messageText, encode) headers = extractheaders(messageText) if mto: headers['to'] = mto if mfrom: headers['from'] = mfrom for requiredHeader in ('to', 'from'): if not headers.has_key(requiredHeader): raise MailHostError,"Message missing SMTP Header '%s'"\ % requiredHeader mailserver = SMTP(trueself.smtpHost, trueself.smtpPort) mailserver.sendmail(headers['from'], headers['to'], messageText)
461223c7f2e9e331b7ecd4fac798e4a7bbfee80f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/461223c7f2e9e331b7ecd4fac798e4a7bbfee80f/MailHost.py
smtpserver = SMTP(self.smtpHost, self.smtpPort)
smtpserver = SMTP(self.smtp_host, self.smtp_port)
def send(self, messageText, mto=None, mfrom=None, subject=None, encode=None): headers = extractheaders(messageText) if not headers['subject']: messageText="subject: %s\n%s" % (subject or '[No Subject]', messageText) if mto: if type(mto) is type('s'): mto=map(string.strip, string.split(mto,',')) headers['to'] = filter(truth, mto) if mfrom: headers['from'] = mfrom for requiredHeader in ('to', 'from'): if not headers.has_key(requiredHeader): raise MailHostError,"Message missing SMTP Header '%s'"\ % requiredHeader messageText=_encode(messageText, encode) smtpserver = SMTP(self.smtpHost, self.smtpPort) smtpserver.sendmail(headers['from'],headers['to'], messageText)
461223c7f2e9e331b7ecd4fac798e4a7bbfee80f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/461223c7f2e9e331b7ecd4fac798e4a7bbfee80f/MailHost.py
smtpserver = SMTP(self.smtpHost, self.smtpPort)
smtpserver = SMTP(self.smtp_host, self.smtp_port)
def scheduledSend(self, messageText, mto=None, mfrom=None, subject=None, encode=None): headers = extractheaders(messageText)
461223c7f2e9e331b7ecd4fac798e4a7bbfee80f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/461223c7f2e9e331b7ecd4fac798e4a7bbfee80f/MailHost.py
mailserver = SMTP(self.smtphost, self.smtpport)
mailserver = SMTP(self.smtp_host, self.smtp_port)
def simple_send(self, mto, mfrom, subject, body): body="from: %s\nto: %s\nsubject: %s\n\n%s" % ( mfrom, mto, subject, body) mailserver = SMTP(self.smtphost, self.smtpport) mailserver.sendmail(mfrom, mto, body)
461223c7f2e9e331b7ecd4fac798e4a7bbfee80f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/461223c7f2e9e331b7ecd4fac798e4a7bbfee80f/MailHost.py
verify = getpass.getpass("Vefify password: ")
verify = getpass.getpass("Verify password: ")
def main(argv): short_options = ':u:p:e:d:' long_options = ['username=', 'password=', 'encoding=', 'domains='] usage = """%s [options] filename
9dd00a1d38a4db24088a51cfe9332adccd0c2215 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/9dd00a1d38a4db24088a51cfe9332adccd0c2215/zpasswd.py
''.string.join(combined).rstrip()
''.join(combined).rstrip()
def fancy_replace(a, alo, ahi, b, blo, bhi): if TRACE: print '*** fancy_replace', alo, ahi, blo, bhi dump('>', a, alo, ahi) dump('<', b, blo, bhi) # don't synch up unless the lines have a similarity score of at # least cutoff; best_ratio tracks the best score seen so far best_ratio, cutoff = 0.74, 0.75 cruncher = SequenceMatcher(IS_CHARACTER_JUNK) eqi, eqj = None, None # 1st indices of equal lines (if any) # search for the pair that matches best without being identical # (identical lines must be junk lines, & we don't want to synch up # on junk -- unless we have to) for j in xrange(blo, bhi): bj = b[j] cruncher.set_seq2(bj) for i in xrange(alo, ahi): ai = a[i] if ai == bj: if eqi is None: eqi, eqj = i, j continue cruncher.set_seq1(ai) # computing similarity is expensive, so use the quick # upper bounds first -- have seen this speed up messy # compares by a factor of 3. # note that ratio() is only expensive to compute the first # time it's called on a sequence pair; the expensive part # of the computation is cached by cruncher if cruncher.real_quick_ratio() > best_ratio and \ cruncher.quick_ratio() > best_ratio and \ cruncher.ratio() > best_ratio: best_ratio, best_i, best_j = cruncher.ratio(), i, j if best_ratio < cutoff: # no non-identical "pretty close" pair if eqi is None: # no identical pair either -- treat it as a straight replace plain_replace(a, alo, ahi, b, blo, bhi) return # no close pair, but an identical pair -- synch up on that best_i, best_j, best_ratio = eqi, eqj, 1.0 else: # there's a close pair, so forget the identical pair (if any) eqi = None # a[best_i] very similar to b[best_j]; eqi is None iff they're not # identical if TRACE: print '*** best_ratio', best_ratio, best_i, best_j dump('>', a, best_i, best_i+1) dump('<', b, best_j, best_j+1) # pump out diffs from before the synch point fancy_helper(a, alo, best_i, b, blo, best_j) # do intraline marking on the synch pair aelt, belt = a[best_i], b[best_j] if eqi is None: # pump out a '-', '+', '?' triple for the synched lines; atags = btags = "" cruncher.set_seqs(aelt, belt) for tag, ai1, ai2, bj1, bj2 in cruncher.get_opcodes(): la, lb = ai2 - ai1, bj2 - bj1 if tag == 'replace': atags = atags + '.' * la btags = btags + '.' * lb elif tag == 'delete': atags = atags + '.' * la elif tag == 'insert': btags = btags + '.' * lb elif tag == 'equal': atags = atags + ' ' * la btags = btags + ' ' * lb else: raise ValueError, 'unknown tag ' + `tag` la, lb = len(atags), len(btags) if la < lb: atags = atags + ' ' * (lb - la) elif lb < la: btags = btags + ' ' * (la - lb) combined = map(lambda x,y: _combine[x+y], atags, btags) print '-', aelt, '+', belt, '?', \ ''.string.join(combined).rstrip() else: # the synch pair is identical print ' ', aelt, # pump out diffs from after the synch point fancy_helper(a, best_i+1, ahi, b, best_j+1, bhi)
29ca2ebc58e2054c7d8fda3fe8861b49b233e086 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/29ca2ebc58e2054c7d8fda3fe8861b49b233e086/ndiff.py
{'id':'getlastmodified', 'mode':'r'},
def v_self(self): return self.aq_parent.aq_parent
25107e3695e73b443e1d852b12aad68c9fdbe5e1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/25107e3695e73b443e1d852b12aad68c9fdbe5e1/PropertySheets.py
vself=self.v_self() if hasattr(vself, '_p_mtime'): return rfc1123_date(vself._p_mtime) return ''
return rfc1123_date(self.v_self()._p_mtime)
def dav__getlastmodified(self): vself=self.v_self() if hasattr(vself, '_p_mtime'): return rfc1123_date(vself._p_mtime) return ''
25107e3695e73b443e1d852b12aad68c9fdbe5e1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/25107e3695e73b443e1d852b12aad68c9fdbe5e1/PropertySheets.py
print "<%s>" % tag
def finish_starttag(self, tag, attrs): self.scan_xmlns(attrs) if tag in EMPTY_HTML_TAGS: print "<%s>" % tag self.pop_xmlns() elif tag in CLOSING_BLOCK_LEVEL_HTML_TAGS: close_to = -1 for i in range(len(self.tagstack)): t = self.tagstack[i] if t in CLOSING_BLOCK_LEVEL_HTML_TAGS: close_to = i elif t in BLOCK_LEVEL_HTML_TAGS: close_to = -1 self._close_to_level(close_to) self.tagstack.append(tag) elif tag in PARA_LEVEL_HTML_TAGS + BLOCK_LEVEL_HTML_TAGS: close_to = -1 for i in range(len(self.tagstack)): if self.tagstack[i] in BLOCK_LEVEL_HTML_TAGS: close_to = -1 elif self.tagstack[i] in PARA_LEVEL_HTML_TAGS: if close_to == -1: close_to = i self.tagstack.append(tag) self._close_to_level(close_to) else: self.tagstack.append(tag) self.gen.emitStartTag(tag, attrs)
8d8e57a51c5bd48a4a4d431cc457cd206866ad79 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/8d8e57a51c5bd48a4a4d431cc457cd206866ad79/HTMLTALParser.py
self._close_to_level(close_to)
def finish_starttag(self, tag, attrs): self.scan_xmlns(attrs) if tag in EMPTY_HTML_TAGS: print "<%s>" % tag self.pop_xmlns() elif tag in CLOSING_BLOCK_LEVEL_HTML_TAGS: close_to = -1 for i in range(len(self.tagstack)): t = self.tagstack[i] if t in CLOSING_BLOCK_LEVEL_HTML_TAGS: close_to = i elif t in BLOCK_LEVEL_HTML_TAGS: close_to = -1 self._close_to_level(close_to) self.tagstack.append(tag) elif tag in PARA_LEVEL_HTML_TAGS + BLOCK_LEVEL_HTML_TAGS: close_to = -1 for i in range(len(self.tagstack)): if self.tagstack[i] in BLOCK_LEVEL_HTML_TAGS: close_to = -1 elif self.tagstack[i] in PARA_LEVEL_HTML_TAGS: if close_to == -1: close_to = i self.tagstack.append(tag) self._close_to_level(close_to) else: self.tagstack.append(tag) self.gen.emitStartTag(tag, attrs)
8d8e57a51c5bd48a4a4d431cc457cd206866ad79 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/8d8e57a51c5bd48a4a4d431cc457cd206866ad79/HTMLTALParser.py
self.finish_endtag(t)
self.finish_endtag(t, implied=1)
def _close_to_level(self, close_to): if close_to > -1: closing = self.tagstack[close_to:] closing.reverse() for t in closing: self.finish_endtag(t)
8d8e57a51c5bd48a4a4d431cc457cd206866ad79 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/8d8e57a51c5bd48a4a4d431cc457cd206866ad79/HTMLTALParser.py
def finish_endtag(self, tag): if tag not in EMPTY_HTML_TAGS: assert tag in self.tagstack while self.tagstack[-1] != tag: self.finish_endtag(self.tagstack[-1]) self.tagstack.pop() self.pop_xmlns() self.gen.emitEndTag(tag)
def finish_endtag(self, tag, implied=0): if tag in EMPTY_HTML_TAGS: return assert tag in self.tagstack while self.tagstack[-1] != tag: self.finish_endtag(self.tagstack[-1], implied=1) self.tagstack.pop() self.pop_xmlns() if implied \ and tag in TIGHTEN_IMPLICIT_CLOSE_TAGS \ and self.gen.program \ and self.gen.program[-1][0] == "rawtext": data = self.gen.program.pop()[1] prefix = string.rstrip(data) white = data[len(prefix):] if data: self.gen.emitRawText(prefix) self.gen.emitEndTag(tag) if white: self.gen.emitRawText(white) else: self.gen.emitEndTag(tag)
def finish_endtag(self, tag): if tag not in EMPTY_HTML_TAGS: assert tag in self.tagstack while self.tagstack[-1] != tag: self.finish_endtag(self.tagstack[-1]) self.tagstack.pop() self.pop_xmlns() self.gen.emitEndTag(tag)
8d8e57a51c5bd48a4a4d431cc457cd206866ad79 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/8d8e57a51c5bd48a4a4d431cc457cd206866ad79/HTMLTALParser.py
try: error_type=error_type.__name__ except: pass
if hasattr(error_type, '__name__'): error_type=error_type.__name__
def raise_standardErrorMessage( self, client=None, REQUEST={}, error_type=None, error_value=None, tb=None, error_tb=None, error_message='', tagSearch=regex.compile('[a-zA-Z]>').search):
9374afaa368952ac209b2b9c9a69657d9ecd8993 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/9374afaa368952ac209b2b9c9a69657d9ecd8993/SimpleItem.py
def test(*args, **kw):
def debug(*args, **kw):
def test(*args, **kw): return apply(ZPublisher.test,('Zope',)+args, kw)
36eb9b05dcece375e12712c07429161393647982 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/36eb9b05dcece375e12712c07429161393647982/__init__.py
self.setCookie(name,value) def expireCookie(self, name):
cookies=self.cookies if cookies.has_key(name): cookie=cookies[name] else: cookie=cookies[name]={} if cookie.has_key('value'): cookie['value']='%s:%s' % (cookie['value'], value) else: cookie['value']=value def expireCookie(self, name, **kw):
def appendCookie(self, name, value):
349fac2452df2de544bd34705932de86103ab82e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/349fac2452df2de544bd34705932de86103ab82e/Response.py
that has already passed. ''' self.setCookie(name,'deleted', max_age=0)
that has already passed. Note that some clients require a path to be specified - this path must exactly match the path given when creating the cookie. The path can be specified as a keyword argument. ''' dict={'max_age':0, 'expires':'Wed, 31-Dec-97 23:59:59 GMT'} for k, v in kw.items(): dict[k]=v apply(Response.setCookie, (self, name, 'deleted'), dict)
def expireCookie(self, name):
349fac2452df2de544bd34705932de86103ab82e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/349fac2452df2de544bd34705932de86103ab82e/Response.py
if cookies.has_key(name): cookie=cookies[name]
if cookies.has_key(name): cookie=cookies[name]
def setCookie(self,name,value,**kw):
349fac2452df2de544bd34705932de86103ab82e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/349fac2452df2de544bd34705932de86103ab82e/Response.py
for k, v in kw.items(): cookie[k]=v
for k, v in kw.items(): cookie[k]=v
def setCookie(self,name,value,**kw):
349fac2452df2de544bd34705932de86103ab82e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/349fac2452df2de544bd34705932de86103ab82e/Response.py