rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
class _TextTestResult(TestResult):
class _JUnitTextTestResult(TestResult):
def writeln(self, *args): if args: apply(self.write, args) self.write(os.linesep)
fac958bd81e4609cbbce6fe5e9a0e95fb8305459 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/fac958bd81e4609cbbce6fe5e9a0e95fb8305459/unittest.py
self.printNumberedErrors('error',self.errors)
self.printNumberedErrors("error",self.errors)
def printErrors(self): self.printNumberedErrors('error',self.errors)
fac958bd81e4609cbbce6fe5e9a0e95fb8305459 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/fac958bd81e4609cbbce6fe5e9a0e95fb8305459/unittest.py
self.printNumberedErrors('failure',self.failures)
self.printNumberedErrors("failure",self.failures)
def printFailures(self): self.printNumberedErrors('failure',self.failures)
fac958bd81e4609cbbce6fe5e9a0e95fb8305459 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/fac958bd81e4609cbbce6fe5e9a0e95fb8305459/unittest.py
self.stream.writeln("Run: %i ; Failures: %i; Errors: %i" %
self.stream.writeln("Run: %i ; Failures: %i ; Errors: %i" %
def printHeader(self): self.stream.writeln() if self.wasSuccessful(): self.stream.writeln("OK (%i tests)" % self.testsRun) else: self.stream.writeln("!!!FAILURES!!!") self.stream.writeln("Test Results") self.stream.writeln() self.stream.writeln("Run: %i ; Failures: %i; Errors: %i" % (self.testsRun, len(self.failures), len(self.errors)))
fac958bd81e4609cbbce6fe5e9a0e95fb8305459 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/fac958bd81e4609cbbce6fe5e9a0e95fb8305459/unittest.py
class TextTestRunner:
class JUnitTextTestRunner:
def printResult(self): self.printHeader() self.printErrors() self.printFailures()
fac958bd81e4609cbbce6fe5e9a0e95fb8305459 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/fac958bd81e4609cbbce6fe5e9a0e95fb8305459/unittest.py
Uses TextTestResult.
The display format approximates that of JUnit's 'textui' test runner. This test runner may be removed in a future version of PyUnit.
def printResult(self): self.printHeader() self.printErrors() self.printFailures()
fac958bd81e4609cbbce6fe5e9a0e95fb8305459 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/fac958bd81e4609cbbce6fe5e9a0e95fb8305459/unittest.py
"""Run the given test case or test suite. """ result = _TextTestResult(self.stream)
"Run the given test case or test suite." result = _JUnitTextTestResult(self.stream)
def run(self, test): """Run the given test case or test suite. """ result = _TextTestResult(self.stream) startTime = time.time() test(result) stopTime = time.time() self.stream.writeln() self.stream.writeln("Time: %.3fs" % float(stopTime - startTime)) result.printResult() return result
fac958bd81e4609cbbce6fe5e9a0e95fb8305459 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/fac958bd81e4609cbbce6fe5e9a0e95fb8305459/unittest.py
def createTestInstance(name): """Looks up and calls a callable object by its string name, which should include its module name, e.g. 'widgettests.WidgetTestSuite'. """ if '.' not in name: raise ValueError,"Incomplete name; expected 'package.suiteobj'" dotPos = string.rfind(name,'.') last = name[dotPos+1:] if not len(last): raise ValueError,"Malformed classname" pkg = name[:dotPos] try: testCreator = getattr(__import__(pkg,globals(),locals(),[last]),last) except AttributeError, e: raise ImportError, \ "No object '%s' found in package '%s'" % (last,pkg) if not callable(testCreator): raise ValueError, "'%s' is not callable" % name try: test = testCreator() except: raise TypeError, \ "Error making a test instance by calling '%s'" % testCreator if not hasattr(test,"countTestCases"): raise TypeError, \ "Calling '%s' returned '%s', which is not a test case or suite" \ % (name,test) return test def getTestCaseNames(testCaseClass, prefix, sortUsing=cmp): """Extracts all the names of functions in the given test case class and its base classes that start with the given prefix. This is used by makeSuite(). """ testFnNames = filter(lambda n,p=prefix: n[:len(p)] == p, dir(testCaseClass)) for baseclass in testCaseClass.__bases__: testFnNames = testFnNames + \ getTestCaseNames(baseclass, prefix, sortUsing=None) if sortUsing: testFnNames.sort(sortUsing) return testFnNames def makeSuite(testCaseClass, prefix='test', sortUsing=cmp): """Returns a TestSuite instance built from all of the test functions in the given test case class whose names begin with the given prefix. The cases are sorted by their function names using the supplied comparison function, which defaults to 'cmp'. """ cases = map(testCaseClass, getTestCaseNames(testCaseClass, prefix, sortUsing)) return TestSuite(cases)
class _VerboseTextTestResult(TestResult): """A test result class that can print formatted text results to a stream. Used by VerboseTextTestRunner. """ def __init__(self, stream, descriptions): TestResult.__init__(self) self.stream = stream self.lastFailure = None self.descriptions = descriptions def startTest(self, test): TestResult.startTest(self, test) if self.descriptions: self.stream.write(test.shortDescription() or str(test)) else: self.stream.write(str(test)) self.stream.write(" ... ") def stopTest(self, test): TestResult.stopTest(self, test) if self.lastFailure is not test: self.stream.writeln("ok") def addError(self, test, err): TestResult.addError(self, test, err) self._printError("ERROR", test, err) self.lastFailure = test if err[0] is KeyboardInterrupt: self.shouldStop = 1 def addFailure(self, test, err): TestResult.addFailure(self, test, err) self._printError("FAIL", test, err) self.lastFailure = test def _printError(self, flavour, test, err): errLines = [] separator1 = "\t" + '=' * 70 separator2 = "\t" + '-' * 70 if not self.lastFailure is test: self.stream.writeln() self.stream.writeln(separator1) self.stream.writeln("\t%s" % flavour) self.stream.writeln(separator2) for line in apply(traceback.format_exception, err): for l in string.split(line,"\n")[:-1]: self.stream.writeln("\t%s" % l) self.stream.writeln(separator1) class VerboseTextTestRunner: """A test runner class that displays results in textual form. It prints out the names of tests as they are run, errors as they occur, and a summary of the results at the end of the test run. """ def __init__(self, stream=sys.stderr, descriptions=1): self.stream = _WritelnDecorator(stream) self.descriptions = descriptions def run(self, test): "Run the given test case or test suite." result = _VerboseTextTestResult(self.stream, self.descriptions) startTime = time.time() test(result) stopTime = time.time() timeTaken = float(stopTime - startTime) self.stream.writeln("-" * 78) run = result.testsRun self.stream.writeln("Ran %d test%s in %.3fs" % (run, run > 1 and "s" or "", timeTaken)) self.stream.writeln() if not result.wasSuccessful(): self.stream.write("FAILED (") failed, errored = map(len, (result.failures, result.errors)) if failed: self.stream.write("failures=%d" % failed) if errored: if failed: self.stream.write(", ") self.stream.write("errors=%d" % errored) self.stream.writeln(")") else: self.stream.writeln("OK") return result TextTestRunner = VerboseTextTestRunner class TestProgram: """A command-line program that runs a set of tests; this is primarily for making test modules conveniently executable. """ USAGE = """\ Usage: %(progName)s [-h|--help] [test[:(casename|prefix-)]] [...] Examples: %(progName)s - run default set of tests %(progName)s MyTestSuite - run suite 'MyTestSuite' %(progName)s MyTestCase:checkSomething - run MyTestCase.checkSomething %(progName)s MyTestCase:check- - run all 'check*' test methods in MyTestCase """ def __init__(self, module='__main__', defaultTest=None, argv=None, testRunner=None): if type(module) == type(''): self.module = __import__(module) for part in string.split(module,'.')[1:]: self.module = getattr(self.module, part) else: self.module = module if argv is None: argv = sys.argv self.defaultTest = defaultTest self.testRunner = testRunner self.progName = os.path.basename(argv[0]) self.parseArgs(argv) self.createTests() self.runTests() def usageExit(self, msg=None): if msg: print msg print self.USAGE % self.__dict__ sys.exit(2) def parseArgs(self, argv): import getopt try: options, args = getopt.getopt(argv[1:], 'hH', ['help']) opts = {} for opt, value in options: if opt in ('-h','-H','--help'): self.usageExit() if len(args) == 0 and self.defaultTest is None: raise getopt.error, "No default test is defined." if len(args) > 0: self.testNames = args else: self.testNames = (self.defaultTest,) except getopt.error, msg: self.usageExit(msg) def createTests(self): tests = [] for testName in self.testNames: tests.append(createTestInstance(testName, self.module)) self.test = TestSuite(tests) def runTests(self): if self.testRunner is None: self.testRunner = TextTestRunner() result = self.testRunner.run(self.test) sys.exit(not result.wasSuccessful()) main = TestProgram
def createTestInstance(name): """Looks up and calls a callable object by its string name, which should include its module name, e.g. 'widgettests.WidgetTestSuite'. """ if '.' not in name: raise ValueError,"Incomplete name; expected 'package.suiteobj'" dotPos = string.rfind(name,'.') last = name[dotPos+1:] if not len(last): raise ValueError,"Malformed classname" pkg = name[:dotPos] try: testCreator = getattr(__import__(pkg,globals(),locals(),[last]),last) except AttributeError, e: raise ImportError, \ "No object '%s' found in package '%s'" % (last,pkg) if not callable(testCreator): raise ValueError, "'%s' is not callable" % name try: test = testCreator() except: raise TypeError, \ "Error making a test instance by calling '%s'" % testCreator if not hasattr(test,"countTestCases"): raise TypeError, \ "Calling '%s' returned '%s', which is not a test case or suite" \ % (name,test) return test
fac958bd81e4609cbbce6fe5e9a0e95fb8305459 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/fac958bd81e4609cbbce6fe5e9a0e95fb8305459/unittest.py
if len(sys.argv) == 2 and sys.argv[1] not in ('-help','-h','--help'): testClass = createTestInstance(sys.argv[1]) result = TextTestRunner().run(testClass) if result.wasSuccessful(): sys.exit(0) else: sys.exit(1) else: print "usage:", sys.argv[0], "package1.YourTestSuite" sys.exit(2)
main(module=None)
def makeSuite(testCaseClass, prefix='test', sortUsing=cmp): """Returns a TestSuite instance built from all of the test functions in the given test case class whose names begin with the given prefix. The cases are sorted by their function names using the supplied comparison function, which defaults to 'cmp'. """ cases = map(testCaseClass, getTestCaseNames(testCaseClass, prefix, sortUsing)) return TestSuite(cases)
fac958bd81e4609cbbce6fe5e9a0e95fb8305459 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/fac958bd81e4609cbbce6fe5e9a0e95fb8305459/unittest.py
def cache_detail(self): try: db=self._p_jar.db() except: detail={} for oid, ob in Globals.Bobobase._jar.cache.items(): if hasattr(ob, '__class__'): ob=ob.__class__ decor='' else: decor=' class' c="%s.%s%s" % (ob.__module__ or '', ob.__name__, decor) if detail.has_key(c): detail[c]=detail[c]+1 else: detail[c]=1 detail=detail.items() else: detail=db.cacheDetail() detail=map(lambda d: (("%s.%s" % (d[0].__module__, d[0].__name__)), d[1]), detail.items()) detail.sort() return detail def cache_extreme_detail(self): try: db=self._p_jar.db() except: detail=[] rc=sys.getrefcount db=Globals.Bobobase._jar.db for oid, ob in Globals.Bobobase._jar.cache.items(): id=oid if hasattr(ob, '__class__'): if hasattr(ob,'__dict__'): d=ob.__dict__ if d.has_key('id'): id="%s (%s)" % (oid, d['id']) elif d.has_key('__name__'): id="%s (%s)" % (oid, d['__name__']) ob=ob.__class__ decor='' else: decor=' class' detail.append({ 'oid': id, 'klass': "%s.%s%s" % (ob.__module__, ob.__name__, decor), 'rc': rc(ob)-4, 'references': db.objectReferencesIn(oid), })
def cache_detail(self, REQUEST=None): """ Returns the name of the classes of the objects in the cache and the number of objects in the cache for each class. """ db=self._p_jar.db() detail = db.cacheDetail() if REQUEST is not None: REQUEST.RESPONSE.setHeader('Content-Type', 'text/plain') return string.join(map(lambda (name, count): '%6d %s' % (count, name), detail), '\n') else:
def cache_detail(self): try: db=self._p_jar.db() except: # BoboPOS2 detail={} for oid, ob in Globals.Bobobase._jar.cache.items(): if hasattr(ob, '__class__'): ob=ob.__class__ decor='' else: decor=' class' c="%s.%s%s" % (ob.__module__ or '', ob.__name__, decor) if detail.has_key(c): detail[c]=detail[c]+1 else: detail[c]=1 detail=detail.items() else: # ZODB 3 detail=db.cacheDetail() detail=map(lambda d: (("%s.%s" % (d[0].__module__, d[0].__name__)), d[1]), detail.items())
dcd0edcaa04205b5837e8b007af641aa19cf23d8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/dcd0edcaa04205b5837e8b007af641aa19cf23d8/CacheManager.py
else: return db.cacheExtremeDetail()
def cache_extreme_detail(self, REQUEST=None): """ Returns information about each object in the cache. """ db=self._p_jar.db() detail = db.cacheExtremeDetail() if REQUEST is not None: lst = map(lambda dict: ((dict['conn_no'], dict['oid']), dict), detail) lst.sort() res = [ ' 'and class.', ' for sortkey, dict in lst: id = dict.get('id', None) if id: idinfo = ' (%s)' % id else: idinfo = '' s = dict['state'] if s == 0: state = 'L' elif s == 1: state = 'C' else: state = 'G' res.append('%d %-34s %6d %s %s%s' % ( dict['conn_no'], `dict['oid']`, dict['rc'], state, dict['klass'], idinfo)) REQUEST.RESPONSE.setHeader('Content-Type', 'text/plain') return string.join(res, '\n') else: return detail
def cache_extreme_detail(self): try: db=self._p_jar.db() except: # BoboPOS2 detail=[] rc=sys.getrefcount db=Globals.Bobobase._jar.db for oid, ob in Globals.Bobobase._jar.cache.items(): id=oid
dcd0edcaa04205b5837e8b007af641aa19cf23d8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/dcd0edcaa04205b5837e8b007af641aa19cf23d8/CacheManager.py
getattr(self, id).write(file)
self._getOb(id).write(file)
def manage_addPythonScript(self, id, REQUEST=None): """Add a Python script to a folder. """ id = str(id) id = self._setObject(id, PythonScript(id)) if REQUEST is not None: file = REQUEST.form.get('file', None) if file: if type(file) is not type(''): file = file.read() getattr(self, id).write(file) try: u = self.DestinationURL() except: u = REQUEST['URL1'] REQUEST.RESPONSE.redirect('%s/%s/manage_main' % (u, quote(id))) return ''
916c5be9775cc7add586069cb81b01ab3746f1d4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/916c5be9775cc7add586069cb81b01ab3746f1d4/PythonScript.py
content_type='application/octet-stream'
type='application/octet-stream'
def PUT(self, REQUEST, RESPONSE): """Adds a document, image or file to the folder when a PUT request is received.""" name=self.id type=REQUEST.get_header('content-type', None) body=REQUEST.get('BODY', '') if type is None: type, enc=mimetypes.guess_type(name) if type is None: if content_types.find_binary(body) >= 0: content_type='application/octet-stream' else: type=content_types.text_type(body) type=lower(type) if type in ('text/html', 'text/xml', 'text/plain'): self.__parent__.manage_addDTMLDocument(name, '', body) elif type[:6]=='image/': ob=Image(name, '', body, content_type=type) self.__parent__._setObject(name, ob) else: ob=File(name, '', body, content_type=type) self.__parent__._setObject(name, ob) RESPONSE.setStatus(201) RESPONSE.setBody('') return RESPONSE
3ab7fd4e93c3305fe534b8dada23670ed06c9b1b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/3ab7fd4e93c3305fe534b8dada23670ed06c9b1b/Folder.py
self.extends.append(names[2], url)
self.extends.append((names[2], url))
def __init__(self, klass): # Creates an APIDoc instance given a python class. # the class describes the API; it contains # methods, arguments and doc strings. # # The name of the API is deduced from the name # of the class. # # The base APIs are deduced from the __extends__ # attribute. self.name=klass.__name__ self.doc=trim_doc_string(klass.__doc__) if hasattr(klass,'__extends__'): self.extends=[] for base in klass.__extends__: names=string.split(base, '.') url="%s/Help/%s.py#%s" % (names[0], names[1], names[2]) self.extends.append(names[2], url) # Get info on methods and attributes, ignore special items self.attributes=[] self.methods=[] for k,v in klass.__dict__.items(): if k not in ('__extends__', '__doc__'): if type(v)==types.FunctionType: self.methods.append(MethodDoc(v)) else: self.attributes.append(AttributeDoc(k, v))
9e595533da4755a1db48b13796679c002f23a009 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/9e595533da4755a1db48b13796679c002f23a009/APIHelpTopic.py
r=db().undoLog()
r=db().undoLog(first_transaction, last_transaction)
def undoable_transactions(self, AUTHENTICATION_PATH=None, first_transaction=None, last_transaction=None, PrincipiaUndoBatchSize=None):
2c0fd90a5ec78284b2e81354a10de8269d71305f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/2c0fd90a5ec78284b2e81354a10de8269d71305f/Undo.py
for d in r: r['time']=DateTime(r['time'])
for d in r: d['time']=DateTime(d['time'])
def undoable_transactions(self, AUTHENTICATION_PATH=None, first_transaction=None, last_transaction=None, PrincipiaUndoBatchSize=None):
2c0fd90a5ec78284b2e81354a10de8269d71305f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/2c0fd90a5ec78284b2e81354a10de8269d71305f/Undo.py
self.__attrs=attrs
def __init__(self, name, bases=(), attrs=None, __doc__=None): """Create a new interface """ for b in bases: if not isinstance(b, Interface): raise TypeError, 'Expected base interfaces' self.__bases__=bases self.__name__=name
1e479c3ef6694168b5a56840a052f5efd32ef517 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/1e479c3ef6694168b5a56840a052f5efd32ef517/iclass.py
if __doc__ is not None: self.__doc__=__doc__
if __doc__ is not None: self.__doc__=__doc__ else: self.__doc__ = ""
def __init__(self, name, bases=(), attrs=None, __doc__=None): """Create a new interface """ for b in bases: if not isinstance(b, Interface): raise TypeError, 'Expected base interfaces' self.__bases__=bases self.__name__=name
1e479c3ef6694168b5a56840a052f5efd32ef517 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/1e479c3ef6694168b5a56840a052f5efd32ef517/iclass.py
for k, v in self.__dict__.items():
for k, v in self.__attrs.items():
def __d(self, dict):
1e479c3ef6694168b5a56840a052f5efd32ef517 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/1e479c3ef6694168b5a56840a052f5efd32ef517/iclass.py
dtpref_cols='50', dtpref_rows='20'):
dtpref_cols='100%', dtpref_rows='20'):
def pt_changePrefs(self, REQUEST, height=None, width=None, dtpref_cols='50', dtpref_rows='20'): """Change editing preferences.""" # The <textarea> can have dimensions expressed in percentages; # strip the percent sign so int() below won't fail if dtpref_cols[-1:] == "%": dtpref_cols = dtpref_cols[:-1] or '50' if dtpref_rows[-1:] == "%": dtpref_rows = dtpref_rows[:-1] or '20' szchh = {'Taller': 1, 'Shorter': -1, None: 0} szchw = {'Wider': 5, 'Narrower': -5, None: 0} try: rows = int(height) except: rows = max(1, int(dtpref_rows) + szchh.get(height, 0)) try: cols = int(width) except: cols = max(40, int(dtpref_cols) + szchw.get(width, 0)) e = (DateTime('GMT') + 365).rfc822() setc = REQUEST['RESPONSE'].setCookie setc('dtpref_rows', str(rows), path='/', expires=e) setc('dtpref_cols', str(cols), path='/', expires=e) REQUEST.form.update({'dtpref_cols': cols, 'dtpref_rows': rows}) return self.manage_main()
537a21a6fc3d202925bbb3c4ac9cc86776310a89 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/537a21a6fc3d202925bbb3c4ac9cc86776310a89/ZopePageTemplate.py
if dtpref_cols[-1:] == "%": dtpref_cols = dtpref_cols[:-1] or '50' if dtpref_rows[-1:] == "%": dtpref_rows = dtpref_rows[:-1] or '20'
def pt_changePrefs(self, REQUEST, height=None, width=None, dtpref_cols='50', dtpref_rows='20'): """Change editing preferences.""" # The <textarea> can have dimensions expressed in percentages; # strip the percent sign so int() below won't fail if dtpref_cols[-1:] == "%": dtpref_cols = dtpref_cols[:-1] or '50' if dtpref_rows[-1:] == "%": dtpref_rows = dtpref_rows[:-1] or '20' szchh = {'Taller': 1, 'Shorter': -1, None: 0} szchw = {'Wider': 5, 'Narrower': -5, None: 0} try: rows = int(height) except: rows = max(1, int(dtpref_rows) + szchh.get(height, 0)) try: cols = int(width) except: cols = max(40, int(dtpref_cols) + szchw.get(width, 0)) e = (DateTime('GMT') + 365).rfc822() setc = REQUEST['RESPONSE'].setCookie setc('dtpref_rows', str(rows), path='/', expires=e) setc('dtpref_cols', str(cols), path='/', expires=e) REQUEST.form.update({'dtpref_cols': cols, 'dtpref_rows': rows}) return self.manage_main()
537a21a6fc3d202925bbb3c4ac9cc86776310a89 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/537a21a6fc3d202925bbb3c4ac9cc86776310a89/ZopePageTemplate.py
try: cols = int(width) except: cols = max(40, int(dtpref_cols) + szchw.get(width, 0))
def pt_changePrefs(self, REQUEST, height=None, width=None, dtpref_cols='50', dtpref_rows='20'): """Change editing preferences.""" # The <textarea> can have dimensions expressed in percentages; # strip the percent sign so int() below won't fail if dtpref_cols[-1:] == "%": dtpref_cols = dtpref_cols[:-1] or '50' if dtpref_rows[-1:] == "%": dtpref_rows = dtpref_rows[:-1] or '20' szchh = {'Taller': 1, 'Shorter': -1, None: 0} szchw = {'Wider': 5, 'Narrower': -5, None: 0} try: rows = int(height) except: rows = max(1, int(dtpref_rows) + szchh.get(height, 0)) try: cols = int(width) except: cols = max(40, int(dtpref_cols) + szchw.get(width, 0)) e = (DateTime('GMT') + 365).rfc822() setc = REQUEST['RESPONSE'].setCookie setc('dtpref_rows', str(rows), path='/', expires=e) setc('dtpref_cols', str(cols), path='/', expires=e) REQUEST.form.update({'dtpref_cols': cols, 'dtpref_rows': rows}) return self.manage_main()
537a21a6fc3d202925bbb3c4ac9cc86776310a89 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/537a21a6fc3d202925bbb3c4ac9cc86776310a89/ZopePageTemplate.py
def testResolveUrl(self): # Check that ResolveUrl really raises the same error
81025cda3d9c7eb023cefe9a94cdefc370f1bbc5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/81025cda3d9c7eb023cefe9a94cdefc370f1bbc5/testHTTPRequest.py
from zExceptions import NotFound env = TEST_ENVIRON.copy() req = HTTPRequest(None, env, None) req['PARENTS'] = ['Nobody', 'cares', 'here'] testmethod = req.resolve_url self.assertRaises(NotFound, testmethod, 'http://localhost/does_not_exist')
from zExceptions import NotFound env = TEST_ENVIRON.copy() req = HTTPRequest(None, env, None) req['PARENTS'] = ['Nobody', 'cares', 'here'] testmethod = req.resolve_url self.assertRaises(NotFound, testmethod, 'http://localhost/does_not_exist')
def testResolveUrl(self): # Check that ResolveUrl really raises the same error
81025cda3d9c7eb023cefe9a94cdefc370f1bbc5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/81025cda3d9c7eb023cefe9a94cdefc370f1bbc5/testHTTPRequest.py
if file and (type(file) is type('') or hasattr(file, 'content-type')):
if file and (type(file) is type('') or file.filename):
def manage_edit(self, meta_type='', icon='', file='', REQUEST=None): """Set basic item properties. """ if meta_type: self.setClassAttr('meta_type', meta_type)
97201e832883bdf3289275e29b5640d18012580d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/97201e832883bdf3289275e29b5640d18012580d/Basic.py
db_name = ApplicationManager.db_name db_size = ApplicationManager.db_size manage_pack = ApplicationManager.manage_pack
db_name = ApplicationManager.db_name.im_func db_size = ApplicationManager.db_size.im_func manage_pack = ApplicationManager.manage_pack.im_func
def objectIds(self, spec=None): """ this is a patch for pre-2.4 Zope installations. Such installations don't have an entry for the WebDAV LockManager introduced in 2.4. """
10fff08a067353e96fbc2101e0e898c1a0cce320 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/10fff08a067353e96fbc2101e0e898c1a0cce320/ApplicationManager.py
return folder._getOb(i.id)
id = i.getId() return folder._getOb(id)
def createInObjectManager(self, id, REQUEST, RESPONSE=None): """ Create Z instance. If called with a RESPONSE, the RESPONSE will be redirected to the management screen of the new instance's parent Folder. Otherwise, the instance will be returned. """ i=mapply(self._zclass_, (), REQUEST) try: i._setId(id) except AttributeError: i.id=id folder=durl=None if hasattr(self, 'Destination'): d=self.Destination if d.im_self.__class__ is FactoryDispatcher: folder=d() if folder is None: folder=self.aq_parent if not hasattr(folder,'_setObject'): folder=folder.aq_parent
ec461eb93b9542e6894df16ae36608cb01b10129 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/ec461eb93b9542e6894df16ae36608cb01b10129/ZClass.py
result[name]=value
if not already_have(name): result[name]=value
def parse_cookie(text, result=None, qparmre=regex.compile( '\([\0- ]*' '\([^\0- ;,=\"]+\)="\([^"]*\)\"' '\([\0- ]*[;,]\)?[\0- ]*\)' ), parmre=regex.compile( '\([\0- ]*' '\([^\0- ;,=\"]+\)=\([^\0;-=\"]*\)' '\([\0- ]*[;,]\)?[\0- ]*\)' ), ): if result is None: result={} if qparmre.match(text) >= 0: # Match quoted correct cookies name=qparmre.group(2) value=qparmre.group(3) l=len(qparmre.group(1)) elif parmre.match(text) >= 0: # Match evil MSIE cookies ;) name=parmre.group(2) value=parmre.group(3) l=len(parmre.group(1)) else: if not text or not strip(text): return result raise "InvalidParameter", text result[name]=value return apply(parse_cookie,(text[l:],result))
bd5142940bf866ae23c9af7b36e6caf93eb3f7b1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/bd5142940bf866ae23c9af7b36e6caf93eb3f7b1/Publish.py
def _range_request_handler(self, REQUEST, RESPONSE): # HTTP Range header handling: return True if we've served a range # chunk out of our data. range = REQUEST.get_header('Range', None) request_range = REQUEST.get_header('Request-Range', None) if request_range is not None: # Netscape 2 through 4 and MSIE 3 implement a draft version # Later on, we need to serve a different mime-type as well. range = request_range if_range = REQUEST.get_header('If-Range', None) if range is not None: ranges = HTTPRangeSupport.parseRange(range)
da718a07cc402b667f53b7c4ba586b417ae3e131 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/da718a07cc402b667f53b7c4ba586b417ae3e131/Image.py
def index_html(self, REQUEST, RESPONSE): """ The default view of the contents of a File or Image.
da718a07cc402b667f53b7c4ba586b417ae3e131 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/da718a07cc402b667f53b7c4ba586b417ae3e131/Image.py
RESPONSE.setBase(None)
RESPONSE.setBase(None)
def index_html(self, REQUEST, RESPONSE): """ The default view of the contents of a File or Image.
da718a07cc402b667f53b7c4ba586b417ae3e131 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/da718a07cc402b667f53b7c4ba586b417ae3e131/Image.py
transaction.savepoint()
transaction.savepoint(optimistic=True)
def _read_data(self, file):
da718a07cc402b667f53b7c4ba586b417ae3e131 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/da718a07cc402b667f53b7c4ba586b417ae3e131/Image.py
def _read_data(self, file):
da718a07cc402b667f53b7c4ba586b417ae3e131 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/da718a07cc402b667f53b7c4ba586b417ae3e131/Image.py
transaction.savepoint()
transaction.savepoint(optimistic=True)
def _read_data(self, file):
da718a07cc402b667f53b7c4ba586b417ae3e131 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/da718a07cc402b667f53b7c4ba586b417ae3e131/Image.py
lg = logger.syslog_logger((addr, int(port))
lg = logger.syslog_logger((addr, int(port)))
def set_locale(val): try: import locale except: raise SystemExit, ( 'The locale module could not be imported.\n' 'To use localization options, you must ensure\n' 'that the locale module is compiled into your\n' 'Python installation.' ) try: locale.setlocale(locale.LC_ALL, val) except: raise SystemExit, ( 'The specified locale is not supported by your system.\n' 'See your operating system documentation for more\n' 'information on locale support.' )
935ba2b8eb3ef1f15b6a363aa1afcf022faf0890 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/935ba2b8eb3ef1f15b6a363aa1afcf022faf0890/z2.py
for name in os.listdir(ed): suffix='' if name[:lpp]==pp: path=os.path.join(ed, name) try: f=open(path) data=f.read() f.close() if name[-3:]=='.py': data=rot.encrypt(zlib.compress(data)) suffix='p' except: data=None if data: ar.add("%sExtensions/%s%s" % (prefix,name[lpp:],suffix), data)
if os.path.exists(ed): for name in os.listdir(ed): suffix='' if name[:lpp]==pp: path=os.path.join(ed, name) try: f=open(path) data=f.read() f.close() if name[-3:]=='.py': data=rot.encrypt(zlib.compress(data)) suffix='p' except: data=None if data: ar.add("%sExtensions/%s%s" % (prefix,name[lpp:],suffix), data)
def _distribution(self): # Return a distribution if self.__dict__.has_key('manage_options'): raise TypeError, 'This product is <b>not</b> redistributable.'
475584bcfc4f12ac7d924db076ec20430da3af9a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/475584bcfc4f12ac7d924db076ec20430da3af9a/Product.py
except Except:
except AttributeError:
def index_object(self, documentId, obj, threshold=None): """ index an object 'obj' with integer id 'i'
bc531604a3c7067ab35a68651def1200f7e3cf30 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/bc531604a3c7067ab35a68651def1200f7e3cf30/UnKeywordIndex.py
finished=[] idx=0 while(idx < len(items)): name, ob = items[idx]
finished_dict={} finished = finished_dict.has_key while items: name, ob = items.pop()
def fixupZClassDependencies(self, rebuild=0): # Note that callers should not catch exceptions from this method # to ensure that the transaction gets aborted if the registry # cannot be rebuilt for some reason. Returns true if any ZClasses # were registered as a result of the call or the registry was # rebuilt. jar=self._p_jar result=0
b3cbcc17ebb543bd146fa427d70436119a037aed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b3cbcc17ebb543bd146fa427d70436119a037aed/Application.py
if base in finished: idx=idx+1
if finished(id(base)):
def fixupZClassDependencies(self, rebuild=0): # Note that callers should not catch exceptions from this method # to ensure that the transaction gets aborted if the registry # cannot be rebuilt for some reason. Returns true if any ZClasses # were registered as a result of the call or the registry was # rebuilt. jar=self._p_jar result=0
b3cbcc17ebb543bd146fa427d70436119a037aed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b3cbcc17ebb543bd146fa427d70436119a037aed/Application.py
finished.append(base)
finished_dict[id(base)] = None
def fixupZClassDependencies(self, rebuild=0): # Note that callers should not catch exceptions from this method # to ensure that the transaction gets aborted if the registry # cannot be rebuilt for some reason. Returns true if any ZClasses # were registered as a result of the call or the registry was # rebuilt. jar=self._p_jar result=0
b3cbcc17ebb543bd146fa427d70436119a037aed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b3cbcc17ebb543bd146fa427d70436119a037aed/Application.py
if hasattr(ob, '_register') and hasattr(ob, '_zclass_'): class_id=getattr(ob._zclass_, '__module__', None)
if hasattr(base,'_register') and hasattr(base,'_zclass_'): class_id=getattr(base._zclass_, '__module__', None)
def fixupZClassDependencies(self, rebuild=0): # Note that callers should not catch exceptions from this method # to ensure that the transaction gets aborted if the registry # cannot be rebuilt for some reason. Returns true if any ZClasses # were registered as a result of the call or the registry was # rebuilt. jar=self._p_jar result=0
b3cbcc17ebb543bd146fa427d70436119a037aed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b3cbcc17ebb543bd146fa427d70436119a037aed/Application.py
if hasattr(ob, 'objectItems'):
if hasattr(base, 'objectItems'):
def fixupZClassDependencies(self, rebuild=0): # Note that callers should not catch exceptions from this method # to ensure that the transaction gets aborted if the registry # cannot be rebuilt for some reason. Returns true if any ZClasses # were registered as a result of the call or the registry was # rebuilt. jar=self._p_jar result=0
b3cbcc17ebb543bd146fa427d70436119a037aed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b3cbcc17ebb543bd146fa427d70436119a037aed/Application.py
if hasattr(ob, 'propertysheets'):
if hasattr(base, 'propertysheets'):
def fixupZClassDependencies(self, rebuild=0): # Note that callers should not catch exceptions from this method # to ensure that the transaction gets aborted if the registry # cannot be rebuilt for some reason. Returns true if any ZClasses # were registered as a result of the call or the registry was # rebuilt. jar=self._p_jar result=0
b3cbcc17ebb543bd146fa427d70436119a037aed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b3cbcc17ebb543bd146fa427d70436119a037aed/Application.py
'Broken objects exist in product %s.' % product.id) idx = idx + 1
'Broken objects exist in product %s.' % product.id, error=sys.exc_info())
def fixupZClassDependencies(self, rebuild=0): # Note that callers should not catch exceptions from this method # to ensure that the transaction gets aborted if the registry # cannot be rebuilt for some reason. Returns true if any ZClasses # were registered as a result of the call or the registry was # rebuilt. jar=self._p_jar result=0
b3cbcc17ebb543bd146fa427d70436119a037aed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b3cbcc17ebb543bd146fa427d70436119a037aed/Application.py
try: keys=list(self._p_jar.root()['ZGlobals'].keys()) except: return 1
try: keys=list(self._p_jar.root()['ZGlobals'].keys()) except: LOG('Zope', ERROR, 'A problem was found when checking the global product '\ 'registry. This is probably due to a Product being '\ 'uninstalled or renamed. The traceback follows.', error=sys.exc_info()) return 1
def checkGlobalRegistry(self): """Check the global (zclass) registry for problems, which can be caused by things like disk-based products being deleted. Return true if a problem is found""" try: keys=list(self._p_jar.root()['ZGlobals'].keys()) except: return 1 return 0
b3cbcc17ebb543bd146fa427d70436119a037aed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b3cbcc17ebb543bd146fa427d70436119a037aed/Application.py
'A broken ZClass dependency was found in the global ' \ 'class registry. This is probably due to a product ' \ 'being uninstalled. The registry has successfully ' \ 'been rebuilt.')
'The global ZClass registry has successfully been rebuilt.')
def initialize(app): # Initialize the application # Initialize the cache: app.Control_Panel.initialize_cache() # The following items marked b/c are backward compatibility hacks # which make sure that expected system objects are added to the # bobobase. This is required because the bobobase in use may pre- # date the introduction of certain system objects such as those # which provide Lever support. # b/c: Ensure that Control Panel exists. if not hasattr(app, 'Control_Panel'): cpl=ApplicationManager() cpl._init() app._setObject('Control_Panel', cpl) get_transaction().note('Added Control_Panel') get_transaction().commit() # b/c: Ensure that a ProductFolder exists. if not hasattr(app.Control_Panel.aq_base, 'Products'): app.Control_Panel.Products=App.Product.ProductFolder() get_transaction().note('Added Control_Panel.Products') get_transaction().commit() # b/c: Ensure that std err msg exists. if not hasattr(app, 'standard_error_message'): import Document Document.manage_addDocument( app, 'standard_error_message', 'Standard Error Message', _standard_error_msg) get_transaction().note('Added standard_error_message') get_transaction().commit() # b/c: Ensure that Owner role exists. if hasattr(app, '__ac_roles__') and not ('Owner' in app.__ac_roles__): app.__ac_roles__=app.__ac_roles__ + ('Owner',) get_transaction().note('Added Owner role') get_transaction().commit() # ensure the Authenticated role exists. if hasattr(app, '__ac_roles__'): if not 'Authenticated' in app.__ac_roles__: app.__ac_roles__=app.__ac_roles__ + ('Authenticated',) get_transaction().note('Added Authenticated role') get_transaction().commit() # Make sure we have Globals root=app._p_jar.root() if not root.has_key('ZGlobals'): import BTree app._p_jar.root()['ZGlobals']=BTree.BTree() get_transaction().note('Added Globals') get_transaction().commit() # Install the initial user. if hasattr(app, 'acl_users'): users = app.acl_users if hasattr(users, '_createInitialUser'): app.acl_users._createInitialUser() get_transaction().note('Created initial user') get_transaction().commit() install_products(app) # Note that the code from here on only runs if we are not a ZEO # client, or if we are a ZEO client and we've specified by way # of env variable that we want to force products to load. if (os.environ.get('ZEO_CLIENT') and not os.environ.get('FORCE_PRODUCT_LOAD')): return # Check for dangling pointers (broken zclass dependencies) in the # global class registry. If found, rebuild the registry. Note that # if the check finds problems but fails to successfully rebuild the # registry we abort the transaction so that we don't leave it in an # indeterminate state. did_fixups=0 bad_things=0 try: if app.checkGlobalRegistry(): app.fixupZClassDependencies(rebuild=1) did_fixups=1 LOG('Zope', INFO, 'A broken ZClass dependency was found in the global ' \ 'class registry. This is probably due to a product ' \ 'being uninstalled. The registry has successfully ' \ 'been rebuilt.') get_transaction().note('Rebuilt global product registry') get_transaction().commit() except: bad_things=1 LOG('Zope', ERROR, 'A problem was found in the global product registry but ' 'the attempt to rebuild the registry failed.', error=sys.exc_info()) get_transaction().abort() # Now we need to see if any (disk-based) products were installed # during intialization. If so (and the registry has no errors), # there may still be zclasses dependent on a base class in the # newly installed product that were previously broken and need to # be fixed up. If any really Bad Things happened (dangling pointers # were found in the registry but it couldn't be rebuilt), we don't # try to do anything to avoid making the problem worse. if (not did_fixups) and (not bad_things): # App.Product.initializeProduct will set this if a disk-based # product was added or updated and we are not a ZEO client. if getattr(Globals, '__disk_product_installed__', 0): try: if app.fixupZClassDependencies(): get_transaction().commit() except: LOG('Zope', ERROR, 'Attempt to fixup ZClass dependencies after detecting ' \ 'an updated disk-based product failed.', error=sys.exc_info()) get_transaction().abort()
b3cbcc17ebb543bd146fa427d70436119a037aed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b3cbcc17ebb543bd146fa427d70436119a037aed/Application.py
LOG('Zope', ERROR, 'A problem was found in the global product registry but ' 'the attempt to rebuild the registry failed.',
LOG('Zope', ERROR, 'The attempt to rebuild the registry failed.',
def initialize(app): # Initialize the application # Initialize the cache: app.Control_Panel.initialize_cache() # The following items marked b/c are backward compatibility hacks # which make sure that expected system objects are added to the # bobobase. This is required because the bobobase in use may pre- # date the introduction of certain system objects such as those # which provide Lever support. # b/c: Ensure that Control Panel exists. if not hasattr(app, 'Control_Panel'): cpl=ApplicationManager() cpl._init() app._setObject('Control_Panel', cpl) get_transaction().note('Added Control_Panel') get_transaction().commit() # b/c: Ensure that a ProductFolder exists. if not hasattr(app.Control_Panel.aq_base, 'Products'): app.Control_Panel.Products=App.Product.ProductFolder() get_transaction().note('Added Control_Panel.Products') get_transaction().commit() # b/c: Ensure that std err msg exists. if not hasattr(app, 'standard_error_message'): import Document Document.manage_addDocument( app, 'standard_error_message', 'Standard Error Message', _standard_error_msg) get_transaction().note('Added standard_error_message') get_transaction().commit() # b/c: Ensure that Owner role exists. if hasattr(app, '__ac_roles__') and not ('Owner' in app.__ac_roles__): app.__ac_roles__=app.__ac_roles__ + ('Owner',) get_transaction().note('Added Owner role') get_transaction().commit() # ensure the Authenticated role exists. if hasattr(app, '__ac_roles__'): if not 'Authenticated' in app.__ac_roles__: app.__ac_roles__=app.__ac_roles__ + ('Authenticated',) get_transaction().note('Added Authenticated role') get_transaction().commit() # Make sure we have Globals root=app._p_jar.root() if not root.has_key('ZGlobals'): import BTree app._p_jar.root()['ZGlobals']=BTree.BTree() get_transaction().note('Added Globals') get_transaction().commit() # Install the initial user. if hasattr(app, 'acl_users'): users = app.acl_users if hasattr(users, '_createInitialUser'): app.acl_users._createInitialUser() get_transaction().note('Created initial user') get_transaction().commit() install_products(app) # Note that the code from here on only runs if we are not a ZEO # client, or if we are a ZEO client and we've specified by way # of env variable that we want to force products to load. if (os.environ.get('ZEO_CLIENT') and not os.environ.get('FORCE_PRODUCT_LOAD')): return # Check for dangling pointers (broken zclass dependencies) in the # global class registry. If found, rebuild the registry. Note that # if the check finds problems but fails to successfully rebuild the # registry we abort the transaction so that we don't leave it in an # indeterminate state. did_fixups=0 bad_things=0 try: if app.checkGlobalRegistry(): app.fixupZClassDependencies(rebuild=1) did_fixups=1 LOG('Zope', INFO, 'A broken ZClass dependency was found in the global ' \ 'class registry. This is probably due to a product ' \ 'being uninstalled. The registry has successfully ' \ 'been rebuilt.') get_transaction().note('Rebuilt global product registry') get_transaction().commit() except: bad_things=1 LOG('Zope', ERROR, 'A problem was found in the global product registry but ' 'the attempt to rebuild the registry failed.', error=sys.exc_info()) get_transaction().abort() # Now we need to see if any (disk-based) products were installed # during intialization. If so (and the registry has no errors), # there may still be zclasses dependent on a base class in the # newly installed product that were previously broken and need to # be fixed up. If any really Bad Things happened (dangling pointers # were found in the registry but it couldn't be rebuilt), we don't # try to do anything to avoid making the problem worse. if (not did_fixups) and (not bad_things): # App.Product.initializeProduct will set this if a disk-based # product was added or updated and we are not a ZEO client. if getattr(Globals, '__disk_product_installed__', 0): try: if app.fixupZClassDependencies(): get_transaction().commit() except: LOG('Zope', ERROR, 'Attempt to fixup ZClass dependencies after detecting ' \ 'an updated disk-based product failed.', error=sys.exc_info()) get_transaction().abort()
b3cbcc17ebb543bd146fa427d70436119a037aed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b3cbcc17ebb543bd146fa427d70436119a037aed/Application.py
def __init__(self, args, fmt=''):
def __init__(self, args, fmt='s'):
def __init__(self, args, fmt=''):
bbb979a9bb87723383f645121f927b77a20e734b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/bbb979a9bb87723383f645121f927b77a20e734b/DT_Var.py
if len(args)==1:
if len(args)==1 and fmt=='s':
def __init__(self, args, fmt=''):
bbb979a9bb87723383f645121f927b77a20e734b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/bbb979a9bb87723383f645121f927b77a20e734b/DT_Var.py
val = ('%'+self.fmt) % val
fmt=self.fmt if fmt=='s': val=str(val) else: val = ('%'+self.fmt) % (val,)
def render(self, md):
bbb979a9bb87723383f645121f927b77a20e734b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/bbb979a9bb87723383f645121f927b77a20e734b/DT_Var.py
if meta is None: meta={}
if meta is None: meta={}
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)
62ae26da026a782b337b19b00b172786a89e5123 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/62ae26da026a782b337b19b00b172786a89e5123/PropertySheets.py
def dav__propstat(self, allprop, vals, join=string.join):
def dav__propstat(self, allprop, names, join=string.join):
def dav__propstat(self, allprop, vals, join=string.join): # The dav__propstat method returns a chunk of xml containing # one or more propstat elements indicating property names, # values, errors and status codes. This is called by some # of the WebDAV support machinery. If a property set does # not support WebDAV, just override this method to return # an empty string. propstat='<d:propstat%s>\n' \ ' <d:prop>\n' \ '%s\n' \ ' </d:prop>\n' \ ' <d:status>HTTP/1.1 %s</d:status>\n' \ '</d:propstat>\n' result=[] if not self.propertyMap(): return '' if not allprop and not vals: # propname request for name in self.propertyIds(): result.append(' <ns0:%s/>' % name) result=join(result, '\n') nsdef=' xmlns:ns0="%s"' % self.xml_namespace() return propstat % (nsdef, result, '200 OK') elif allprop: for name, value in self.propertyItems(): prop=' <ns0:%s>%s</ns0:%s>' % (name, value, name) result.append(prop) result=join(result, '\n') nsdef=' xmlns:ns0="%s"' % self.xml_namespace() return propstat % (nsdef, result, '200 OK') else: xml_ns=self.xml_namespace() propdict=self.propdict() nsdef=' xmlns:ns0="%s"' % self.xml_namespace() for name, ns in vals: if ns==xml_ns: if propdict.has_key(name): value=self.getProperty(name) prop=' <ns0:%s>%s</ns0:%s>' % (name, value, name) result.append(propstat % (nsdef, prop, '200 OK')) else: prop=' <ns0:%s/>' % name result.append(propstat % (nsdef, prop,'404 Not Found')) return join(result, '\n')
62ae26da026a782b337b19b00b172786a89e5123 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/62ae26da026a782b337b19b00b172786a89e5123/PropertySheets.py
propstat='<d:propstat%s>\n' \
propstat='<d:propstat xmlns:ps="%s">\n' \
def dav__propstat(self, allprop, vals, join=string.join): # The dav__propstat method returns a chunk of xml containing # one or more propstat elements indicating property names, # values, errors and status codes. This is called by some # of the WebDAV support machinery. If a property set does # not support WebDAV, just override this method to return # an empty string. propstat='<d:propstat%s>\n' \ ' <d:prop>\n' \ '%s\n' \ ' </d:prop>\n' \ ' <d:status>HTTP/1.1 %s</d:status>\n' \ '</d:propstat>\n' result=[] if not self.propertyMap(): return '' if not allprop and not vals: # propname request for name in self.propertyIds(): result.append(' <ns0:%s/>' % name) result=join(result, '\n') nsdef=' xmlns:ns0="%s"' % self.xml_namespace() return propstat % (nsdef, result, '200 OK') elif allprop: for name, value in self.propertyItems(): prop=' <ns0:%s>%s</ns0:%s>' % (name, value, name) result.append(prop) result=join(result, '\n') nsdef=' xmlns:ns0="%s"' % self.xml_namespace() return propstat % (nsdef, result, '200 OK') else: xml_ns=self.xml_namespace() propdict=self.propdict() nsdef=' xmlns:ns0="%s"' % self.xml_namespace() for name, ns in vals: if ns==xml_ns: if propdict.has_key(name): value=self.getProperty(name) prop=' <ns0:%s>%s</ns0:%s>' % (name, value, name) result.append(propstat % (nsdef, prop, '200 OK')) else: prop=' <ns0:%s/>' % name result.append(propstat % (nsdef, prop,'404 Not Found')) return join(result, '\n')
62ae26da026a782b337b19b00b172786a89e5123 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/62ae26da026a782b337b19b00b172786a89e5123/PropertySheets.py
'%s\n' \
'%%s\n' \
def dav__propstat(self, allprop, vals, join=string.join): # The dav__propstat method returns a chunk of xml containing # one or more propstat elements indicating property names, # values, errors and status codes. This is called by some # of the WebDAV support machinery. If a property set does # not support WebDAV, just override this method to return # an empty string. propstat='<d:propstat%s>\n' \ ' <d:prop>\n' \ '%s\n' \ ' </d:prop>\n' \ ' <d:status>HTTP/1.1 %s</d:status>\n' \ '</d:propstat>\n' result=[] if not self.propertyMap(): return '' if not allprop and not vals: # propname request for name in self.propertyIds(): result.append(' <ns0:%s/>' % name) result=join(result, '\n') nsdef=' xmlns:ns0="%s"' % self.xml_namespace() return propstat % (nsdef, result, '200 OK') elif allprop: for name, value in self.propertyItems(): prop=' <ns0:%s>%s</ns0:%s>' % (name, value, name) result.append(prop) result=join(result, '\n') nsdef=' xmlns:ns0="%s"' % self.xml_namespace() return propstat % (nsdef, result, '200 OK') else: xml_ns=self.xml_namespace() propdict=self.propdict() nsdef=' xmlns:ns0="%s"' % self.xml_namespace() for name, ns in vals: if ns==xml_ns: if propdict.has_key(name): value=self.getProperty(name) prop=' <ns0:%s>%s</ns0:%s>' % (name, value, name) result.append(propstat % (nsdef, prop, '200 OK')) else: prop=' <ns0:%s/>' % name result.append(propstat % (nsdef, prop,'404 Not Found')) return join(result, '\n')
62ae26da026a782b337b19b00b172786a89e5123 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/62ae26da026a782b337b19b00b172786a89e5123/PropertySheets.py
' <d:status>HTTP/1.1 %s</d:status>\n' \ '</d:propstat>\n'
' <d:status>HTTP/1.1 %%s</d:status>\n%%s' \ '</d:propstat>\n' % self.xml_namespace() errormsg=' <d:responsedescription>%s</d:responsedescription>\n'
def dav__propstat(self, allprop, vals, join=string.join): # The dav__propstat method returns a chunk of xml containing # one or more propstat elements indicating property names, # values, errors and status codes. This is called by some # of the WebDAV support machinery. If a property set does # not support WebDAV, just override this method to return # an empty string. propstat='<d:propstat%s>\n' \ ' <d:prop>\n' \ '%s\n' \ ' </d:prop>\n' \ ' <d:status>HTTP/1.1 %s</d:status>\n' \ '</d:propstat>\n' result=[] if not self.propertyMap(): return '' if not allprop and not vals: # propname request for name in self.propertyIds(): result.append(' <ns0:%s/>' % name) result=join(result, '\n') nsdef=' xmlns:ns0="%s"' % self.xml_namespace() return propstat % (nsdef, result, '200 OK') elif allprop: for name, value in self.propertyItems(): prop=' <ns0:%s>%s</ns0:%s>' % (name, value, name) result.append(prop) result=join(result, '\n') nsdef=' xmlns:ns0="%s"' % self.xml_namespace() return propstat % (nsdef, result, '200 OK') else: xml_ns=self.xml_namespace() propdict=self.propdict() nsdef=' xmlns:ns0="%s"' % self.xml_namespace() for name, ns in vals: if ns==xml_ns: if propdict.has_key(name): value=self.getProperty(name) prop=' <ns0:%s>%s</ns0:%s>' % (name, value, name) result.append(propstat % (nsdef, prop, '200 OK')) else: prop=' <ns0:%s/>' % name result.append(propstat % (nsdef, prop,'404 Not Found')) return join(result, '\n')
62ae26da026a782b337b19b00b172786a89e5123 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/62ae26da026a782b337b19b00b172786a89e5123/PropertySheets.py
if not self.propertyMap(): return '' if not allprop and not vals:
if not allprop and not names:
def dav__propstat(self, allprop, vals, join=string.join): # The dav__propstat method returns a chunk of xml containing # one or more propstat elements indicating property names, # values, errors and status codes. This is called by some # of the WebDAV support machinery. If a property set does # not support WebDAV, just override this method to return # an empty string. propstat='<d:propstat%s>\n' \ ' <d:prop>\n' \ '%s\n' \ ' </d:prop>\n' \ ' <d:status>HTTP/1.1 %s</d:status>\n' \ '</d:propstat>\n' result=[] if not self.propertyMap(): return '' if not allprop and not vals: # propname request for name in self.propertyIds(): result.append(' <ns0:%s/>' % name) result=join(result, '\n') nsdef=' xmlns:ns0="%s"' % self.xml_namespace() return propstat % (nsdef, result, '200 OK') elif allprop: for name, value in self.propertyItems(): prop=' <ns0:%s>%s</ns0:%s>' % (name, value, name) result.append(prop) result=join(result, '\n') nsdef=' xmlns:ns0="%s"' % self.xml_namespace() return propstat % (nsdef, result, '200 OK') else: xml_ns=self.xml_namespace() propdict=self.propdict() nsdef=' xmlns:ns0="%s"' % self.xml_namespace() for name, ns in vals: if ns==xml_ns: if propdict.has_key(name): value=self.getProperty(name) prop=' <ns0:%s>%s</ns0:%s>' % (name, value, name) result.append(propstat % (nsdef, prop, '200 OK')) else: prop=' <ns0:%s/>' % name result.append(propstat % (nsdef, prop,'404 Not Found')) return join(result, '\n')
62ae26da026a782b337b19b00b172786a89e5123 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/62ae26da026a782b337b19b00b172786a89e5123/PropertySheets.py
result.append(' <ns0:%s/>' % name)
result.append(' <ps:%s/>' % name) if not result: return ''
def dav__propstat(self, allprop, vals, join=string.join): # The dav__propstat method returns a chunk of xml containing # one or more propstat elements indicating property names, # values, errors and status codes. This is called by some # of the WebDAV support machinery. If a property set does # not support WebDAV, just override this method to return # an empty string. propstat='<d:propstat%s>\n' \ ' <d:prop>\n' \ '%s\n' \ ' </d:prop>\n' \ ' <d:status>HTTP/1.1 %s</d:status>\n' \ '</d:propstat>\n' result=[] if not self.propertyMap(): return '' if not allprop and not vals: # propname request for name in self.propertyIds(): result.append(' <ns0:%s/>' % name) result=join(result, '\n') nsdef=' xmlns:ns0="%s"' % self.xml_namespace() return propstat % (nsdef, result, '200 OK') elif allprop: for name, value in self.propertyItems(): prop=' <ns0:%s>%s</ns0:%s>' % (name, value, name) result.append(prop) result=join(result, '\n') nsdef=' xmlns:ns0="%s"' % self.xml_namespace() return propstat % (nsdef, result, '200 OK') else: xml_ns=self.xml_namespace() propdict=self.propdict() nsdef=' xmlns:ns0="%s"' % self.xml_namespace() for name, ns in vals: if ns==xml_ns: if propdict.has_key(name): value=self.getProperty(name) prop=' <ns0:%s>%s</ns0:%s>' % (name, value, name) result.append(propstat % (nsdef, prop, '200 OK')) else: prop=' <ns0:%s/>' % name result.append(propstat % (nsdef, prop,'404 Not Found')) return join(result, '\n')
62ae26da026a782b337b19b00b172786a89e5123 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/62ae26da026a782b337b19b00b172786a89e5123/PropertySheets.py
nsdef=' xmlns:ns0="%s"' % self.xml_namespace() return propstat % (nsdef, result, '200 OK')
return propstat % (result, '200 OK', '')
def dav__propstat(self, allprop, vals, join=string.join): # The dav__propstat method returns a chunk of xml containing # one or more propstat elements indicating property names, # values, errors and status codes. This is called by some # of the WebDAV support machinery. If a property set does # not support WebDAV, just override this method to return # an empty string. propstat='<d:propstat%s>\n' \ ' <d:prop>\n' \ '%s\n' \ ' </d:prop>\n' \ ' <d:status>HTTP/1.1 %s</d:status>\n' \ '</d:propstat>\n' result=[] if not self.propertyMap(): return '' if not allprop and not vals: # propname request for name in self.propertyIds(): result.append(' <ns0:%s/>' % name) result=join(result, '\n') nsdef=' xmlns:ns0="%s"' % self.xml_namespace() return propstat % (nsdef, result, '200 OK') elif allprop: for name, value in self.propertyItems(): prop=' <ns0:%s>%s</ns0:%s>' % (name, value, name) result.append(prop) result=join(result, '\n') nsdef=' xmlns:ns0="%s"' % self.xml_namespace() return propstat % (nsdef, result, '200 OK') else: xml_ns=self.xml_namespace() propdict=self.propdict() nsdef=' xmlns:ns0="%s"' % self.xml_namespace() for name, ns in vals: if ns==xml_ns: if propdict.has_key(name): value=self.getProperty(name) prop=' <ns0:%s>%s</ns0:%s>' % (name, value, name) result.append(propstat % (nsdef, prop, '200 OK')) else: prop=' <ns0:%s/>' % name result.append(propstat % (nsdef, prop,'404 Not Found')) return join(result, '\n')
62ae26da026a782b337b19b00b172786a89e5123 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/62ae26da026a782b337b19b00b172786a89e5123/PropertySheets.py
for name, value in self.propertyItems(): prop=' <ns0:%s>%s</ns0:%s>' % (name, value, name)
for item in self.propertyMap(): name, type=item['id'], item.get('type','string') meta=item.get('meta', {}) value=self.getProperty(name) if type=='tokens': value=join(value, ' ') elif type=='lines': value=join(value, '\n') if meta.get('dav_xml', 0): prop=value else: prop=' <ps:%s>%s</ps:%s>' % (name, value, name)
def dav__propstat(self, allprop, vals, join=string.join): # The dav__propstat method returns a chunk of xml containing # one or more propstat elements indicating property names, # values, errors and status codes. This is called by some # of the WebDAV support machinery. If a property set does # not support WebDAV, just override this method to return # an empty string. propstat='<d:propstat%s>\n' \ ' <d:prop>\n' \ '%s\n' \ ' </d:prop>\n' \ ' <d:status>HTTP/1.1 %s</d:status>\n' \ '</d:propstat>\n' result=[] if not self.propertyMap(): return '' if not allprop and not vals: # propname request for name in self.propertyIds(): result.append(' <ns0:%s/>' % name) result=join(result, '\n') nsdef=' xmlns:ns0="%s"' % self.xml_namespace() return propstat % (nsdef, result, '200 OK') elif allprop: for name, value in self.propertyItems(): prop=' <ns0:%s>%s</ns0:%s>' % (name, value, name) result.append(prop) result=join(result, '\n') nsdef=' xmlns:ns0="%s"' % self.xml_namespace() return propstat % (nsdef, result, '200 OK') else: xml_ns=self.xml_namespace() propdict=self.propdict() nsdef=' xmlns:ns0="%s"' % self.xml_namespace() for name, ns in vals: if ns==xml_ns: if propdict.has_key(name): value=self.getProperty(name) prop=' <ns0:%s>%s</ns0:%s>' % (name, value, name) result.append(propstat % (nsdef, prop, '200 OK')) else: prop=' <ns0:%s/>' % name result.append(propstat % (nsdef, prop,'404 Not Found')) return join(result, '\n')
62ae26da026a782b337b19b00b172786a89e5123 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/62ae26da026a782b337b19b00b172786a89e5123/PropertySheets.py
nsdef=' xmlns:ns0="%s"' % self.xml_namespace() return propstat % (nsdef, result, '200 OK')
return propstat % (result, '200 OK', '')
def dav__propstat(self, allprop, vals, join=string.join): # The dav__propstat method returns a chunk of xml containing # one or more propstat elements indicating property names, # values, errors and status codes. This is called by some # of the WebDAV support machinery. If a property set does # not support WebDAV, just override this method to return # an empty string. propstat='<d:propstat%s>\n' \ ' <d:prop>\n' \ '%s\n' \ ' </d:prop>\n' \ ' <d:status>HTTP/1.1 %s</d:status>\n' \ '</d:propstat>\n' result=[] if not self.propertyMap(): return '' if not allprop and not vals: # propname request for name in self.propertyIds(): result.append(' <ns0:%s/>' % name) result=join(result, '\n') nsdef=' xmlns:ns0="%s"' % self.xml_namespace() return propstat % (nsdef, result, '200 OK') elif allprop: for name, value in self.propertyItems(): prop=' <ns0:%s>%s</ns0:%s>' % (name, value, name) result.append(prop) result=join(result, '\n') nsdef=' xmlns:ns0="%s"' % self.xml_namespace() return propstat % (nsdef, result, '200 OK') else: xml_ns=self.xml_namespace() propdict=self.propdict() nsdef=' xmlns:ns0="%s"' % self.xml_namespace() for name, ns in vals: if ns==xml_ns: if propdict.has_key(name): value=self.getProperty(name) prop=' <ns0:%s>%s</ns0:%s>' % (name, value, name) result.append(propstat % (nsdef, prop, '200 OK')) else: prop=' <ns0:%s/>' % name result.append(propstat % (nsdef, prop,'404 Not Found')) return join(result, '\n')
62ae26da026a782b337b19b00b172786a89e5123 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/62ae26da026a782b337b19b00b172786a89e5123/PropertySheets.py
xml_ns=self.xml_namespace()
def dav__propstat(self, allprop, vals, join=string.join): # The dav__propstat method returns a chunk of xml containing # one or more propstat elements indicating property names, # values, errors and status codes. This is called by some # of the WebDAV support machinery. If a property set does # not support WebDAV, just override this method to return # an empty string. propstat='<d:propstat%s>\n' \ ' <d:prop>\n' \ '%s\n' \ ' </d:prop>\n' \ ' <d:status>HTTP/1.1 %s</d:status>\n' \ '</d:propstat>\n' result=[] if not self.propertyMap(): return '' if not allprop and not vals: # propname request for name in self.propertyIds(): result.append(' <ns0:%s/>' % name) result=join(result, '\n') nsdef=' xmlns:ns0="%s"' % self.xml_namespace() return propstat % (nsdef, result, '200 OK') elif allprop: for name, value in self.propertyItems(): prop=' <ns0:%s>%s</ns0:%s>' % (name, value, name) result.append(prop) result=join(result, '\n') nsdef=' xmlns:ns0="%s"' % self.xml_namespace() return propstat % (nsdef, result, '200 OK') else: xml_ns=self.xml_namespace() propdict=self.propdict() nsdef=' xmlns:ns0="%s"' % self.xml_namespace() for name, ns in vals: if ns==xml_ns: if propdict.has_key(name): value=self.getProperty(name) prop=' <ns0:%s>%s</ns0:%s>' % (name, value, name) result.append(propstat % (nsdef, prop, '200 OK')) else: prop=' <ns0:%s/>' % name result.append(propstat % (nsdef, prop,'404 Not Found')) return join(result, '\n')
62ae26da026a782b337b19b00b172786a89e5123 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/62ae26da026a782b337b19b00b172786a89e5123/PropertySheets.py
nsdef=' xmlns:ns0="%s"' % self.xml_namespace() for name, ns in vals: if ns==xml_ns: if propdict.has_key(name):
xml_id=self.xml_namespace() for name, ns in names: if ns==xml_id: if not propdict.has_key(name): prop=' <ps:%s/>' % name emsg=errormsg % 'No such property: %s' % name result.append(propstat % (prop, '404 Not Found', emsg)) else: item=propdict[name] name, type=item['id'], item.get('type','string') meta=item.get('meta', {})
def dav__propstat(self, allprop, vals, join=string.join): # The dav__propstat method returns a chunk of xml containing # one or more propstat elements indicating property names, # values, errors and status codes. This is called by some # of the WebDAV support machinery. If a property set does # not support WebDAV, just override this method to return # an empty string. propstat='<d:propstat%s>\n' \ ' <d:prop>\n' \ '%s\n' \ ' </d:prop>\n' \ ' <d:status>HTTP/1.1 %s</d:status>\n' \ '</d:propstat>\n' result=[] if not self.propertyMap(): return '' if not allprop and not vals: # propname request for name in self.propertyIds(): result.append(' <ns0:%s/>' % name) result=join(result, '\n') nsdef=' xmlns:ns0="%s"' % self.xml_namespace() return propstat % (nsdef, result, '200 OK') elif allprop: for name, value in self.propertyItems(): prop=' <ns0:%s>%s</ns0:%s>' % (name, value, name) result.append(prop) result=join(result, '\n') nsdef=' xmlns:ns0="%s"' % self.xml_namespace() return propstat % (nsdef, result, '200 OK') else: xml_ns=self.xml_namespace() propdict=self.propdict() nsdef=' xmlns:ns0="%s"' % self.xml_namespace() for name, ns in vals: if ns==xml_ns: if propdict.has_key(name): value=self.getProperty(name) prop=' <ns0:%s>%s</ns0:%s>' % (name, value, name) result.append(propstat % (nsdef, prop, '200 OK')) else: prop=' <ns0:%s/>' % name result.append(propstat % (nsdef, prop,'404 Not Found')) return join(result, '\n')
62ae26da026a782b337b19b00b172786a89e5123 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/62ae26da026a782b337b19b00b172786a89e5123/PropertySheets.py
prop=' <ns0:%s>%s</ns0:%s>' % (name, value, name) result.append(propstat % (nsdef, prop, '200 OK')) else: prop=' <ns0:%s/>' % name result.append(propstat % (nsdef, prop,'404 Not Found')) return join(result, '\n') def odav__propstat(self, url, allprop, vals, iscol, join=string.join): result=[] propstat='<d:propstat>\n' \ '<d:prop%s>\n' \ '%s\n' \ '</d:prop>\n' \ '<d:status>HTTP/1.1 %s</d:status>\n' \ '</d:/propstat>' if not allprop and not vals: if hasattr(aq_base(self), 'propertyMap'): for md in self.propertyMap(): prop='<z:%s/>' % md['id'] result.append(propstat % ('', prop, '200 OK')) elif allprop: if hasattr(aq_base(self), 'propertyMap'): for md in self.propertyMap(): name, type=md['id'], md.get('type', 'string') value=getattr(self, name) if type=='tokens': value=join(value, ' ') elif type=='lines': value=join(value, '\n') else: value=str(value) prop='<z:%s>%s</z:%s>' % (name, value, name) result.append(propstat % ('', prop, '200 OK')) else: prop_mgr=hasattr(aq_base(self), 'propertyMap') for name, ns in vals: if ns==zpns: if not prop_mgr or not self.hasProperty(name): prop='<z:%s/>' % name result.append(propstat % ('',prop,'404 Not Found')) else: value=getattr(self, name) type=self.getPropertyType(name)
def dav__propstat(self, allprop, vals, join=string.join): # The dav__propstat method returns a chunk of xml containing # one or more propstat elements indicating property names, # values, errors and status codes. This is called by some # of the WebDAV support machinery. If a property set does # not support WebDAV, just override this method to return # an empty string. propstat='<d:propstat%s>\n' \ ' <d:prop>\n' \ '%s\n' \ ' </d:prop>\n' \ ' <d:status>HTTP/1.1 %s</d:status>\n' \ '</d:propstat>\n' result=[] if not self.propertyMap(): return '' if not allprop and not vals: # propname request for name in self.propertyIds(): result.append(' <ns0:%s/>' % name) result=join(result, '\n') nsdef=' xmlns:ns0="%s"' % self.xml_namespace() return propstat % (nsdef, result, '200 OK') elif allprop: for name, value in self.propertyItems(): prop=' <ns0:%s>%s</ns0:%s>' % (name, value, name) result.append(prop) result=join(result, '\n') nsdef=' xmlns:ns0="%s"' % self.xml_namespace() return propstat % (nsdef, result, '200 OK') else: xml_ns=self.xml_namespace() propdict=self.propdict() nsdef=' xmlns:ns0="%s"' % self.xml_namespace() for name, ns in vals: if ns==xml_ns: if propdict.has_key(name): value=self.getProperty(name) prop=' <ns0:%s>%s</ns0:%s>' % (name, value, name) result.append(propstat % (nsdef, prop, '200 OK')) else: prop=' <ns0:%s/>' % name result.append(propstat % (nsdef, prop,'404 Not Found')) return join(result, '\n')
62ae26da026a782b337b19b00b172786a89e5123 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/62ae26da026a782b337b19b00b172786a89e5123/PropertySheets.py
else: value=str(value) prop='<z:%s>%s</z:%s>' % (name, value, name) result.append(propstat % ('', prop, '200 OK')) else: prop='<n:%s/>' % name ns=' xmlns:n="%s"' % ns result.append(propstat % (ns, prop, '404 Not Found')) result='<d:response>\n' \ '<d:href>%s</d:href>\n' \ '%s\n' \ '</d:response>' % (url, join(result, '\n')) return result
if meta.get('dav_xml', 0): prop=value else: prop=' <ps:%s>%s</ps:%s>' % (name, value, name) result.append(propstat % (prop, '200 OK', '')) if not result: return '' return join(result, '')
def odav__propstat(self, url, allprop, vals, iscol, join=string.join): # The dav__propstat method returns an xml response element # containing one or more propstats indicating property names, # values, errors and status codes. result=[] propstat='<d:propstat>\n' \ '<d:prop%s>\n' \ '%s\n' \ '</d:prop>\n' \ '<d:status>HTTP/1.1 %s</d:status>\n' \ '</d:/propstat>' if not allprop and not vals: if hasattr(aq_base(self), 'propertyMap'): for md in self.propertyMap(): prop='<z:%s/>' % md['id'] result.append(propstat % ('', prop, '200 OK'))
62ae26da026a782b337b19b00b172786a89e5123 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/62ae26da026a782b337b19b00b172786a89e5123/PropertySheets.py
Apply the test parameters. provided by the dictionary 'argvars'.
Apply the test parameters provided by the dictionary 'argvars'.
def ZScriptHTML_tryAction(REQUEST, argvars): """
cc3b4b3c4e34065637e9d7bcd4ce6d4a218001d5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cc3b4b3c4e34065637e9d7bcd4ce6d4a218001d5/Script.py
self.size = len(dumps(index)) + len(dumps(data))
sizer = _ByteCounter() pickler = Pickler(sizer, HIGHEST_PROTOCOL) pickler.dump(index) pickler.dump(data) self.size = sizer.getCount()
def __init__(self, index, data, view_name): try: # This is a protective barrier that hopefully prevents # us from caching something that might result in memory # leaks. It's also convenient for determining the # approximate memory usage of the cache entry. self.size = len(dumps(index)) + len(dumps(data)) except: raise CacheException('The data for the cache is not pickleable.') self.created = time.time() self.data = data self.view_name = view_name self.access_count = 0
bc5096504575897d674221b100d588233a8257c7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/bc5096504575897d674221b100d588233a8257c7/RAMCacheManager.py
start, end = ws.pos(position) text = text[:start] + before + text[start:end] + after + text[end:]
if lpos != position: lpos=position start, end = ws.pos(position) text = (text[:start] + before + text[start:end] + after + text[end:])
def highlight(self, text, positions, before, after): ws = WordSequence(text, self.synstop) positions = map(None, positions)
c30ec163a1ea2470a24ae78f3576dcc0223af124 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/c30ec163a1ea2470a24ae78f3576dcc0223af124/InvertedIndex.py
product=getattr(__import__("Products.%s" % product_name), product_name)
product=__import__("Products.%s" % product_name, global_dict, global_dict, silly)
def install_products(app): # Install a list of products into the basic folder class, so # that all folders know about top-level objects, aka products path_join=os.path.join product_dir=path_join(SOFTWARE_HOME,'Products') isdir=os.path.isdir exists=os.path.exists DictType=type({}) from Folder import Folder folder_permissions={} for p in Folder.__ac_permissions__: permission, names = p[:2] folder_permissions[permission]=names meta_types=list(Folder.dynamic_meta_types) product_names=os.listdir(product_dir) product_names.sort() for product_name in product_names: package_dir=path_join(product_dir, product_name) if not isdir(package_dir): continue if not exists(path_join(package_dir, '__init__.py')): if not exists(path_join(package_dir, '__init__.pyc')): continue product=getattr(__import__("Products.%s" % product_name), product_name) permissions={} new_permissions={} for permission, names in pgetattr(product, '__ac_permissions__', ()): if names: for name in names: permissions[name]=permission elif not folder_permissions.has_key(permission): new_permissions[permission]=() for meta_type in pgetattr(product, 'meta_types', ()): if product_name=='OFSP': meta_types.insert(0,meta_type) else: meta_types.append(meta_type) name=meta_type['name'] for name,method in pgetattr(product, 'methods', {}).items(): if not hasattr(Folder, name): setattr(Folder, name, method) if name[-9:]=='__roles__': continue # Just setting roles if (permissions.has_key(name) and not folder_permissions.has_key(permissions[name])): permission=permissions[name] if new_permissions.has_key(permission): new_permissions[permission].append(name) else: new_permissions[permission]=[name] if new_permissions: new_permissions=new_permissions.items() for permission, names in new_permissions: folder_permissions[permission]=names new_permissions.sort() Folder.__dict__['__ac_permissions__']=tuple( list(Folder.__ac_permissions__)+new_permissions) misc_=pgetattr(product, 'misc_', {}) if type(misc_) is DictType: misc_=Misc_(product_name, misc_) Application.misc_.__dict__[product_name]=misc_ # Set up dynamic project information. App.Product.initializeProduct(product_name, package_dir, app) Folder.dynamic_meta_types=tuple(meta_types) Globals.default__class_init__(Folder)
5ca75ac9bc9b3e87204d8872f1e58ad59604c14f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/5ca75ac9bc9b3e87204d8872f1e58ad59604c14f/Application.py
self.emit("insertStructure", cexpr, attrDict, [])
self.emit("insertStructure", cexpr, {}, [])
def emitOnError(self, name, onError, position): block = self.popProgram() key, expr = parseSubstitution(onError, position) cexpr = self.compileExpression(expr) if key == "text": self.emit("insertText", cexpr, []) else: assert key == "structure" self.emit("insertStructure", cexpr, attrDict, []) self.emitEndTag(name) handler = self.popProgram() self.emit("onError", block, handler)
1b977b625fc2f248ed21e424233300c7b2eb06a9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/1b977b625fc2f248ed21e424233300c7b2eb06a9/TALGenerator.py
mod_since=DateTime(header).timeTime() last_mod =self._p_mtime
mod_since=int(DateTime(header).timeTime()) last_mod =int(self._p_mtime)
def index_html(self, REQUEST, RESPONSE): """ The default view of the contents of a File or Image.
a51ff439e66fa8dcebaa5719bacd5c4bb951c068 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/a51ff439e66fa8dcebaa5719bacd5c4bb951c068/Image.py
if m.find('/'): raise 'Redirect', ( "%s/%s" % (REQUEST['URL1'], m))
if m.find('/') >= 0: prefix= m.startswith('/') and REQUEST['BASE0'] or REQUEST['URL1'] raise 'Redirect', ( "%s/%s" % (prefix, m))
def manage_workspace(self, REQUEST): """Dispatch to first interface in manage_options """ 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.')
f03de0b3be7049dfc2b308e00644e4686e88a673 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/f03de0b3be7049dfc2b308e00644e4686e88a673/Management.py
def declareProtected(self, permission_name, *names):
def declareProtected(self, permission_name, name, *names):
def declareProtected(self, permission_name, *names): """Declare names to be associated with a permission.""" self._setaccess(names, permission_name)
5fe40d29e3c75b0fb9e8de2e71aab493c1cab9b0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/5fe40d29e3c75b0fb9e8de2e71aab493c1cab9b0/SecurityInfo.py
self._setaccess(names, permission_name)
self._setaccess((name,) + names, permission_name)
def declareProtected(self, permission_name, *names): """Declare names to be associated with a permission.""" self._setaccess(names, permission_name)
5fe40d29e3c75b0fb9e8de2e71aab493c1cab9b0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/5fe40d29e3c75b0fb9e8de2e71aab493c1cab9b0/SecurityInfo.py
if not force: self.appendHeader('Vary', 'Accept-Encoding')
def enableHTTPCompression(self,REQUEST={},force=0,disable=0,query=0): """Enable HTTP Content Encoding with gzip compression if possible
41de516661a00b386f9df0b11ad0968a69ffa722 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/41de516661a00b386f9df0b11ad0968a69ffa722/HTTPResponse.py
Append a value to a cookie
Append a value to a header.
def appendHeader(self, name, value, delimiter=","): '''\ Append a value to a cookie Sets an HTTP return header "name" with value "value", appending it following a comma if there was a previous value set for the header. ''' headers=self.headers if headers.has_key(name): h=self.header[name] h="%s%s\n\t%s" % (h,delimiter,value) else: h=value self.setHeader(name,h)
36e57a07af0e3923f9abef5f083a14c623c5873f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/36e57a07af0e3923f9abef5f083a14c623c5873f/HTTPResponse.py
h=self.header[name]
h=headers[name]
def appendHeader(self, name, value, delimiter=","): '''\ Append a value to a cookie Sets an HTTP return header "name" with value "value", appending it following a comma if there was a previous value set for the header. ''' headers=self.headers if headers.has_key(name): h=self.header[name] h="%s%s\n\t%s" % (h,delimiter,value) else: h=value self.setHeader(name,h)
36e57a07af0e3923f9abef5f083a14c623c5873f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/36e57a07af0e3923f9abef5f083a14c623c5873f/HTTPResponse.py
main()
unittest.main(defaultTest='test_suite')
def test_suite(): return unittest.makeSuite(TALESTests)
8732f7f4bec76b30fd547e018cd580135756e648 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/8732f7f4bec76b30fd547e018cd580135756e648/testTALES.py
self.setHeader('content-length', len(self.body))
def insertBase(self, base_re_search=regex.compile('\(<base[\0- ]+[^>]+>\)', regex.casefold).search ): if (self.headers.has_key('content-type') and self.headers['content-type'] != 'text/html'): return
ca8854ed33903e9ddd4a8613a736cc03e5b1a8dc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/ca8854ed33903e9ddd4a8613a736cc03e5b1a8dc/HTTPResponse.py
raise exepctions.RuntimeError,"operator not valid: %s" % operator
raise RuntimeError,"operator not valid: %s" % operator
def _apply_index(self, request, cid='', type=type, None=None): """Apply the index to query parameters given in the request arg.
35e0afe687696e775a088facdac6ccc37e0cc7ea /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/35e0afe687696e775a088facdac6ccc37e0cc7ea/UnIndex.py
if hasattr(o, 'isPrincipiaFolderish') and \
if hasattr(aq_base(o), 'isPrincipiaFolderish') and \
def tpValues(self): # Return a list of subobjects, used by tree tag. r=[] if hasattr(aq_base(self), 'tree_ids'): tree_ids=self.tree_ids try: tree_ids=list(tree_ids) except TypeError: pass if hasattr(tree_ids, 'sort'): tree_ids.sort() for id in tree_ids: if hasattr(self, id): r.append(self._getOb(id)) else: obj_ids=self.objectIds() obj_ids.sort() for id in obj_ids: o=self._getOb(id) if hasattr(o, 'isPrincipiaFolderish') and \ o.isPrincipiaFolderish: r.append(o) return r
aa16e4594e7c5987bb70b83ee24ff70996bf7aa3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/aa16e4594e7c5987bb70b83ee24ff70996bf7aa3/ObjectManager.py
files=self.objectItems()
files = list(self.objectItems())
def manage_FTPlist(self, REQUEST): """Directory listing for FTP. """ out=()
aa16e4594e7c5987bb70b83ee24ff70996bf7aa3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/aa16e4594e7c5987bb70b83ee24ff70996bf7aa3/ObjectManager.py
if f[1].meta_type == "Folder":
if hasattr(aq_base(f[1]), 'isPrincipiaFolderish') and f[1].isPrincipiaFolderish:
def manage_FTPlist(self, REQUEST): """Directory listing for FTP. """ out=()
aa16e4594e7c5987bb70b83ee24ff70996bf7aa3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/aa16e4594e7c5987bb70b83ee24ff70996bf7aa3/ObjectManager.py
else: all_files.append(f)
def manage_FTPlist(self, REQUEST): """Directory listing for FTP. """ out=()
aa16e4594e7c5987bb70b83ee24ff70996bf7aa3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/aa16e4594e7c5987bb70b83ee24ff70996bf7aa3/ObjectManager.py
files = list(files)
def manage_FTPlist(self, REQUEST): """Directory listing for FTP. """ out=()
aa16e4594e7c5987bb70b83ee24ff70996bf7aa3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/aa16e4594e7c5987bb70b83ee24ff70996bf7aa3/ObjectManager.py
lst =[] for name,child in obj.objectItems(): if child.meta_type=="Folder": lst.extend(findChildren(child,dirname+ obj.id + '/'))
lst = [] for name, child in obj.objectItems(): if hasattr(aq_base(child), 'isPrincipiaFolderish') and child.isPrincipiaFolderish: lst.extend(findChildren(child, dirname + obj.id + '/'))
def findChildren(obj,dirname=''): """ recursive walk through the object hierarchy to find all children of an object (ajung) """ lst =[] for name,child in obj.objectItems(): if child.meta_type=="Folder": lst.extend(findChildren(child,dirname+ obj.id + '/')) else: lst.append( (dirname + obj.id + "/" + name,child) ) return lst
aa16e4594e7c5987bb70b83ee24ff70996bf7aa3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/aa16e4594e7c5987bb70b83ee24ff70996bf7aa3/ObjectManager.py
lst.append( (dirname + obj.id + "/" + name,child) )
lst.append((dirname + obj.id + "/" + name, child))
def findChildren(obj,dirname=''): """ recursive walk through the object hierarchy to find all children of an object (ajung) """ lst =[] for name,child in obj.objectItems(): if child.meta_type=="Folder": lst.extend(findChildren(child,dirname+ obj.id + '/')) else: lst.append( (dirname + obj.id + "/" + name,child) ) return lst
aa16e4594e7c5987bb70b83ee24ff70996bf7aa3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/aa16e4594e7c5987bb70b83ee24ff70996bf7aa3/ObjectManager.py
w, h = struct.unpack(">LL", data[16:24])
w, h = struct.unpack(">LL", data[16:24]) self.width=str(int(w)) self.height=str(int(h))
def update_data(self, data, content_type=None, size=None): if content_type is not None: self.content_type=content_type if size is None: size=len(data)
a8bcb4e8a8c4e9bf4e6ec2740c25ec97efd6b051 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/a8bcb4e8a8c4e9bf4e6ec2740c25ec97efd6b051/Image.py
ts_results = indent_tab.search_group(rest, (1,2))
ts_results = indent_tab(rest, (1,2))
def untabify(aString): '''\ Convert indentation tabs to spaces. ''' result='' rest=aString while 1: ts_results = indent_tab.search_group(rest, (1,2)) if ts_results: start, grps = ts_results lnl=len(grps[0]) indent=len(grps[1]) result=result+rest[:start] rest="\n%s%s" % (' ' * ((indent/8+1)*8), rest[start+indent+1+lnl:]) else: return result+rest
b0fc40be7f6311ce8b53427d0435318a0e976412 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b0fc40be7f6311ce8b53427d0435318a0e976412/StructuredText.py
def indent_level(aString):
def indent_level(aString, indent_space=ts_regex.compile('\n\( *\)').search_group, ):
def indent_level(aString): '''\ Find the minimum indentation for a string, not counting blank lines. ''' start=0 text='\n'+aString indent=l=len(text) while 1: ts_results = indent_space.search_group(text, (1,2), start) if ts_results: start, grps = ts_results i=len(grps[0]) start=start+i+1 if start < l and text[start] != '\n': # Skip blank lines if not i: return (0,aString) if i < indent: indent = i else: return (indent,aString)
b0fc40be7f6311ce8b53427d0435318a0e976412 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b0fc40be7f6311ce8b53427d0435318a0e976412/StructuredText.py
ts_results = indent_space.search_group(text, (1,2), start)
ts_results = indent_space(text, (1,2), start)
def indent_level(aString): '''\ Find the minimum indentation for a string, not counting blank lines. ''' start=0 text='\n'+aString indent=l=len(text) while 1: ts_results = indent_space.search_group(text, (1,2), start) if ts_results: start, grps = ts_results i=len(grps[0]) start=start+i+1 if start < l and text[start] != '\n': # Skip blank lines if not i: return (0,aString) if i < indent: indent = i else: return (indent,aString)
b0fc40be7f6311ce8b53427d0435318a0e976412 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b0fc40be7f6311ce8b53427d0435318a0e976412/StructuredText.py
bullet=ts_regex.compile('[ \t\n]*[o*-][ \t\n]+\([^\0]*\)') example=ts_regex.compile('[\0- ]examples?:[\0- ]*$').search dl=ts_regex.compile('\([^\n]+\)[ \t]+--[ \t\n]+\([^\0]*\)') nl=ts_regex.compile('\n').search ol=ts_regex.compile('[ \t]*\(\([0-9]+\|[a-zA-Z]+\)[.)]\)+[ \t\n]+\([^\0]*\|$\)') olp=ts_regex.compile('[ \t]*([0-9]+)[ \t\n]+\([^\0]*\|$\)')
def structure(list): if not list: return [] i=0 l=len(list) r=[] while i < l: sublen=paragraphs(list,i) i=i+1 r.append((list[i-1][1],structure(list[i:i+sublen]))) i=i+sublen return r
b0fc40be7f6311ce8b53427d0435318a0e976412 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b0fc40be7f6311ce8b53427d0435318a0e976412/StructuredText.py
def __init__(self, aStructuredString, level=0):
def __init__(self, aStructuredString, level=0, paragraph_divider=regex.compile('\(\n *\)+\n'), ):
def __init__(self, aStructuredString, level=0): '''Convert a structured text string into a structured text object.
b0fc40be7f6311ce8b53427d0435318a0e976412 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b0fc40be7f6311ce8b53427d0435318a0e976412/StructuredText.py
em =ts_regex.compile(ctag_prefix+(ctag_middle % (("*",)*6) )+ctag_suffix) strong=ts_regex.compile(ctag_prefix+(ctag_middl2 % (("*",)*8))+ctag_suffix) under =ts_regex.compile(ctag_prefix+(ctag_middle % (("_",)*6) )+ctag_suffix) code =ts_regex.compile(ctag_prefix+(ctag_middle % (("\'",)*6))+ctag_suffix)
def __str__(self): return str(self.structure)
b0fc40be7f6311ce8b53427d0435318a0e976412 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b0fc40be7f6311ce8b53427d0435318a0e976412/StructuredText.py
def ctag(s):
def ctag(s, em=regex.compile( ctag_prefix+(ctag_middle % (("*",)*6) )+ctag_suffix), strong=regex.compile( ctag_prefix+(ctag_middl2 % (("*",)*8))+ctag_suffix), under=regex.compile( ctag_prefix+(ctag_middle % (("_",)*6) )+ctag_suffix), code=regex.compile( ctag_prefix+(ctag_middle % (("\'",)*6))+ctag_suffix), ):
def ctag(s): if s is None: s='' s=gsub(strong,'\\1<strong>\\2</strong>\\3',s) s=gsub(under, '\\1<u>\\2</u>\\3',s) s=gsub(code, '\\1<code>\\2</code>\\3',s) s=gsub(em, '\\1<em>\\2</em>\\3',s) return s
b0fc40be7f6311ce8b53427d0435318a0e976412 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b0fc40be7f6311ce8b53427d0435318a0e976412/StructuredText.py
extra_dl=ts_regex.compile("</dl>\n<dl>"), extra_ul=ts_regex.compile("</ul>\n<ul>"), extra_ol=ts_regex.compile("</ol>\n<ol>"),
extra_dl=regex.compile("</dl>\n<dl>"), extra_ul=regex.compile("</ul>\n<ul>"), extra_ol=regex.compile("</ol>\n<ol>"),
def __str__(self, extra_dl=ts_regex.compile("</dl>\n<dl>"), extra_ul=ts_regex.compile("</ul>\n<ul>"), extra_ol=ts_regex.compile("</ol>\n<ol>"), ): '''\ Return an HTML string representation of the structured text data.
b0fc40be7f6311ce8b53427d0435318a0e976412 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b0fc40be7f6311ce8b53427d0435318a0e976412/StructuredText.py
def _str(self,structure,level):
def _str(self,structure,level, bullet=ts_regex.compile('[ \t\n]*[o*-][ \t\n]+\([^\0]*\)' ).match_group, example=ts_regex.compile('[\0- ]examples?:[\0- ]*$' ).search, dl=ts_regex.compile('\([^\n]+\)[ \t]+--[ \t\n]+\([^\0]*\)' ).match_group, nl=ts_regex.compile('\n').search, ol=ts_regex.compile( '[ \t]*\(\([0-9]+\|[a-zA-Z]+\)[.)]\)+[ \t\n]+\([^\0]*\|$\)' ).match_group, olp=ts_regex.compile('[ \t]*([0-9]+)[ \t\n]+\([^\0]*\|$\)' ).match_group, ):
def _str(self,structure,level): r='' for s in structure: # print s[0],'\n', len(s[1]), '\n\n' ts_results = bullet.match_group(s[0], (1,)) if ts_results: p = ts_results[1] r=self.ul(r,p,self._str(s[1],level)) else: ts_results = ol.match_group(s[0], (3,)) if ts_results: p = ts_results[1] r=self.ol(r,p,self._str(s[1],level)) else: ts_results = olp.match_group(s[0], (1,)) if ts_results: p = ts_results[1] r=self.ol(r,p,self._str(s[1],level)) else: ts_results = dl.match_group(s[0], (1,2)) if ts_results: t,d = ts_results[1] r=self.dl(r,t,d,self._str(s[1],level)) else: if example(s[0]) >= 0 and s[1]: # Introduce an example, using pre tags: r=self.normal(r,s[0],self.pre(s[1])) else: if s[0][-2:]=='::' and s[1]: # Introduce an example, using pre tags: r=self.normal(r,s[0][:-1],self.pre(s[1])) else:
b0fc40be7f6311ce8b53427d0435318a0e976412 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b0fc40be7f6311ce8b53427d0435318a0e976412/StructuredText.py
ts_results = bullet.match_group(s[0], (1,))
ts_results = bullet(s[0], (1,))
def _str(self,structure,level): r='' for s in structure: # print s[0],'\n', len(s[1]), '\n\n' ts_results = bullet.match_group(s[0], (1,)) if ts_results: p = ts_results[1] r=self.ul(r,p,self._str(s[1],level)) else: ts_results = ol.match_group(s[0], (3,)) if ts_results: p = ts_results[1] r=self.ol(r,p,self._str(s[1],level)) else: ts_results = olp.match_group(s[0], (1,)) if ts_results: p = ts_results[1] r=self.ol(r,p,self._str(s[1],level)) else: ts_results = dl.match_group(s[0], (1,2)) if ts_results: t,d = ts_results[1] r=self.dl(r,t,d,self._str(s[1],level)) else: if example(s[0]) >= 0 and s[1]: # Introduce an example, using pre tags: r=self.normal(r,s[0],self.pre(s[1])) else: if s[0][-2:]=='::' and s[1]: # Introduce an example, using pre tags: r=self.normal(r,s[0][:-1],self.pre(s[1])) else:
b0fc40be7f6311ce8b53427d0435318a0e976412 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b0fc40be7f6311ce8b53427d0435318a0e976412/StructuredText.py
ts_results = ol.match_group(s[0], (3,))
ts_results = ol(s[0], (3,))
def _str(self,structure,level): r='' for s in structure: # print s[0],'\n', len(s[1]), '\n\n' ts_results = bullet.match_group(s[0], (1,)) if ts_results: p = ts_results[1] r=self.ul(r,p,self._str(s[1],level)) else: ts_results = ol.match_group(s[0], (3,)) if ts_results: p = ts_results[1] r=self.ol(r,p,self._str(s[1],level)) else: ts_results = olp.match_group(s[0], (1,)) if ts_results: p = ts_results[1] r=self.ol(r,p,self._str(s[1],level)) else: ts_results = dl.match_group(s[0], (1,2)) if ts_results: t,d = ts_results[1] r=self.dl(r,t,d,self._str(s[1],level)) else: if example(s[0]) >= 0 and s[1]: # Introduce an example, using pre tags: r=self.normal(r,s[0],self.pre(s[1])) else: if s[0][-2:]=='::' and s[1]: # Introduce an example, using pre tags: r=self.normal(r,s[0][:-1],self.pre(s[1])) else:
b0fc40be7f6311ce8b53427d0435318a0e976412 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b0fc40be7f6311ce8b53427d0435318a0e976412/StructuredText.py
ts_results = olp.match_group(s[0], (1,))
ts_results = olp(s[0], (1,))
def _str(self,structure,level): r='' for s in structure: # print s[0],'\n', len(s[1]), '\n\n' ts_results = bullet.match_group(s[0], (1,)) if ts_results: p = ts_results[1] r=self.ul(r,p,self._str(s[1],level)) else: ts_results = ol.match_group(s[0], (3,)) if ts_results: p = ts_results[1] r=self.ol(r,p,self._str(s[1],level)) else: ts_results = olp.match_group(s[0], (1,)) if ts_results: p = ts_results[1] r=self.ol(r,p,self._str(s[1],level)) else: ts_results = dl.match_group(s[0], (1,2)) if ts_results: t,d = ts_results[1] r=self.dl(r,t,d,self._str(s[1],level)) else: if example(s[0]) >= 0 and s[1]: # Introduce an example, using pre tags: r=self.normal(r,s[0],self.pre(s[1])) else: if s[0][-2:]=='::' and s[1]: # Introduce an example, using pre tags: r=self.normal(r,s[0][:-1],self.pre(s[1])) else:
b0fc40be7f6311ce8b53427d0435318a0e976412 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b0fc40be7f6311ce8b53427d0435318a0e976412/StructuredText.py
ts_results = dl.match_group(s[0], (1,2))
ts_results = dl(s[0], (1,2))
def _str(self,structure,level): r='' for s in structure: # print s[0],'\n', len(s[1]), '\n\n' ts_results = bullet.match_group(s[0], (1,)) if ts_results: p = ts_results[1] r=self.ul(r,p,self._str(s[1],level)) else: ts_results = ol.match_group(s[0], (3,)) if ts_results: p = ts_results[1] r=self.ol(r,p,self._str(s[1],level)) else: ts_results = olp.match_group(s[0], (1,)) if ts_results: p = ts_results[1] r=self.ol(r,p,self._str(s[1],level)) else: ts_results = dl.match_group(s[0], (1,2)) if ts_results: t,d = ts_results[1] r=self.dl(r,t,d,self._str(s[1],level)) else: if example(s[0]) >= 0 and s[1]: # Introduce an example, using pre tags: r=self.normal(r,s[0],self.pre(s[1])) else: if s[0][-2:]=='::' and s[1]: # Introduce an example, using pre tags: r=self.normal(r,s[0][:-1],self.pre(s[1])) else:
b0fc40be7f6311ce8b53427d0435318a0e976412 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b0fc40be7f6311ce8b53427d0435318a0e976412/StructuredText.py