Re: [Zope3-Users] local search engine
Am 01.08.2013 um 14:10 schrieb christophe petit christophe.peti...@gmail.com: […] @adapter(ISearchz, IObjectAddedEvent) def creationCatalog(event): […] Could you see what's wrong at first sight ? You define two arguments in the adapter decorator, but your function accepts only one. Yours sincerely, -- Michael Howitz · m...@gocept.com · software developer gocept gmbh co. kg · Forsterstraße 29 · 06112 Halle (Saale) · Germany http://gocept.com · Tel +49 345 1229889-8 Python, Pyramid, Plone, Zope · consulting, development, hosting, operations signature.asc Description: Message signed with OpenPGP using GPGMail ___ Zope3-users mailing list Zope3-users@zope.org https://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Unable to start ZEO server
Am 15.06.2011 um 00:33 schrieb George Wright: Michael Thanks for the reply I tried again to start ZEO with python2.4 instead of 2.6 - now have a different problem: georgewr$ python2.4 /usr/local/Zope-3.4.0c1/lib/python/ZEO/runzeo.py -a /tmp/zeosocket -f /tmp/test.fs Traceback (most recent call last): File /usr/local/Zope-3.4.0c1/lib/python/ZEO/runzeo.py, line 43, in ? import ZConfig, ZConfig.datatypes ImportError: No module named ZConfig I do have python 2.4 and the ZConfig.datatypes is present - although it is within Zope Dependencies /Users/georgewr/Zope-3.4.0c1/Dependencies/ZConfig-Zope-3.4.0c1/ZConfig/datatypes.py Should it be there? Don't know. Is it findable there? It seems that it is not. I think it is not the right way to start the ZEO server. There needs to be a wrapper script somewhere (maybe in `bin`) which sets the path correctly and knows the parameters like the path to the Data.fs. Yours sincerely, -- Michael Howitz · m...@gocept.com · software developer gocept gmbh co. kg · forsterstraße 29 · 06112 halle (saale) · germany http://gocept.com · tel +49 345 1229889 8 · fax +49 345 1229889 1 Zope and Plone consulting and development ___ Zope3-users mailing list Zope3-users@zope.org https://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Zope3-users Digest, Vol 71, Issue 6
Am 22.10.2010 um 13:47 schrieb david ally: Hi All, Eventually, I was able to build the project, however, because of the speed of my Internet link, it was constantly timing out, but fortunately, when i restarted the build operation, it continued from where it stopped. It got to a point where the build was still going but it gave this errors and continued the build operation. Please find below; Got zope.tal 3.5.2. Getting distribution for 'RestrictedPython==3.6.0'. SyntaxError: ('invalid syntax', ('build/bdist.linux-i686/egg/RestrictedPython/tests/before_and_after27.py', 30, 17, 'x = {y: y for y in whatever if y}\n')) SyntaxError: ('invalid syntax', ('build/bdist.linux-i686/egg/RestrictedPython/tests/security_in_syntax27.py', 6, 13, '{y: y for _restricted_name in x}\n')) SyntaxError: ('invalid syntax', ('/home/david/sampleproject/eggs/tmpwTJ7tk/RestrictedPython-3.6.0-py2.6.egg/RestrictedPython/tests/before_and_after27.py', 30, 17, 'x = {y: y for y in whatever if y}\n')) SyntaxError: ('invalid syntax', ('/home/david/sampleproject/eggs/tmpwTJ7tk/RestrictedPython-3.6.0-py2.6.egg/RestrictedPython/tests/security_in_syntax27.py', 6, 13, '{y: y for _restricted_name in x}\n')) These errors only occur because there are tests for Python 2.7 syntax constructs which are not yet exising in the Python 2.6 you used. You can safely ignore this errors. Mit freundlichen Grüßen -- Michael Howitz · m...@gocept.com · software developer gocept gmbh co. kg · forsterstraße 29 · 06112 halle (saale) · germany http://gocept.com · tel +49 345 1229889 8 · fax +49 345 1229889 1 Zope and Plone consulting and development ___ Zope3-users mailing list Zope3-users@zope.org https://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Question about z3c:layout
Am 15.07.2009 um 16:10 schrieb Simon Elbaz: Hi, the question I have is: when a z3c.form is rendered, how can I tell to zope3 to use z3c.pagelet.browser.BrowserPagelet.__call__ and not z3c.form.form.Form.__call__ in order to use the layout defined by a global z3c:layout in zcml ? Did you look at z3c.formui.form.Form? This is the pagelet integration package for z3c.form. Yours sincerely, -- Michael Howitz · m...@gocept.com · software developer gocept gmbh co. kg · forsterstraße 29 · 06112 halle (saale) · germany http://gocept.com · tel +49 345 1229889 8 · fax +49 345 1229889 1 Zope and Plone consulting and development ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] z3c.form in the apidoc code browser
Am 18.05.2009 um 17:05 schrieb John: thanks michael. i did as you suggested, but buildout said: [snipped some error messages] i dont really need to see z3c in apidoc, but if my general approach of adding versions to resolve conflicts is wrong, i'd like to know what i should do instead. There where several new versions of the zope packages which are not backwards compatible. Your approach is correct there are way too many new versions. If you did this: After running bin/zopeproject, edit proj/buildout.cfg, comment out the following line: extends = http://download.zope.org/zope3.4/3.4.0/versions.cfg Then this is wrong: Run bin/buildout to install the new packages. You should run: bin/buildout -n to get all the new packages. Sorry, my fault. Yours sincerely, -- Michael Howitz · m...@gocept.com · software developer gocept gmbh co. kg · forsterstraße 29 · 06112 halle (saale) · germany http://gocept.com · tel +49 345 1229889 8 · fax +49 345 1229889 1 Zope and Plone consulting and development ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Module zope has no global viewlet
Am 12.04.2009 um 12:56 schrieb Chetan Kumar: Hi all I am using virtualenv and zopeproject with the following output [1]. This is attached for reference and I am not sure if this output should bother me at this stage. As, I would like to use viewlet managers and viewlets, following http://apidoc.zope.org/++apidoc++/Book/viewlet/directives/show.html I tried this [2]. The pristine buildout.cfg [3] is attached for reference in case that is useful. Hope I have been able to express my situation and requirement clearly enough. I wish to find out my mistake, correct it and move on. Did you declare zope.viewlet as an install requirement in the setup.py of your project? Maybe zopeproject does not do this automatically. Yours sincerely, -- Michael Howitz · m...@gocept.com · software developer gocept gmbh co. kg · forsterstraße 29 · 06112 halle (saale) · germany http://gocept.com · tel +49 345 1229889 8 · fax +49 345 1229889 1 Zope and Plone consulting and development ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Module zope has no global viewlet
Am 14.04.2009 um 10:14 schrieb Chetan Kumar: [...] I would happily declare this if that is the way to go. My expectation (however misinformed/inaccurate/stupid) has been that when I use zopeproject all will be well. zope.viewlet is present in the KGS listing of packages but does not appear in the bin/paster and other scripts. KGS only defines the versions of packages which can be used together. This does not mean that all these packages get installed. To use one package (aka install it) you have to declare it as install dependency in setup.py. Yours sincerely, -- Michael Howitz · m...@gocept.com · software developer gocept gmbh co. kg · forsterstraße 29 · 06112 halle (saale) · germany http://gocept.com · tel +49 345 1229889 8 · fax +49 345 1229889 1 Zope and Plone consulting and development ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Best way to represent a foreign key in ZODB
Am 03.03.2009 um 21:53 schrieb Massimiliano della Rovere: What is the best way to represent a foreign key? a persistent.wref? an intid number? Suppose I have a persistent class representing an art object author (A) and another persistent class representing an art object (B). If I want to create links from one instance of one A to instances of class B (and vice versa) what do you recommend me? It would be great having the possibility of referring attributes and methods of the object: is w is a reference to an instance of A, w.name and w.surname for example... You might have a look at http://pypi.python.org/pypi/gocept.reference Yours sincerely, -- Michael Howitz · m...@gocept.com · software developer gocept gmbh co. kg · forsterstraße 29 · 06112 halle (saale) · germany http://gocept.com · tel +49 345 1229889 8 · fax +49 345 1229889 1 Zope and Plone consulting and development ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Best way to represent a foreign key in ZODB
Am 04.03.2009 um 14:09 schrieb Massimiliano della Rovere: I have problems installing the package (I never did it before, probably i do something wrong). I downloaded the package, decompressed it and run: sudo python setup.py build - ok sudo python setup.py install - error You should use buildout to install dependencies for your application. As you already use Zope, there should be already a ZODB, so it needs not to be built at install of gocept.reference. See http://pypi.python.org/pypi/zc.buildout or maybe http://redomino.com/it/labs/documentazione/tutorial/gestire-progetti-con-zc-buildout/ When installing, it tries to download an updated package about ZODB but then it fails compiling it: python2.4 setup.py build [...] src/BTrees/BTreeModuleTemplate.c:15:20: error: Python.h: Nessun file o directory Google finds this: http://www.mail-archive.com/plone...@lists.plone.org/msg02411.html (sounds a bit similar especially because I do not understand Italian :) Yours sincerely, -- Michael Howitz · m...@gocept.com · software developer gocept gmbh co. kg · forsterstraße 29 · 06112 halle (saale) · germany http://gocept.com · tel +49 345 1229889 8 · fax +49 345 1229889 1 Zope and Plone consulting and development ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Why does schema validation not work in this example?
Am 18.01.2009 um 09:26 schrieb Sebastian Bartos: Hello folks, I just played around with the validation of the schemata and created the example listed below. According to the book by Philip it should rase a validation exception at the end. That's what the FieldProperty is supposed to do, but it does not do it here. (Tested in the zope debug console) Why? from zope.interface import Interface, implements from zope.schema import Int from zope.schema.fieldproperty import FieldProperty class ITest(Interface): number = Int( title = u'A number' ) class test(object): implements(ITest) number = FieldProperty(ITest['number']) test_class = test() print test.number # get zope.schema.fieldproperty.FieldProperty object at 0x27537d0 test.number = 20 # this is ok This overwrites the field property, as 'test' is your class, you called the instance 'test_class'. test_class.number = 'asdf' results in the exception you expect. Yours sincerely, -- Michael Howitz · m...@gocept.com · software developer gocept gmbh co. kg · forsterstraße 29 · 06112 halle (saale) · germany http://gocept.com · tel +49 345 1229889 8 · fax +49 345 1229889 1 Zope and Plone consulting and development ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] z3c.menu.ready2go release request
Hi, some weeks ago a bug in z3c.menu.ready2go was fixed but there was no new release since then. I'd like to use this bug-fixed version as the bug has also bitten me, so I'd like to request a new release of the package. Thanks in advance. Yours sincerely, -- Michael Howitz · m...@gocept.com · software developer gocept gmbh co. kg · forsterstraße 29 · 06112 halle (saale) · germany http://gocept.com · tel +49 345 1229889 8 · fax +49 345 1229889 1 Zope and Plone consulting and development ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Windows Vista, Buildout python-cjson
Am 18.09.2008 um 12:20 schrieb Tim Cook: [...] First of all I do not know what is causing python-cjson to be loaded as a dependency. Maybe we can eliminate it for now. Any guesses? You can run bin/buildout with -vv as option to see which package requires python-cjson. Yours sincerely, -- Michael Howitz · [EMAIL PROTECTED] · software developer gocept gmbh co. kg · forsterstraße 29 · 06112 halle (saale) · germany http://gocept.com · tel +49 345 1229889 8 · fax +49 345 1229889 1 Zope and Plone consulting and development ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] z3c.menu vs. z3c.menu.simple
Hi, there are two z3c.menu packages on pypi: z3c.menu and z3c.menu.simple They mostly differ in the change log (the rest of the long description is quite the same). Which one should be used? Why is the other not marked as deprecated? Or are both packages still actively developed/supported? Yours sincerely, -- Michael Howitz · [EMAIL PROTECTED] · software developer gocept gmbh co. kg · forsterstraße 29 · 06112 halle (saale) · germany http://gocept.com · tel +49 345 1229889 8 · fax +49 345 1229889 1 Zope and Plone consulting and development ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] New release of zc.recipe.egg needed
Hello, some month ago Christian Zagrodnick added the environment option to zc.recipe.egg. The change is on the trunk but there was no release made since then. For a customer project it would be nice to have this feature in an egg on pypi. Anyone (who has write access on pypi for this package) here to volunteer for a release? Yours sincerely, -- Michael Howitz · [EMAIL PROTECTED] · software developer gocept gmbh co. kg · forsterstraße 29 · 06112 halle (saale) · germany http://gocept.com · tel +49 345 1229889 8 · fax +49 345 1229889 1 Zope and Plone consulting and development ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] How do I find out references to objects in ZODB
Am 02.05.2008 um 16:17 schrieb Yuan HOng: Hi, Is it possible to find out what other objects are referencing a particular object in ZODB? In particular, I want to prevent some content objects, like images, from being removed from the folder if they are used in some other content object, like a news article. Do I have to keep track of object referencing in ZODB myself through events or there are some built-in mechanism in ZODB to take care of this for me? Hi, maybe gocept.reference[1] can help you. [1] http://pypi.python.org/pypi/gocept.reference/0.2 -- Yours sincerely, Michael Howitz gocept gmbh co. kg · forsterstrasse 29 · 06112 halle/saale www.gocept.com · fon: +49 345 12298898 · fax: +49 345 12298891 ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] XMLRPC Method with **kwargs
Am 14.12.2007 um 01:29 schrieb Jeremy Roberts: Hello zope3 users! I'm using Zope-3.3.1, and I'm trying to expose a method via xmlrpc and I'm having trouble supporting a variable number of kwargs. My use case does not know ahead of time how many arguments will be passed to the method, hence the use of **kwargs in the method signature. I get the error: Unexpected Zope exception: TypeError: renderCode() takes at most 1 argument (2 given). Hi! I think this is because XML-RPC does not support (optional) keyword arguments, you only may use positional arguments. A solution for optional arguments can be a dictionary containing the optional arguments for your XML-RPC-View as the last parameter. But this parameter is not optional itself. So your view could look like: class ToolCodeXMLRPC(MethodPublisher): An XMLRPC view for ToolCode objects. def renderCode(self, data): return self.context.renderCode(**data) -- Yours sincerely, Michael Howitz gocept gmbh co. kg · forsterstrasse 29 · 06112 halle/saale www.gocept.com · fon: +49 345 12298898 · fax: +49 345 12298891 ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] how to use invariant/validator? (z3c.form=1.6 and z3c.formui=1.3)
Am 19.09.2007 um 12:49 schrieb [EMAIL PROTECTED]: Hi, I want to use an invariant-check in an analogous manner like it is described at the end of the message. There is answered that the bug is fixed, but the same causes are still active. I'm using z3c.form=1.6 and z3c.formui=1.3 What seems to be the trouble now? my code: class IAddressSearch(zope.interface.Interface): ... @zope.interface.invariant def firstnameOrSurname( search ): #import pdb; pdb.set_trace() if search.firstname == None: search.firstname = u'' if search.surname == None: search.surname = u'' if len(search.firstname) == 0 and len(search.surname) == 0: raise zope.interface.Invalid( uEnter firstname and/ or surname.) result of my Code: TypeError: tuple indices must be integers Hi, can you please include a complete traceback to see where the exception occurres? -- Yours sincerely, Michael Howitz gocept gmbh co. kg · forsterstrasse 29 · 06112 halle/saale www.gocept.com · fon: +49 345 12298898 · fax: +49 345 12298891 ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: Invariants and forms
Am 14.08.2007 um 12:13 schrieb Nylan: The standard error message is: There were errors I'll try your solution, but I would prefer getting the invariants to work, like mentioned in the examples. They seem to work with zope 3.2(example 1) and zope 3.4 (example 2) That's what the german description of the examples says. -- Yours sincerely, Michael Howitz gocept gmbh co. kg · forsterstrasse 29 · 06112 halle/saale www.gocept.com · fon: +49 345 12298898 · fax: +49 345 12298891 ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] imports cleanup
Am 15.03.2007 um 01:52 schrieb Christophe Combelles: [...] Is there a tool or a method to automatically clean or detect unused imports ? In your Zope3-Instance there should be a python script called importchecker which can detect unused imports. hth, mac ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] testing using placefulSetUp, zcml and events
Achim Domma wrote: Hi, I have a content object I want to set up in a IObjectCreatedEvent event handler. I want to use the interactive interpreter to play with this, but it looks like my configure.zcml is not parsed and executed if I use placefulSetUp. This is correct, placefulSetUp is used in unittests. How do I have to setup my environment to test zcml configured events from command line? Basically I want to write something like some_setup_method() root[ws]=Workspace() # should trigger and handle IObjectCreatedEvent for key in root[ws).keys(): print key to check if the object is setup correctly. What about starting Zope with bin/zopectl debug Zope starts like normal, but you get a python prompt. There app.root() returns the root folder in the ZODB. HTH, mac ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Dynamic Typing: Are checks on interface compliance possible?
Reinhold Strobl wrote: Hi, what I am looking for is something like PyChecker for Zope interfaces. I mean PyChecker aims to address the benefit of static typed languages and their compile-time checkings. In Zope, there is no forced interface compliance. But is there a possibility or program, which can check this? Hi, you should have a look at zope.interface.verify. With verifyClass and verifyObject you can check the interface compliance for classes and objects. HTH, mac ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Creating PluggableAuthentication problem.
Tobias Weber wrote: Hello! I try to add a PluggableAuthentication and a PrincipalFolder automatically. When I add a principal to the PrincipalFolder it works fine, but the authentification of the User fails. When I add one more PluggableAuthentication manually and choose the automatically generated PrincipalFolder as authenticator plugin, it works. Here is my code: [...] I am sorry for this code, I try to figure out how it works. Did you have a look at this thread: http://www.opensubscriber.com/message/zope3-users@zope.org/3786410.html There I pasted an example how I did it. HTH, mac ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] formlib problem
Stéphane Brault wrote: Hi, I can't use formlib, when I run the example in the form.txt I get this error: Traceback (most recent call last): File pyshell#29, line 1, in -toplevel- print MyForm(None, request)() File pyshell#26, line 6, in __call__ widgets = form.setUpWidgets(self.form_fields, 'form', self.context, self.request, ignore_request= ignore_request) File C:\Python24\Lib\site-packages\zope\formlib\form.py, line 255, in setUpWidgets IInputWidget) File C:\Python24\Lib\site-packages\zope\component\__init__.py, line 154, in getMultiAdapter raise ComponentLookupError(objects, interface, name) ComponentLookupError: ((, http://127.0.0.1), , u'') There seems to be something missing before , http... ... did you copy it form the browser output? It happens when setUpWidgets is called in the first example, do I need to import something or to configure a component for formlib to work ? Any hint ? Guess out of the dust: does the interface of the object you want to display have a zope.app.container.constraints.containers directive? This thread seems similar to your problem. http://mail.zope.org/pipermail/zope3-users/2006-March/002802.html HTH, mac ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Programatically add plugins to PAU
Florian Lindner wrote: Hello, I've a PluggableAuthentication and want to add and register some plugins to it. Adding works fine: principal_folder = zope.app.authentication.principalfolder.PrincipalFolder(prefix = cs) pau[PrincipalFolder] = principal_folder and I think I can select it with: pau.credentialsPlugins = [principal_folder] but how to register it before? And how do I select credential plugins? This is how we did it in a project: createAuthenticationUtils is called on handling the ObjectAddedEvent for the folder (which is programmatically made a site) which should contain the PAU. HTH, mac --- from zope.app.security.interfaces import IAuthentication from zope.app.authentication.interfaces import IAuthenticatorPlugin from zope.app.appsetup.bootstrap import ensureUtility from zope.app.authentication.authentication import \ PluggableAuthentication from zope.app.authentication.principalfolder import PrincipalFolder from zope.app.authentication.groupfolder import \ GroupFolder, GroupInformation from zope.app import zapi from myproject import config def addUtilityToPAU(pau, interface, utility_factory, id, name): utility = utility_factory() pau[id] = utility reg_man = pau.registrationManager reg = site.UtilityRegistration(name, interface, utility) reg_man.addRegistration(reg) reg.status = u'Active' def _addGroupInformation(group_folder, id, title, description): group = GroupInformation() group.title = title group.description = description group_folder[id] = group def createAuthenticationUtils(obj): ensureUtility(obj, IAuthentication, '', PluggableAuthentication, copy_to_zlog=False) auth = zapi.getUtility(IAuthentication) auth.credentialsPlugins = (u'Session Credentials',) addUtilityToPAU(auth, IAuthenticatorPlugin, PrincipalFolder, 'principal_folder', u'Benutzerverwaltung') addUtilityToPAU(auth, IAuthenticatorPlugin, GroupFolder, 'group_folder', u'Rollenverwaltung') auth.authenticatorPlugins = (u'Benutzerverwaltung', u'Rollenverwaltung',) group_folder = auth['group_folder'] for group in config.company_groups: _addGroupInformation(group_folder, group['id'], group['title'], group['description']) ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Security in Code, example, why does this work?
Reinhold Strobl wrote: Hi, (...) So can code always access everything, or not? In Zope 3 there is also the concept of trusted and untrusted code like in Zope 2 See http://dev.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/ShortTutorial/short.pdf pages 88 - 94 (esp. page 94) In trusted code no permissions are checked. So you may have to check manually before entering trusted code. I think that you call a method of your model-code from with-in the view-code. Thats the entrace to trusted code. Hope that helps a bit, mac ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] TAL and Decimals
Am Dienstag, den 04.04.2006, 11:24 -0500 schrieb David Johnson: I am reading a decimal field from a database and trying to display it in a page template. What is the TAL to do this? Among other things, I’ve tried: div tal:replace=python: u'%f' % (item.price) / Which generates the follow exception: ForbiddenAttribute: ('__float__', Decimal(0.00)) I’ve also tried the simple: $div tal:replace=item/price / Which displays: $security proxied decimal.Decimal instance at 0x41d76694 Hi, in current Zope versions python decimals are security proxied. (See also http://www.zope.org/Collectors/Zope3-dev/543 ) I think a better solution than the one described in the bug is the following: Write an interface IDecimal which includes alle the mehtods you want to access in views and page tempates. Put the following into your configure.zcml: class class=decimal.Decimal implements interface=.interfaces.IDecimal / allow interface=.interfaces.IDecimal / /class It declares that the class decimal.Decimal implements your IDecimal interface and that there are no security restrictions on the interface. HTH, mac ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Adapting multiple times
Am Mittwoch, den 05.04.2006, 08:48 +0200 schrieb Frank Burkhardt: Hi, I've got objects implementing interface IMyObject and two adapters: IMyObject - ISearchable ISearchable - ISearchableEN I would like to use a TextIndex to do fulltext search on objects implementing ISearchableEN . Unfortunately this doesn't work. The TextIndex tries something like this to adapt an object to the given interface: ISearchableEN(myobject) Which fails (Unable to adapt) because there is no adapter IMyObject - ISearchableEN and Zope doesn't try to adapt multiple times ( IMyObject - ISearchable - ISearchableEN ). Does anyone have an Idea how to do this or do I have to modify the TextIndex? Idea: Write an adater which Adapts IMyObject to ISearchableEN. This Adapter can be a function which only does the adaption chain and returns the Adapter to ISearchableEn adapter. HTH, mac ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] principalfolder breaks manager
Am Donnerstag, den 30.03.2006, 17:58 +0200 schrieb Frank Burkhardt: Hi, after adding a principal folder, the manager principal is no longer valid. That's bad, because I'm unable to remove the principal folder again (at least without pdb or 'zopectl debug'). Is there a special reason for that behaviour or do i miss something (like: you have to install utility XY before adding/registering the principal folder)? I added a principal 'test' to the folder (prefix='mpgsite') and a line like this to zcml: grantAll principal=mpgsite.test / You can only do a grantAll for users defined via ZCML. All other users you have to do zope.app.securitypolicy.principalpermission \ import principalPermissionManager principalPermissionManager.grantAllPermissionsToPrincipal(mpgsite.test) -- Mit freundlichen Grüßen Michael Howitz ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] DropdownWidget with SimpleVocabulary causes ConversionError.
Am Montag, den 27.03.2006, 18:31 +0900 schrieb [EMAIL PROTECTED]: I'd like to ask one more question. Why does SimpleVocabulary.fromValues/fromItems() not set 'title' ? Is there any good reason? Current implementation is unconvenient for non-ascii people. Sure. Maybe a new method is needed which gets tuples of length three which sets value, token and title. Otherwise you can write a subclass of SimpleVocabulary which is more convenient for non-ascii people. (Maybe there is a reason why it is called 'simple' ;-) mac ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] DropdownWidget with SimpleVocabulary causes ConversionError.
Am Montag, den 27.03.2006, 11:52 +0900 schrieb [EMAIL PROTECTED]: Hi, I got a ploblem with SimpleVocabulary/SimpleTerm. Here is the situation of that. (1) I used Zope3.2 on Windows XP. (2) I made : a vocabulary, and a Choice field with the vocabulary, and a schema contains the field, and an add-form using the schema. (3) the vocabulary was made using SimpleVocabulary.fromValues(). with values which are all unicode strings(japanese). Hi, Vocabularies hav three levels: value: which is stored in ZODB token: which is used as value attribute of the option tag in HTML-Page. It must be convertable to str with ASCII encoding because when the conversion is done the encoding of the page is not yet known. (Correct me if I'm wrong here) title: which is dislpayed to the user as the contents of the option tag SimpleVocabulary.fromValues uses the values as value, token and title, so it is only useable with ASCII values. So you have to do it like this way: SimpleVocabulary(SimpleTerm(value, token, title), ...) token might be the uid of value, if it is an object which is stored in ZODB. -- mac ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: Creating objects in software space when making site
Am Dienstag, den 07.03.2006, 12:49 +0100 schrieb Florian Lindner: Hello, I've tried from __init__ so content is self in my case (at least I think so): from zope.app.component import site from zope.proxy import removeAllProxies class Centershock(BTreeContainer, SiteManagerContainer): __doc__ = ICentershock.__doc__ implements(ICentershock) def __init__(self): Makes this object a site and add some required utitlies. bare = removeAllProxies(self) sm = site.LocalSiteManager(bare) self.setSiteManager(sm) That gives the wierd error: File /home/florian/Zope3/src/zope/interface/adapter.py, line 481, in subscribers subscribers = [subscription(*objects) File /home/florian/Zope3/src/zope/app/container/contained.py, line 183, in dispatchToSublocations for sub in subs.sublocations(): File /home/florian/Zope3/src/zope/app/container/contained.py, line 214, in sublocations for key in container: File /home/florian/Zope3/src/zope/app/container/sample.py, line 56, in __iter__ return iter(self.__data) AttributeError: 'Centershock' object has no attribute '_SampleContainer__data' Any idea? How about calling super(Centershock, self).__init__(*args, **kw) But this will not work because during __init__ you have no context which is needed by the site manager. Try to subscribe to the ObjectAddedEvent. -- Mit freundlichen Grüßen Michael Howitz ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Adapting a builtin?
On Mon, 2005-12-12 at 18:06 -0500, Paul Winkler wrote: [...] # toward the end of # tests/testtests/test_AcceleratedHTTPCacheManager.py # def test_XXXinterface(self): url = 'http://www.google.com' from Products.StandardCacheManagers.interfaces import IHTTPConnection conn = IHTTPConnection(url) # This raises an error, regardless of whether I remove the registration of IString or not: [...] TypeError: ('Could not adapt', 'http://www.google.com', InterfaceClass Products.StandardCacheManagers.interfaces.IHTTPConnection) In unittests the ZCML-Directives are not used so you have to do the things from ZCML in your test-code before adaption. from zope.interface import classImplements from zope.app.testing import ztapi classImplements(str, IString) ztapi.provideAdapter(IString, IHTTPConnection, HTTPConnection) HTH, mac ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users