Re: [Zope3-Users] Implementing a DropdownWidget for a country-code vocabulary
Am Samstag, 15. September 2007 18:08 schrieb Jesper Petersen: Hello!I'm trying to implement a DropdownWidget for my country list. In my app i'd like to have a dropdown menu where a user can choose a country (for my main content object, a job). My vocabulary is created from a list of strings, and stored in a local utility: SimpleVocabulary.fromValues( [u'AD', u'AE', 'AF', ...] ) But in my dropdown widget i want to display the country name for each option too.. and not just the same value on both the value attribute and inside the element: option value=ADAndorra/option Perhaps I misunderstand your question, but AFAIK vocabulary support this scenario. In my application, I also have a country drop-down that is in my case filled from a relational database. The vocabulary looks like this: def landVocabulary(obj): Get ktoids and ktonrs from session session = zalchemy.getSession() laender = session.query(Land) laender_terms = [] for n, land in enumerate(laender): laender_terms.append(vocabulary.SimpleVocabulary.\ createTerm(land.landid, n, land.name)) return vocabulary.SimpleVocabulary(laender_terms) # Make function a vocabulary factory alsoProvides(landVocabulary, IVocabularyFactory) and in my configuration: utility component=.utils.landVocabulary name=landVocabulary / Now I can use this vocabulary from any interface. Best regards, Hermann -- [EMAIL PROTECTED] GPG key ID: 299893C7 (on keyservers) FP: 0124 2584 8809 EF2A DBF9 4902 64B4 D16B 2998 93C7 ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] zopeproject install failure
Linux x86_64 Python 2.5.1 (r251:54863, Sep 17 2007, 10:13:22) [GCC 4.1.2 20070626 (Red Hat 4.1.2-13)] on linux2 There are numerous warning: initialization from incompatible pointer type when compiling the .c modules. When I built Python 2.5.1 I had to use the CFLAG -fwrapv Is this the same issue? If so, where can I add that flag so the zope .c files will be compiled correctly? What happens is that the process builds and the server will start but when you execute a request (http://localhost:8080) you end up getting a MemoryError --- /buildout-eggs/tmpUBM6Io/zope.app.container-3.5.0a1-py2.5-linux-x86_64.egg/zope/app/container/browser/contents.py, line 120, in _normalListContentsInfo MemoryError -- Complete Traceback attached. Thanks, Tim -- Timothy Cook, MSc Health Informatics Research Development Services http://timothywayne.cook.googlepages.com/home 01-904-322-8582 Platform: Python 2.5.1 (r251:54863, Sep 12 2007, 09:06:03) [GCC 4.1.2 20070626 (Red Hat 4.1.2-13)] on linux2 [EMAIL PROTECTED] WebApp]$ bin/webapp-ctl fg bin/paster serve deploy.ini /home/tim/buildout-eggs/zope.configuration-3.4.0b1-py2.5.egg/zope/configuration/config.py:182: DeprecationWarning: the gopherlib module is deprecated mod = __import__(mname, *_import_chickens) Starting server in PID 7641. serving on http://127.0.0.1:8080 -- 2007-09-17T09:15:31 ERROR SiteError http://127.0.0.1:8080/@@index.html Traceback (most recent call last): File /home/tim/buildout-eggs/tmpGF47n7/zope.publisher-3.5.0a1.dev_r78838-py2.5.egg/zope/publisher/publish.py, line 133, in publish File /home/tim/buildout-eggs/tmptGyD29/zope.app.publication-3.4.0a1_2-py2.5.egg/zope/app/publication/zopepublication.py, line 167, in callObject File /home/tim/buildout-eggs/tmpGF47n7/zope.publisher-3.5.0a1.dev_r78838-py2.5.egg/zope/publisher/publish.py, line 108, in mapply - __traceback_info__: bound method Contents.index of zope.app.publisher.browser.viewmeta.Contents object at 0x25df610 File /home/tim/buildout-eggs/tmpGF47n7/zope.publisher-3.5.0a1.dev_r78838-py2.5.egg/zope/publisher/publish.py, line 114, in debug_call File /home/tim/buildout-eggs/tmpUBM6Io/zope.app.container-3.5.0a1-py2.5-linux-x86_64.egg/zope/app/container/browser/contents.py, line 439, in index File /home/tim/buildout-eggs/tmpXtcwY7/zope.app.pagetemplate-3.4.0b1dev_r75616-py2.5.egg/zope/app/pagetemplate/viewpagetemplatefile.py, line 83, in __call__ File /home/tim/buildout-eggs/tmpXtcwY7/zope.app.pagetemplate-3.4.0b1dev_r75616-py2.5.egg/zope/app/pagetemplate/viewpagetemplatefile.py, line 51, in __call__ File /home/tim/buildout-eggs/tmpudHd93/zope.pagetemplate-3.4.0a1-py2.5.egg/zope/pagetemplate/pagetemplate.py, line 115, in pt_render File /home/tim/buildout-eggs/tmpM4Z-gT/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py, line 271, in __call__ File /home/tim/buildout-eggs/tmpM4Z-gT/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py, line 346, in interpret File /home/tim/buildout-eggs/tmpM4Z-gT/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py, line 891, in do_useMacro File /home/tim/buildout-eggs/tmpM4Z-gT/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py, line 346, in interpret File /home/tim/buildout-eggs/tmpM4Z-gT/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py, line 536, in do_optTag_tal File /home/tim/buildout-eggs/tmpM4Z-gT/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py, line 521, in do_optTag File /home/tim/buildout-eggs/tmpM4Z-gT/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py, line 516, in no_tag File /home/tim/buildout-eggs/tmpM4Z-gT/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py, line 346, in interpret File /home/tim/buildout-eggs/tmpM4Z-gT/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py, line 861, in do_defineMacro File /home/tim/buildout-eggs/tmpM4Z-gT/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py, line 346, in interpret File /home/tim/buildout-eggs/tmpM4Z-gT/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py, line 957, in do_defineSlot File /home/tim/buildout-eggs/tmpM4Z-gT/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py, line 346, in interpret File /home/tim/buildout-eggs/tmpM4Z-gT/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py, line 949, in do_defineSlot File /home/tim/buildout-eggs/tmpM4Z-gT/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py, line 346, in interpret File /home/tim/buildout-eggs/tmpM4Z-gT/zope.tal-3.4.0b1-py2.5.egg/zope/tal/talinterpreter.py, line 822, in do_loop_tal File /home/tim/buildout-eggs/tmp4nmVnm/zope.tales-3.4.0a1-py2.5.egg/zope/tales/tales.py, line 682, in setRepeat File /home/tim/buildout-eggs/tmp4nmVnm/zope.tales-3.4.0a1-py2.5.egg/zope/tales/tales.py, line 696, in evaluate - /home/tim/buildout-eggs/zope.app.container-3.5.0a1-py2.5-linux-x86_64.egg/zope/app/container/browser/index.pt - Line 36, Column 6 - Expression: PathExpr
[Zope3-Users] asynchronous events in Zope3 (was: crossbar switch for event)
Hi all, so let's be more concrete: here is a first temporary freehand sketch of the 'event crossbar switch': http://trac.ict-ok.org/browser/documentation/temporary/20070917_queue01.pdf even more concrete for Obj1 and Obj3: Obj1 should be an UPS. the signal shoul be 'battery empty/shutdown now' Obj3 should be a server. The user can configure an additional short connect between Obj1 and Obj4. This will shutdown Obj4 (e.g. another server) on next 'battery emplty'-event, too. I'm working on this within the next few days - anybody additional ideas or 'wishes'? Markus ps. e.g. an early definition of Obj1 will be: http://trac.ict-ok.org/browser/trunk/org/ict_ok/components/host/special/mge_ups/interfaces.py Am Dienstag 19 Juni 2007 um 23:30 Uhr schrieb Stephan Richter [EMAIL PROTECTED]: On Monday 18 June 2007 18:30, Markus Leist wrote: When the registration of an event between the objects and the utility is bidirectional, this utility is some kind of event crossbar switch like obj 1 - - 0 obj 2 0 0 - obj 3 0 - 0 obj a obj b obj c which _dynamically_ can be configured through the web. (some other aspects are routing, metric/priority, detection of event cycle ...) Is there some piece of code? Any ideas? I really have no idea what you are talking about. You have not defined obj 1, obj 2, obj 3. Also, what does - mean? I think a very concrete example would be best. ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Prevent an event
Am 16.09.2007 um 21:00 schrieb [EMAIL PROTECTED]: Is there away to prevent the catalog from auto-indexing upon creation of the catalog? Why would you want to do this on the catalog level? You can exclude objects from being auto-(re-)indexed by implementing `zope.app.catalog`'s marker interfaces `INoAutoIndex` and `INoAutoReindex`, respectively. Regards, Markus Kemmerling ___ Markus Kemmerling Medical University Vienna Core Unit for Medical Education P.O. Box 10 A-1097 Vienna phone: +43-1-40 160-36 863 fax: +43-1-40 160-93 65 00 http://www.meduniwien.ac.at/bemaw/ ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Re: Announcing zopeproject 0.4
Philipp von Weitershausen schrieb: zopeproject makes it easy to get started with a web application based on Zope eggs, zc.buildout and WSGI/Paste. If you're not familiar with this world yet, zopeproject is your easy entry to it. If you are, zopeproject will save you lots of typing up the boilerplate. Thank you for developing zopeproject, this is very useful. With zopeproject's approach, *your code* is the application. The web application, to be precise. And it *happens* to use Zope. As a library:: ++ +-+ +-+ |WSGI gateway| serves | your code | uses | Zope | | (server) | -- |(application)| |libraries| ++ +-+ +-+ Now for that part - one of my use cases would be to allow XML-RPC access only throughout the app. How would you setup the application with and without security support, disabling all other protocols defined in the publisher and the ZMI altogether ? Michael -- http://www.zope.org/Members/d2m http:/planetzope.org ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Re: zopeproject install failure
Tim Cook wrote: Linux x86_64 Python 2.5.1 (r251:54863, Sep 17 2007, 10:13:22) [GCC 4.1.2 20070626 (Red Hat 4.1.2-13)] on linux2 There are numerous warning: initialization from incompatible pointer type when compiling the .c modules. Yup. Mostly if not only from the ZODB. When I built Python 2.5.1 I had to use the CFLAG -fwrapv Is this the same issue? If so, where can I add that flag so the zope .c files will be compiled correctly? What does that flag do? I can compile my stuff with Python 2.5.1 just fine. What happens is that the process builds and the server will start but when you execute a request (http://localhost:8080) you end up getting a MemoryError --- /buildout-eggs/tmpUBM6Io/zope.app.container-3.5.0a1-py2.5-linux-x86_64.egg/zope/app/container/browser/contents.py, line 120, in _normalListContentsInfo MemoryError -- I've heard of another report where a MemoryError would occur with PYthon 2.5 on Linux x86 64bit. I don't have access to such a machine, unfortunately. It would be great if somebody with some C debugging skills could check this out. It might already be good to know whether it only occurs with zope.app.container, or also with other module that have C extensions. Note, this isn't a bug of zopeproject :). It just shows that Python 2.4 is still the only blessed platform, for a good reason. -- http://worldcookery.com -- Professional Zope documentation and training ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Re: Announcing zopeproject 0.4
Michael Haubenwallner wrote: Philipp von Weitershausen schrieb: zopeproject makes it easy to get started with a web application based on Zope eggs, zc.buildout and WSGI/Paste. If you're not familiar with this world yet, zopeproject is your easy entry to it. If you are, zopeproject will save you lots of typing up the boilerplate. Thank you for developing zopeproject, this is very useful. With zopeproject's approach, *your code* is the application. The web application, to be precise. And it *happens* to use Zope. As a library:: ++ +-+ +-+ |WSGI gateway| serves | your code | uses | Zope | | (server) | -- |(application)| |libraries| ++ +-+ +-+ Now for that part - one of my use cases would be to allow XML-RPC access only throughout the app. How would you setup the application with and without security support, disabling all other protocols defined in the publisher and the ZMI altogether ? The PublicationRequestFactory in z.a.publication decides what to do with an incoming HTTP request. Based on configurable rules, it can instantiate the request type you like. By default, your application generated with zopeproject includes z.a.zcmlfiles/configure.zcml right at the top of its conigure.zcml. z.a.zcmlfiles/configure.zcml in turn includes z.a.publication/configure.zcml which configures a bunch of default rules, including those for Browser, HTTP/DAV and XMLRPC requests. You'll basically have to disable those if you just want XMLRPC. How do you do that? First of all, get rid of include package=zope.app.zcmlfiles / in your package's configure.zcml. Now you're not getting z.a.publication anymore, but you're obviously missing a lot of other useful stuff which you'll likely have to add to your package's configure.zcml manually. This is a try-and-error procedure; it also depends on how much stuff you actually want. This may take some time trying out, but in the end you're very flexible about what you're loading and what not. Then, you'll obviously have to add back a rule for the PublicationRequestFactory to instantiate XMLRPC requests. If your app should only ever do XMLRPC, it's simple: configure the rule to always create an XMLRPC request. Basically, in the end you'll have to do some peeking in z.a.zcmlfiles/configure.zcml and z.a.publication/configure.zcml and selectively copy the stuff you want to your package's configure.zcml. Btw, if you manage to get it working, please share your results. I'd be interested in whether it's as straight-forward as I'd like it to be with zopeproject... -- http://worldcookery.com -- Professional Zope documentation and training ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Python 2.5.1 on x86_64 was: [Zope3-Users] Re: zopeproject install failure
On Mon, 2007-09-17 at 14:01 +0200, Philipp von Weitershausen wrote: There are numerous warning: initialization from incompatible pointer type when compiling the .c modules. Yup. Mostly if not only from the ZODB. There and from BTree/* When I built Python 2.5.1 I had to use the CFLAG -fwrapv Is this the same issue? If so, where can I add that flag so the zope .c files will be compiled correctly? What does that flag do? From the GCC manual: Using ‘-fwrapv’ means that signed overflow is fully defined: it wraps. When ‘-fwrapv’ is used, there is no difference between‘-fstrict-overflow’ and ‘-fno-strict-overflow’. With ‘-fwrapv’ certain types of overflow are permitted. For example, if the compiler gets an overflow when doing arithmetic on constants, the overflowed value can still be used with ‘-fwrapv’, but not otherwise. I can compile my stuff with Python 2.5.1 just fine. Which GCC is it built with? I've heard of another report where a MemoryError would occur with PYthon 2.5 on Linux x86 64bit. I don't have access to such a machine, unfortunately. It would be great if somebody with some C debugging skills could check this out. It might already be good to know whether it only occurs with zope.app.container, or also with other module that have C extensions. Probably any C code. Note, this isn't a bug of zopeproject :). It just shows that Python 2.4 is still the only blessed platform, for a good reason. You are correct and I shouldn't have used that subject line. I was ready to prove that it wasn't the Pythoon version but the GCC. So I installed Python 2.4.4 using GCC 4.1.2 and expected the exact same failures. I was wrong. It works as advertised. Hmm. Now I'm really confused. But; I haven't the skills to fix it. This is just so that others may see that even though some people are successful with Zope 3.4.x / Python 2.5.1 it may be a platform dependency issue as well. Cheers, Tim -- Timothy Cook, MSc Health Informatics Research Development Services http://timothywayne.cook.googlepages.com/home 01-904-322-8582 ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Prevent an event
Markkus, Thanks for your reply, I'm having scaling issues and want to be in control of the indexing process. I have a large number of documents already in the system. I believe the best case for me in the short run is to prevent the initial indexing on catalog creation and if understand it correctly, recursively touching all of my objects. Kevin Smith Markus Kemmerling wrote: Am 16.09.2007 um 21:00 schrieb [EMAIL PROTECTED]: Is there away to prevent the catalog from auto-indexing upon creation of the catalog? Why would you want to do this on the catalog level? You can exclude objects from being auto-(re-)indexed by implementing `zope.app.catalog`'s marker interfaces `INoAutoIndex` and `INoAutoReindex`, respectively. Regards, Markus Kemmerling ___ Markus Kemmerling Medical University Vienna Core Unit for Medical Education P.O. Box 10 A-1097 Vienna phone: +43-1-40 160-36 863 fax: +43-1-40 160-93 65 00 http://www.meduniwien.ac.at/bemaw/ ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: Prevent an event
Philipp von Weitershausen wrote: Just to be clear: As far as I remember, nothing happens on catalog creation. Stuff happens on *index* creation. When you add an index to a catalog that is already aware of objects, it will make sure that the newly added catalog is up to date by forcing an indexing procedure. And yes, this will wake up all the objects in your catalog (which isn't a recursive process, nor does it mean touching in the sense of modification). Unfortuantely, there isn't a way to prevent the execution of a selected event subscriber (which is probably what you want; you don't want to prevent the event as a whole). I've had the need to do this when adding an index to an app with a large amount of content (30 gig or so), but unfortunately I don't remember how we did it. If no one pipes up soon I'll try to dig up the details. -- Benji York Senior Software Engineer Zope Corporation ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: Prevent an event
Am 17.09.2007 um 19:45 schrieb Philipp von Weitershausen: Kevin Smith wrote: Thanks for your reply, I'm having scaling issues and want to be in control of the indexing process. I have a large number of documents already in the system. I believe the best case for me in the short run is to prevent the initial indexing on catalog creation and if understand it correctly, recursively touching all of my objects. Just to be clear: As far as I remember, nothing happens on catalog creation. Stuff happens on *index* creation. When you add an index to a catalog that is already aware of objects, it will make sure that the newly added catalog is up to date by forcing an indexing procedure. And yes, this will wake up all the objects in your catalog (which isn't a recursive process, nor does it mean touching in the sense of modification). Unfortuantely, there isn't a way to prevent the execution of a selected event subscriber (which is probably what you want; you don't want to prevent the event as a whole). Why not just disable the `indexAdded` event subscriber, add the indices, and enable it again? Ok, that means two server restarts, but there will probably be a time when you could do that and adding the indices themselves is *not* time consuming. Or am I missing something? Regards, Markus Kemmerling ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Re: Prevent an event
Kevin Smith wrote: Thanks for your reply, I'm having scaling issues and want to be in control of the indexing process. I have a large number of documents already in the system. I believe the best case for me in the short run is to prevent the initial indexing on catalog creation and if understand it correctly, recursively touching all of my objects. Just to be clear: As far as I remember, nothing happens on catalog creation. Stuff happens on *index* creation. When you add an index to a catalog that is already aware of objects, it will make sure that the newly added catalog is up to date by forcing an indexing procedure. And yes, this will wake up all the objects in your catalog (which isn't a recursive process, nor does it mean touching in the sense of modification). Unfortuantely, there isn't a way to prevent the execution of a selected event subscriber (which is probably what you want; you don't want to prevent the event as a whole). -- http://worldcookery.com -- Professional Zope documentation and training ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users