/usr/share/pyshared/zope/component/standalonetests.py is in python-zope.component 4.0.2-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | """
See: https://bugs.launchpad.net/zope3/+bug/98401
"""
import sys
import pickle
def write(x):
sys.stdout.write('%s\n' % x)
if __name__ == "__main__": #pragma NO COVER (runs in subprocess)
#sys.path = pickle.loads(sys.stdin.read())
write('XXXXXXXXXX')
for p in sys.path:
write('- %s' % p)
write('XXXXXXXXXX')
import zope
from zope.interface import Interface
from zope.interface import implementer
class I1(Interface):
pass
class I2(Interface):
pass
@implementer(I1)
class Ob(object):
def __repr__(self):
return '<instance Ob>'
ob = Ob()
@implementer(I2)
class Comp(object):
def __init__(self, context):
self.context = context
write('YYYYYYYYY')
for p in zope.__path__:
write('- %s' % p)
write('YYYYYYYYY')
import zope.component
zope.component.provideAdapter(Comp, (I1,), I2)
adapter = I2(ob)
write('ZZZZZZZZ')
assert adapter.__class__ is Comp
assert adapter.context is ob
|