rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
['zope.app.component.interface.I5']
[u'zope.app.component.interface.I5']
def searchInterfaceIds(context, search_string=None, base=None): """Interfaces search >>> from zope.app.tests.placelesssetup import setUp, tearDown >>> setUp() >>> utilities = zapi.getService(None, zapi.servicenames.Utilities) >>> from zope.interface import Interface >>> from zope.interface.interfaces import IInterface...
away in Zope 3.6. There is no replacement for this function, since it odes not
away in Zope 3.6. There is no replacement for this function, since it does not
def getNextSiteManager(context): """Get the next site manager.""" sm = queryNextSiteManager(context, _marker) if sm is _marker: raise zope.component.interfaces.ComponentLookupError( "No more site managers have been found.") return sm
rootFolder = Place('')
rootFolder = Place(u'')
def __get__(self, inst, cls=None): if inst is None: return self
folder1 = Place('folder1') folder1_1 = Place('folder1/folder1_1') folder1_1_1 = Place('folder1/folder1_1/folder1_1_1') folder1_1_2 = Place('folder1/folder1_2/folder1_1_2') folder1_2 = Place('folder1/folder1_2') folder1_2_1 = Place('folder1/folder1_2/folder1_2_1')
folder1 = Place(u'folder1') folder1_1 = Place(u'folder1/folder1_1') folder1_1_1 = Place(u'folder1/folder1_1/folder1_1_1') folder1_1_2 = Place(u'folder1/folder1_2/folder1_1_2') folder1_2 = Place(u'folder1/folder1_2') folder1_2_1 = Place(u'folder1/folder1_2/folder1_2_1')
def __get__(self, inst, cls=None): if inst is None: return self
folder2 = Place('folder2') folder2_1 = Place('folder2/folder2_1') folder2_1_1 = Place('folder2/folder2_1/folder2_1_1')
folder2 = Place(u'folder2') folder2_1 = Place(u'folder2/folder2_1') folder2_1_1 = Place(u'folder2/folder2_1/folder2_1_1')
def __get__(self, inst, cls=None): if inst is None: return self
>>> old = sys.modules.get('zope.app.layers', None)
>>> import zope.app.layers >>> old = sys.modules['zope.app.layers']
... def resolve(self, path):
>>> if old is not None: ... sys.modules['zope.app.layers'] = old
>>> sys.modules['zope.app.layers'] = old
... def resolve(self, path):
"""
'''
def testServiceConfigNoType(self): from zope.component.service \ import UndefinedService self.assertRaises( UndefinedService, xmlconfig, StringIO(template % ( """ <service serviceType="Foo" component=" zope.app.component.tests.service.fooService" /> """ )))
serviceType="Foo" component=" zope.app.component.tests.service.fooService" /> """
serviceType="Foo" component="zope.app.component.tests.service.fooService" /> '''
def testServiceConfigNoType(self): from zope.component.service \ import UndefinedService self.assertRaises( UndefinedService, xmlconfig, StringIO(template % ( """ <service serviceType="Foo" component=" zope.app.component.tests.service.fooService" /> """ )))
""" <serviceType id="Foo" interface=" zope.app.component.tests.service.IFooService" />
''' <serviceType id="Foo" interface="zope.app.component.tests.service.IFooService" />
def testDuplicateServiceConfig(self): self.assertRaises( ConfigurationConflictError, xmlconfig, StringIO(template % ( """ <serviceType id="Foo" interface=" zope.app.component.tests.service.IFooService" /> <service serviceType="Foo" component=" zope.app.component.tests.service.fooService" /> <service serviceType="Foo" c...
"""
'''
def testDuplicateServiceConfig(self): self.assertRaises( ConfigurationConflictError, xmlconfig, StringIO(template % ( """ <serviceType id="Foo" interface=" zope.app.component.tests.service.IFooService" /> <service serviceType="Foo" component=" zope.app.component.tests.service.fooService" /> <service serviceType="Foo" c...
""" <serviceType id="Foo" interface=" zope.app.component.tests.service.IFooService" />
''' <serviceType id="Foo" interface="zope.app.component.tests.service.IFooService" />
def testServiceConfig(self): self.assertRaises(ComponentLookupError, getService, "Foo")
serviceType="Foo" component=" zope.app.component.tests.service.fooService" /> """
serviceType="Foo" component="zope.app.component.tests.service.fooService" /> '''
def testServiceConfig(self): self.assertRaises(ComponentLookupError, getService, "Foo")
""" <serviceType id="Foo" interface=" zope.app.component.tests.service.IFooService" />
''' <serviceType id="Foo" interface="zope.app.component.tests.service.IFooService" />
def testServiceFactoryConfig(self): self.assertRaises(ComponentLookupError, getService, "Foo")
serviceType="Foo" factory=" zope.app.component.tests.service.FooService" /> """
serviceType="Foo" factory="zope.app.component.tests.service.FooService" /> '''
def testServiceFactoryConfig(self): self.assertRaises(ComponentLookupError, getService, "Foo")
""" <serviceType id="Foo" interface=" zope.app.component.tests.service.IFooService" />
''' <serviceType id="Foo" interface="zope.app.component.tests.service.IFooService" />
def testPublicProtectedServiceConfig(self): self.assertRaises(ComponentLookupError, getService, "Foo")
serviceType="Foo" component=" zope.app.component.tests.service.fooService" permission="zope.Public" /> """
serviceType="Foo" component="zope.app.component.tests.service.fooService" permission="zope.Public" /> '''
def testPublicProtectedServiceConfig(self): self.assertRaises(ComponentLookupError, getService, "Foo")
""" <directives namespace="http://namespaces.zope.org/zope"> <directive name="permission" attributes="id title description" handler=" zope.app.security.metaconfigure.definePermission" /> </directives>
''' <include package="zope.app.security" file="meta.zcml" />
def testProtectedServiceConfig(self): self.assertRaises(ComponentLookupError, getService, "Foo")
serviceType="Foo" component=" zope.app.component.tests.service.fooService" permission="zope.TestPermission" /> """
serviceType="Foo" component="zope.app.component.tests.service.fooService" permission="zope.TestPermission" /> '''
def testProtectedServiceConfig(self): self.assertRaises(ComponentLookupError, getService, "Foo")
implements(interfaces.IRegistration, interfaces.IRegistrationManagerContained)
implements(IRegistration, IRegistrationManagerContained)
def __set__(self, inst, value): registration = inst registry = registration.getRegistry() if registry is None: raise ValueError('No registry found.')
implements(interfaces.IComponentRegistration)
implements(IComponentRegistration)
def __setstate__(self, dict): super(BBBComponentRegistration, self).__setstate__(dict) # For some reason the component path is not set correctly by the # default __setstate__ mechanism. if 'componentPath' in dict: self._component = NULL_COMPONENT self._BBB_componentPath = dict['componentPath']
implements(interfaces.IRegistered) __used_for__ = interfaces.IRegisterable
implements(IRegistered) __used_for__ = IRegisterable
def _setComponent(self, component): # We always want to set the plain component. Untrusted code will # get back a proxied component anyways. self._component = removeSecurityProxy(component)
implements(interfaces.IRegistrationManager)
implements(IRegistrationManager)
def registrations(self): rm = zapi.getParent(self.registerable).registrationManager return [reg for reg in rm.values() if (interfaces.IComponentRegistration.providedBy(reg) and reg.component is self.registerable)]
__used_for__ = interfaces.IRegisterableContainer
__used_for__ = IRegisterableContainer
def __createRegistrationManager(self): "Create a registration manager and store it as `registrationManager`" # See interfaces.IRegisterableContainer self.registrationManager = RegistrationManager() self.registrationManager.__parent__ = self self.registrationManager.__name__ = '++registrations++' zope.event.notify( obje...
_context.action( discriminator = None, callable = provideInterface, args = (type.__module__+'.'+type.__name__, type) ) _context.action( discriminator = None, callable = provideInterface, args = (provides.__module__+'.'+provides.__name__, type) )
if type is not None: _context.action( discriminator = None, callable = provideInterface, args = ('', type) ) _context.action( discriminator = None, callable = provideInterface, args = ('', provides) )
def factory(ob, request): for f in factories[:-1]: ob = f(ob) return factories[-1](ob, request)
value = self.context.resolve(name)
value = self.context.resolve('zope.app.layers.'+name)
def fromUnicode(self, u): name = str(u.strip())
name = 'zope.app.layers.'+name
def fromUnicode(self, u): name = str(u.strip())
zope.component.getServices.sethook(getServices_hook)
def getServices_hook(context=None): if context is None: return siteinfo.services # Deprecated support for a context that isn't adaptable to # IServiceService. Return the default service manager. try: return trustedRemoveSecurityProxy(IServiceService(context, serviceManager)) except ComponentLookupError: return servi...
zope.component.adapter_hook.sethook(adapter_hook)
def adapter_hook(interface, object, name='', default=None): try: return siteinfo.adapter_hook(interface, object, name, default) except ComponentLookupError: return default
zope.component.queryView.sethook(queryView)
def setHooks(): zope.component.getServices.sethook(getServices_hook) zope.component.adapter_hook.sethook(adapter_hook) zope.component.queryView.sethook(queryView) def resetHooks(): zope.component.getServices.reset() zope.component.adapter_hook.reset() zope.component.queryView.reset()
def queryView(object, name, request, default=None, providing=Interface, context=None): views = getService(Presentation, context) view = views.queryView(object, name, request, default=default, providing=providing) if ILocation.providedBy(view): locate(view, object, name) return view
def proxyView(context, request, factory=factory[-1], checker=checker): return proxify(factory(context, request), checker) proxyView.factory = factory[-1] factory[-1] = proxyView
class ProxyView(object): """Class to create simple proxy views.""" def __init__(self, factory, checker): self.factory = factory self.checker = checker def __call__(self, *objects): return proxify(self.factory(*objects), self.checker) factory[-1] = ProxyView(factory[-1], checker)
def proxyView(context, request, factory=factory[-1], checker=checker): return proxify(factory(context, request), checker)
from zope.app.services.service \
from zope.app.services.servicecontainer \
def makeTestObject(self): from zope.app.services.service \ import ServiceManagerContainer return ServiceManagerContainer()
if permission == 'Zope.Public':
if permission == 'zope.Public':
def utility(_context, provides, component=None, factory=None, permission=None, name=''): provides = _context.resolve(provides) if factory: if component: raise TypeError("Can't specify factory and component.") component = _context.resolve(factory)() else: component = _context.resolve(component) if permission is not N...
def reduce_factories(factories, for_):
def adapter(_context, factory, provides, for_, permission=None, name=''): if permission is not None: if permission == PublicPermission: permission = CheckerPublic checker = InterfaceChecker(provides, permission) factory.append(lambda c: proxify(c, checker)) for_ = tuple(for_) factories = factory
def reduce_factories(factories, for_): if len(factories) == 1: factory = factories[0] elif len(factories) < 1: raise ValueError("No factory specified") elif len(factories) > 1 and len(for_) > 1: raise ValueError("Can't use multiple factories and multiple for") else: def factory(ob): for f in factories: ob = f(ob) retur...
elif len(factories) > 1 and len(for_) > 1:
elif len(factories) > 1 and len(for_) != 1:
def reduce_factories(factories, for_): if len(factories) == 1: factory = factories[0] elif len(factories) < 1: raise ValueError("No factory specified") elif len(factories) > 1 and len(for_) > 1: raise ValueError("Can't use multiple factories and multiple for") else: def factory(ob): for f in factories: ob = f(ob) retur...
return factory def adapter(_context, factory, provides, for_, permission=None, name=''): if permission is not None: if permission == PublicPermission: permission = CheckerPublic checker = InterfaceChecker(provides, permission) factory.append(lambda c: proxify(c, checker)) for_ = tuple(for_)
def factory(ob): for f in factories: ob = f(ob) return ob
for_, provides, name, reduce_factories(factory, for_)),
for_, provides, name, factory),
def adapter(_context, factory, provides, for_, permission=None, name=''): if permission is not None: if permission == PublicPermission: permission = CheckerPublic checker = InterfaceChecker(provides, permission) factory.append(lambda c: proxify(c, checker)) for_ = tuple(for_) _context.action( discriminator = ('adapte...
type, reduce_factories(factory, for_), name, for_, provides, layer),
type, factory, name, for_, provides, layer),
def proxyView(context, request, factory=factory[-1], checker=checker): return proxify(factory(context, request), checker)
def ignorewarning(message, category, filename, lineno, file=None): pass warnings.showwarning = ignorewarning
showwarning = warnings.showwarning warnings.showwarning = lambda *a, **k: None
def ignorewarning(message, category, filename, lineno, file=None): pass
warnings.resetwarnings()
warnings.showwarning = showwarning
def ignorewarning(message, category, filename, lineno, file=None): pass
raise TypeError("No factory or handler provides")
raise TypeError("No factory or handler provided")
def subscriber(_context, for_=None, factory=None, handler=None, provides=None, permission=None, trusted=False): if factory is None: if handler is None: raise TypeError("No factory or handler provides") if provides is not None: raise TypeError("Cannot use handler with provides") factory = handler else: if handler is n...
return '<UtiltiyTerm %s, instance of %s>' %(
return '<UtilityTerm %s, instance of %s>' %(
def __repr__(self): return '<UtiltiyTerm %s, instance of %s>' %( self.token, self.value.__class__.__name__)
[(u'object1', <UtiltiyTerm object1, instance of Object>), (u'object2', <UtiltiyTerm object2, instance of Object>), (u'object3', <UtiltiyTerm object3, instance of Object>)]
[(u'object1', <UtilityTerm object1, instance of Object>), (u'object2', <UtilityTerm object2, instance of Object>), (u'object3', <UtilityTerm object3, instance of Object>)]
... def __repr__(self):
<UtiltiyTerm object1, instance of Object>
<UtilityTerm object1, instance of Object>
... def __repr__(self):
_url = '/' + '/'.join( [request.environ['pylons.routes_dict']['controller']])
_url = h.url_for( controller=request.environ['pylons.routes_dict']['controller'], action=None, id=None )
def get_nav_class_state(url, request, partial=False): """ Helper function that just returns the 'active'/'inactive' link class based on the passed url. """ if partial: _url = '/' + '/'.join( [request.environ['pylons.routes_dict']['controller']]) else: _url = '/' + '/'.join([ request.environ['pylons.routes_dict']['contr...
_url = '/' + '/'.join([ request.environ['pylons.routes_dict']['controller'], request.environ['pylons.routes_dict']['action']])
_url = h.url_for( controller=request.environ['pylons.routes_dict']['controller'], action=request.environ['pylons.routes_dict']['action'], id=None )
def get_nav_class_state(url, request, partial=False): """ Helper function that just returns the 'active'/'inactive' link class based on the passed url. """ if partial: _url = '/' + '/'.join( [request.environ['pylons.routes_dict']['controller']]) else: _url = '/' + '/'.join([ request.environ['pylons.routes_dict']['contr...
cgi.param(key, join(str(val)))
cgi.param(key, '\n'.join(val))
def get_perl_cgi(params_dict): params_dict = variable_decode(params_dict) cgi = g.perl.eval('$cgi = new CGI;') cgi.charset("UTF-8") for key, val in params_dict.iteritems(): if key in updatable_attributes: if isinstance(val, list): cgi.param(key, join(str(val))) else: cgi.param(key, str(val)) return cgi
APP_CONF = request.environ['paste.config']['app_conf']
def new_post(self, id): """The real work for the above action, where modifications are made permanent.""" if request.method != 'POST': redirect_to(action='new', id=None) # DO SOMETHING APP_CONF = request.environ['paste.config']['app_conf']
userinfo['radiusProfileDN'] = u'cn=default, ou=radiusprofiles, ' + \ APP_CONF['ispman_ldap_base_dn']
userinfo['radiusProfileDN'] = u'cn=default, ou=radiusprofiles, ' + g.ldap_base_dn
def new_post(self, id): """The real work for the above action, where modifications are made permanent.""" if request.method != 'POST': redirect_to(action='new', id=None) # DO SOMETHING APP_CONF = request.environ['paste.config']['app_conf']
PERL_THREAD_TEST_1 = True PERL_THREAD_TEST_2 = True
PERL_USETHREADS = True
def run_tests(self): PERL_THREAD_TEST_1 = True PERL_THREAD_TEST_2 = True
PERL_THREAD_TEST_1 = False
PERL_USETHREADS = False
def run_tests(self): PERL_THREAD_TEST_1 = True PERL_THREAD_TEST_2 = True
process = subprocess.Popen( ["perl", "-V:use5005threads"], stderr=subprocess.PIPE, stdout=subprocess.PIPE ) output = process.stdout.readlines() for line in output: if line.find("'undef';") != -1: PERL_THREAD_TEST_2 = False return PERL_THREAD_TEST_1 and PERL_THREAD_TEST_2
return PERL_USETHREADS
def run_tests(self): PERL_THREAD_TEST_1 = True PERL_THREAD_TEST_2 = True
print "Perl not compiled with threads support"
print "Perl not compiled with 'usethreads' support."
def run(self): cur_dir = os.getcwd() if not self.run_tests(): print "Perl not compiled with threads support" print "Removing 'MULTI_PERL'" os.unlink(os.path.join(cur_dir, 'MULTI_PERL'))
StorageTestBase.removefs("Dest.fs")
removefs("Dest.fs")
def checkRecoverUndoInVersion(self): oid = self._storage.new_oid() version = "aVersion" revid_a = self._dostore(oid, data=MinPO(91)) revid_b = self._dostore(oid, revid=revid_a, version=version, data=MinPO(92)) revid_c = self._dostore(oid, revid=revid_b, version=version, data=MinPO(93)) self._undo(self._storage.undoInfo...
o=objects.pop()
o=objects[-1]
def commit(self, subtransaction=None): 'Finalize the transaction'
mon_addr = zo.monitor_address.address
mon_addr = zo.monitor_address
def main(): global pid pid = os.getpid() label = 'zeoserver:%d' % pid log(label, 'starting') # We don't do much sanity checking of the arguments, since if we get it # wrong, it's a bug in the test suite. keep = 0 configfile = None # Parse the arguments and let getopt.error percolate opts, args = getopt.getopt(sys.argv...
except ClientDisconnected:
except (ClientDisconnected, thread.error), err: get_transaction().abort()
def checkReconnection(self): """Check that the client reconnects when a server restarts."""
o=objects[-1]
o=objects.pop()
def commit(self, subtransaction=None): 'Finalize the transaction'
del objects[-1]
def commit(self, subtransaction=None): 'Finalize the transaction'
if i < first: i = i+1 continue
def undoLog(self, first, last, filter=None): self._lock_acquire() try: packt=self._packt if packt is None: raise POSException.UndoError, ( 'Undo is currently disabled for database maintenance.<p>') pos=self._pos if pos < 39: return [] file=self._file seek=file.seek read=file.read unpack=struct.unpack strip=string.strip...
append(d)
if i >= first: append(d)
def undoLog(self, first, last, filter=None): self._lock_acquire() try: packt=self._packt if packt is None: raise POSException.UndoError, ( 'Undo is currently disabled for database maintenance.<p>') pos=self._pos if pos < 39: return [] file=self._file seek=file.seek read=file.read unpack=struct.unpack strip=string.strip...
fs = ZODB.FileStorage.FileStorage(fs_name, create=1) s, server, pid = forker.start_zeo(fs, domain=domain)
s, server, pid = forker.start_zeo("FileStorage", (fs_name, 1), domain=domain)
def main(args): opts, args = getopt.getopt(args, 'zd:n:Ds:LMt:U') s = None compress = None data=sys.argv[0] nrep=5 minimize=0 detailed=1 cache = None domain = 'AF_INET' threads = 1 for o, v in opts: if o=='-n': nrep = int(v) elif o=='-d': data = v elif o=='-s': s = v elif o=='-z': import zlib compress = zlib.compress e...
if not self._connected: raise ClientDisconnected() try: r=self._call(self.__begin, id, user, desc, ext)
try: if not self._connected: raise ClientDisconnected( "This action is temporarily unavailable.<p>") r=self._call(self.__begin, id, user, desc, ext)
def tpc_begin(self, transaction): self._lock_acquire() try: if self._transaction is transaction: return
if not self._read_only_fallback:
if not self._read_only_fallback or self.is_connected():
def testConnection(self, conn): """Return a pair (stub, preferred).
if v:
if ver:
def setVersionCacheSize(self, v): self._version_cache_size=v for ver in self._pools[0].keys(): if v: for c in self._pools[0][ver][1]: c._cache.cache_size=v
if invalid(oid): raise ConflictError, `oid`
if serial == '\0\0\0\0\0\0\0\0': self._creating.append(oid) else: if invalid(oid) or invalid(None): raise ConflictError, `oid` self._invalidating.append(oid)
# def persistent_id(object,
self._storage.tpc_finish(transaction, self.tpc_finish_)
if self._tmp is not None: self._storage.tpc_finish(transaction, self._invalidate_sub) self._storage._creating[:0]=self._creating del self._creating[:] else: self._storage.tpc_finish(transaction, self._invalidate_invalidating)
def tpc_finish(self, transaction):
def tpc_finish_(self):
def _invalidate_invalidating(self):
def tpc_finish_(self): invalidate=self._db.invalidate for oid in self._invalidating: invalidate(oid, self)
'supportsUndo', 'supportsVersions', 'undo', 'undoLog',
'supportsUndo', 'supportsVersions', 'undoLog',
def __init__(self, storage, pool_size=7, cache_size=400, cache_deactivate_after=60, version_pool_size=3, version_cache_size=100, version_cache_deactivate_after=10, ): """Create an object database.
if ul > tl or dl > tl or el > tl or tl < (23+ul+dl+el): return 0
if tl < (23+ul+dl+el): return 0
def _sane(self, index, pos): """Sanity check saved index data by reading the last undone trans
if ul > tl or dl > tl or el > tl or tl < (23+ul+dl+el):
if tl < (23+ul+dl+el):
def read_index(file, name, index, vindex, tindex, stop='\377'*8, ltid=z64, start=4L, maxoid=z64, recover=0, read_only=0): read=file.read seek=file.seek seek(0,2) file_size=file.tell() if file_size: if file_size < start: raise FileStorageFormatError, file.name seek(0) if read(4) != packed_version: raise FileStorageFor...
if ul > tl or dl > tl or el > tl or tl < (23+ul+dl+el):
if tl < (23+ul+dl+el):
def next(self, index=0): file=self._file seek=file.seek read=file.read pos=self._pos
return {
info = {
def get_info(self): storage=self.__storage return { 'length': len(storage), 'size': storage.getSize(), 'name': storage.getName(), 'supportsUndo': storage.supportsUndo(), 'supportsVersions': storage.supportsVersions(), 'supportsTransactionalUndo': storage.supportsTransactionalUndo(), }
'supportsUndo': storage.supportsUndo(), 'supportsVersions': storage.supportsVersions(), 'supportsTransactionalUndo': storage.supportsTransactionalUndo(),
def get_info(self): storage=self.__storage return { 'length': len(storage), 'size': storage.getSize(), 'name': storage.getName(), 'supportsUndo': storage.supportsUndo(), 'supportsVersions': storage.supportsVersions(), 'supportsTransactionalUndo': storage.supportsTransactionalUndo(), }
if len(h) != 16: raise ExportError, 'Truncated export file'
if len(h) != 16: raise POSException.ExportError, 'Truncated export file'
def persistent_load(ooid, Ghost=Ghost, StringType=StringType, atoi=string.atoi, TupleType=type(()), oids=oids, wrote_oid=wrote_oid, new_oid=new_oid): "Remap a persistent id to a new ID and create a ghost for it."
if len(p) != l: raise ExportError, 'Truncated export file'
if len(p) != l: raise POSException.ExportError, 'Truncated export file'
def persistent_load(ooid, Ghost=Ghost, StringType=StringType, atoi=string.atoi, TupleType=type(()), oids=oids, wrote_oid=wrote_oid, new_oid=new_oid): "Remap a persistent id to a new ID and create a ghost for it."
self._dst = ZODB.FileStorage.FileStorage('Dest.fs')
self._dst = FileStorage('Dest.fs')
def checkRecoverUndoInVersion(self): oid = self._storage.new_oid() version = "aVersion" revid_a = self._dostore(oid, data=MinPO(91)) revid_b = self._dostore(oid, revid=revid_a, version=version, data=MinPO(92)) revid_c = self._dostore(oid, revid=revid_b, version=version, data=MinPO(93)) self._undo(self._storage.undoInfo...
data=self.tryToResolveConflict( oid, cserial, serial, _loadBack(self._file, oid, p64(pre)), cdata)
try: bdata = _loadBack(self._file, oid, p64(pre))[0] except KeyError: raise UndoError("_loadBack() failed for %s" % repr(oid)) data=self.tryToResolveConflict(oid, cserial, serial, bdata, cdata)
def _transactionalUndoRecord(self, oid, pos, serial, pre, version): """Get the indo information for a data record
r = f_read(8) if len(r) < 8:
r = f_read(10) if len(r) < 10:
def main(): # Parse options MB = 1000*1000 cachelimit = 20*MB simclass = ZEOCacheSimulation heuristic = 0 try: opts, args = getopt.getopt(sys.argv[1:], "bflyzs:X") except getopt.error, msg: usage(msg) return 2 for o, a in opts: if o == '-b': simclass = BuddyCacheSimulation if o == '-f': simclass = SimpleCacheSimulation...
offset += 8 ts, code = struct_unpack(">ii", r)
offset += 10 ts, code, lenoid = struct_unpack(">iiH", r)
def main(): # Parse options MB = 1000*1000 cachelimit = 20*MB simclass = ZEOCacheSimulation heuristic = 0 try: opts, args = getopt.getopt(sys.argv[1:], "bflyzs:X") except getopt.error, msg: usage(msg) return 2 for o, a in opts: if o == '-b': simclass = BuddyCacheSimulation if o == '-f': simclass = SimpleCacheSimulation...
r = f_read(16) if len(r) < 16:
r = f_read(8 + lenoid) if len(r) < 8 + lenoid:
def main(): # Parse options MB = 1000*1000 cachelimit = 20*MB simclass = ZEOCacheSimulation heuristic = 0 try: opts, args = getopt.getopt(sys.argv[1:], "bflyzs:X") except getopt.error, msg: usage(msg) return 2 for o, a in opts: if o == '-b': simclass = BuddyCacheSimulation if o == '-f': simclass = SimpleCacheSimulation...
offset += 16
offset += 8 + lenoid
def main(): # Parse options MB = 1000*1000 cachelimit = 20*MB simclass = ZEOCacheSimulation heuristic = 0 try: opts, args = getopt.getopt(sys.argv[1:], "bflyzs:X") except getopt.error, msg: usage(msg) return 2 for o, a in opts: if o == '-b': simclass = BuddyCacheSimulation if o == '-f': simclass = SimpleCacheSimulation...
oid, serial = struct_unpack(">8s8s", r)
serial, oid = struct_unpack(">8s%ds" % lenoid, r)
def main(): # Parse options MB = 1000*1000 cachelimit = 20*MB simclass = ZEOCacheSimulation heuristic = 0 try: opts, args = getopt.getopt(sys.argv[1:], "bflyzs:X") except getopt.error, msg: usage(msg) return 2 for o, a in opts: if o == '-b': simclass = BuddyCacheSimulation if o == '-f': simclass = SimpleCacheSimulation...
raise ValueError, "unknown address in list: %s" % repr(a)
raise ValueError, ( "unknown address in list: %s" % repr(addr))
def _parse_addrs(self, addrs): # Return a list of (addr_type, addr) pairs.
break
def _commitVersion(self, src, dest, transaction, abort=None): # call after checking arguments and acquiring lock srcpos = self._vindex_get(src, 0) spos = p64(srcpos) # middle holds bytes 16:34 of a data record: # pos of transaction, len of version name, data length # commit version never writes data, so data leng...
except:
except KeyError:
def pack(self, t, referencesf): """Copy data from the current database file to a packed file
p=file()
p=file(1)
def persistent_id(object,self=self,stackup=stackup): if (not hasattr(object, '_p_oid') or type(object) is ClassType): return None
(old and new) of the object in conflict. (Serial numbers are closely related [equal?] to transaction IDs; a ConflictError may be triggered by a serial number mismatch.)
related to conflict. The first is the revision of object that is in conflict, the second is the revision of that the current transaction read when it started.
def __str__(self): return _fmt_oid(self.args[0])
zLOG.LOG("RUNSVR", severity, msg, "", error)
zLOG.LOG(_label, severity, msg, "", error)
def _log(msg, severity=zLOG.INFO, error=None): """Internal: generic logging function.""" zLOG.LOG("RUNSVR", severity, msg, "", error)
print time.ctime(self.begin),
t = time.ctime(self.begin)
def report(self): """Print a report about the transaction""" print time.ctime(self.begin), if hasattr(self, "vote"): print self.vote - self.begin, else: print "*", if hasattr(self, "finish"): print self.finish - self.begin, else: print "*", print self.user, self.url
print self.vote - self.begin,
d_vote = self.vote - self.begin
def report(self): """Print a report about the transaction""" print time.ctime(self.begin), if hasattr(self, "vote"): print self.vote - self.begin, else: print "*", if hasattr(self, "finish"): print self.finish - self.begin, else: print "*", print self.user, self.url
print "*",
d_vote = "*"
def report(self): """Print a report about the transaction""" print time.ctime(self.begin), if hasattr(self, "vote"): print self.vote - self.begin, else: print "*", if hasattr(self, "finish"): print self.finish - self.begin, else: print "*", print self.user, self.url
print self.finish - self.begin,
d_finish = self.finish - self.begin
def report(self): """Print a report about the transaction""" print time.ctime(self.begin), if hasattr(self, "vote"): print self.vote - self.begin, else: print "*", if hasattr(self, "finish"): print self.finish - self.begin, else: print "*", print self.user, self.url
print "*", print self.user, self.url
d_finish = "*" print self.fmt % (time.ctime(self.begin), d_vote, d_finish, self.user, self.url)
def report(self): """Print a report about the transaction""" print time.ctime(self.begin), if hasattr(self, "vote"): print self.vote - self.begin, else: print "*", if hasattr(self, "finish"): print self.finish - self.begin, else: print "*", print self.user, self.url
self.add("monitor_address", "zeo.monitor_address", "m:", "monitor=", self.handle_monitor_address)
self.add("monitor_address", "zeo.monitor_address.address", "m:", "monitor=", self.handle_monitor_address)
def add_zeo_options(self): self.add(None, None, "a:", "address=", self.handle_address) self.add(None, None, "f:", "filename=", self.handle_filename) self.add("family", "zeo.address.family") self.add("address", "zeo.address.address", required="no server address specified; use -a or -C") self.add("read_only", "zeo.read_o...
def XXXtestEmptyFirstBucketReportedByGuido(self):
def testEmptyFirstBucketReportedByGuido(self):
def XXXtestEmptyFirstBucketReportedByGuido(self): b = self.t for i in xrange(29972): # reduce to 29971 and it works b[i] = i for i in xrange(30): # reduce to 29 and it works del b[i] b[i+40000] = i
def XXXtestDeletes(self):
def testDeletes(self):
def XXXtestDeletes(self): # Delete keys in all possible orders, checking each tree along # the way.
if self.filter is None or self.filter(d):
if self.filter is None or self.filter(dict):
def search(self): """Search for another record.""" dict = self._readnext() if self.filter is None or self.filter(d): if self.i >= self.first: self.results.append(dict) self.i += 1
if not (th.status == " " or th.status == "p"):
if not th.status in " pu":
def checkTxn(self, th, pos): if th.tid <= self.ltid: self.fail(pos, "time-stamp reduction: %s <= %s", _fmt_oid(th.tid), _fmt_oid(self.ltid)) self.ltid = th.tid if th.status == "c": self.fail(pos, "transaction with checkpoint flag set") if not (th.status == " " or th.status == "p"): self.fail(pos, "invalid transaction s...
__version__='$Revision: 1.3 $'[11:-2]
__version__='$Revision: 1.4 $'[11:-2]
def info(RESPONSE): RESPONSE['Content-type']= 'text/plain'