Re: [Zope3-Users] Variables in reStructuredText
Just as an idea: use the python string modul for substitution. Write in ReST: .. figure:: path/to/image $title or ${caption} and in your python code: theTitle = myPhoto.getTitle() theCaption = myPhoto.getCaption() theText = GetTheRestructuredTextFromMyData(...) theText = string.Template(theText).safe_substitute(theTitle, theCaption) Regards Klaus Ursprüngliche Nachricht am: Wed, 7 Mar 2007 09:00:04 +0400 von: Yann VOTE : [EMAIL PROTECTED] >Hello, > >Is there a way to access attributes from a reStructuredText-rendered >widget ? > >More precisely: > >I have a IPhoto schema which extend IImage. The fields are 'contentType' >and 'data' from IImage, and 'title' and 'caption' which are specific to >IPhoto. These last two fields are effectively used elsewhere in the >application, in some page template. > >But now I want to show an image wraped into some reStructuredText, >together with its title and caption. Something like the following in a >text widget: > >.. figure:: path/to/image > > title > > caption > >But I can't find out how to access the title and caption attributes. Is >this possible ? Is there another way to achieve this ? > >Thanks, > >Yann > > > > > >___ >Yahoo! Mail r?invente le mail ! D?couvrez le nouveau Yahoo! Mail et son >interface r?volutionnaire. >http://fr.mail.yahoo.com >___ >Zope3-users mailing list >Zope3-users@zope.org >http://mail.zope.org/mailman/listinfo/zope3-users > ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Design question (object or interface for category implementation?)
On 07.03.2007, at 01:32, Christophe Combelles wrote: Bernd Dorn a écrit : On 06.03.2007, at 18:54, Christophe Combelles wrote: Hi, I'm playing again with the notion of categories of objects. I have two main goals: - 1) I must let the user choose the category of an object added to the zodb. For this, I must be able to retrieve the list of categories and present them in a form field managed by a vocabulary (or in a different manner). 2) I must have different behaviours for categorized objects: objects of different categories would have different views, different addMenuItems (if they are containers), etc. the first requirement would tell me to define categories as objects, while the second one would tell me to define them as interfaces. The possible solutions I see: 1) The simplest solution is to store the categories as text strings into the annotations of the object. So categories actually are just tags. 2) The second solution is to do the same, but replace text strings with category objects, that implement ICategory. And categories can be stored separately in a category container, or in a registered utility that gives the list of available categories. This is a bit better, but this way I don't know how to easily let my categorized objects behave differently according to their categories. 3) The third solution is to define categories as interfaces extending ICategory. I can retrieve the list of categories with ICategory.dependents But to present them in a form, I must have a pretty name for each interface. Should I store them in a Tagged Value? 4) The fourth solution I see, is to define an interface type, ICategoryType, extending IInterface just like IContentType. Then my categories would be interfaces whose type is ICategoryType. But with IContentType, is there a way to retrieve the list of all available content types? imho 4) is the best solution, just take a look at zope.app.content to see how to get the vocabulary and the inspection implementation of objects you can then set the interface on objects by using zope.interface.alsoProvides But with 4), I guess I won't be able to assign two categories onto an object, An object can have only one ContentType this is not true an object can implement many interfaces so why shouldnt it be possible to assign many subclasses of IInterface (or did i m iss something?), use alsoProvides, not directlyProvides I feel that 3) is easier, but I don't know how to assign an retrieve a display name to interfaces. A real example is the following: --- I want to define objects that represent Companies. A company can be either a client, or a provider, or both, or in the future it could be of another type. When the user creates a company, it must choose "client", "provider", or both. The choice would assign a different interface to the object: IClient, or IProvider, and this would lead to different views for these objects. So "client" and "provider" are categories of companies. So I would tend to have: class ICompany(Interface) class IClient(ICompany) class IProvider(ICompany) This is simple, but now how do I assign a name to these interface, so that the user will choose between "Client" and "Provider", and not between "IClient" and "IProvider"? Is it feasible with Tagged Value ? Or with the "name" attribute in the zope:interface ZCML declaration? use the name attribute, skins in zope work the same way regards, Bernd Do you have some advice on the subject? Am I asking the wrong questions? Is there an obvious solution I've not seen? Am I going too far and should I rather keep it simple and stupid? regards, Christophe ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Variables in reStructuredText
Hello, Is there a way to access attributes from a reStructuredText-rendered widget ? More precisely: I have a IPhoto schema which extend IImage. The fields are 'contentType' and 'data' from IImage, and 'title' and 'caption' which are specific to IPhoto. These last two fields are effectively used elsewhere in the application, in some page template. But now I want to show an image wraped into some reStructuredText, together with its title and caption. Something like the following in a text widget: .. figure:: path/to/image title caption But I can't find out how to access the title and caption attributes. Is this possible ? Is there another way to achieve this ? Thanks, Yann ___ Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire. http://fr.mail.yahoo.com ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Design question (object or interface for category implementation?)
Bernd Dorn a écrit : On 06.03.2007, at 18:54, Christophe Combelles wrote: Hi, I'm playing again with the notion of categories of objects. I have two main goals: - 1) I must let the user choose the category of an object added to the zodb. For this, I must be able to retrieve the list of categories and present them in a form field managed by a vocabulary (or in a different manner). 2) I must have different behaviours for categorized objects: objects of different categories would have different views, different addMenuItems (if they are containers), etc. the first requirement would tell me to define categories as objects, while the second one would tell me to define them as interfaces. The possible solutions I see: 1) The simplest solution is to store the categories as text strings into the annotations of the object. So categories actually are just tags. 2) The second solution is to do the same, but replace text strings with category objects, that implement ICategory. And categories can be stored separately in a category container, or in a registered utility that gives the list of available categories. This is a bit better, but this way I don't know how to easily let my categorized objects behave differently according to their categories. 3) The third solution is to define categories as interfaces extending ICategory. I can retrieve the list of categories with ICategory.dependents But to present them in a form, I must have a pretty name for each interface. Should I store them in a Tagged Value? 4) The fourth solution I see, is to define an interface type, ICategoryType, extending IInterface just like IContentType. Then my categories would be interfaces whose type is ICategoryType. But with IContentType, is there a way to retrieve the list of all available content types? imho 4) is the best solution, just take a look at zope.app.content to see how to get the vocabulary and the inspection implementation of objects you can then set the interface on objects by using zope.interface.alsoProvides But with 4), I guess I won't be able to assign two categories onto an object, An object can have only one ContentType I feel that 3) is easier, but I don't know how to assign an retrieve a display name to interfaces. A real example is the following: --- I want to define objects that represent Companies. A company can be either a client, or a provider, or both, or in the future it could be of another type. When the user creates a company, it must choose "client", "provider", or both. The choice would assign a different interface to the object: IClient, or IProvider, and this would lead to different views for these objects. So "client" and "provider" are categories of companies. So I would tend to have: class ICompany(Interface) class IClient(ICompany) class IProvider(ICompany) This is simple, but now how do I assign a name to these interface, so that the user will choose between "Client" and "Provider", and not between "IClient" and "IProvider"? Is it feasible with Tagged Value ? Or with the "name" attribute in the zope:interface ZCML declaration? regards, Bernd Do you have some advice on the subject? Am I asking the wrong questions? Is there an obvious solution I've not seen? Am I going too far and should I rather keep it simple and stupid? regards, Christophe ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Internationalisation of a viewlet property
On Tuesday 06 March 2007 15:59, Thierry Florac wrote: > My problem is simple : how can I get the "label" property to be > correctly included by the I18n extraction machinery in my gettext ".pot" > file ? Write a sub-class. The option to add arbitrary attributes to the viwelet directive was never intended to be used for all possible attributes. Regards, Stephan -- Stephan Richter CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student) Web2k - Web Software Design, Development and Training ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Internationalisation of a viewlet property
Hi, I've created a custom viewlet to display a menu entries with the following declaration : My problem is simple : how can I get the "label" property to be correctly included by the I18n extraction machinery in my gettext ".pot" file ? Thanks, Thierry -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Design question (object or interface for category implementation?)
On 06.03.2007, at 18:54, Christophe Combelles wrote: Hi, I'm playing again with the notion of categories of objects. I have two main goals: - 1) I must let the user choose the category of an object added to the zodb. For this, I must be able to retrieve the list of categories and present them in a form field managed by a vocabulary (or in a different manner). 2) I must have different behaviours for categorized objects: objects of different categories would have different views, different addMenuItems (if they are containers), etc. the first requirement would tell me to define categories as objects, while the second one would tell me to define them as interfaces. The possible solutions I see: 1) The simplest solution is to store the categories as text strings into the annotations of the object. So categories actually are just tags. 2) The second solution is to do the same, but replace text strings with category objects, that implement ICategory. And categories can be stored separately in a category container, or in a registered utility that gives the list of available categories. This is a bit better, but this way I don't know how to easily let my categorized objects behave differently according to their categories. 3) The third solution is to define categories as interfaces extending ICategory. I can retrieve the list of categories with ICategory.dependents But to present them in a form, I must have a pretty name for each interface. Should I store them in a Tagged Value? 4) The fourth solution I see, is to define an interface type, ICategoryType, extending IInterface just like IContentType. Then my categories would be interfaces whose type is ICategoryType. But with IContentType, is there a way to retrieve the list of all available content types? imho 4) is the best solution, just take a look at zope.app.content to see how to get the vocabulary and the inspection implementation of objects you can then set the interface on objects by using zope.interface.alsoProvides regards, Bernd Do you have some advice on the subject? Am I asking the wrong questions? Is there an obvious solution I've not seen? Am I going too far and should I rather keep it simple and stupid? regards, Christophe ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Design question (object or interface for category implementation?)
Hi, I'm playing again with the notion of categories of objects. I have two main goals: - 1) I must let the user choose the category of an object added to the zodb. For this, I must be able to retrieve the list of categories and present them in a form field managed by a vocabulary (or in a different manner). 2) I must have different behaviours for categorized objects: objects of different categories would have different views, different addMenuItems (if they are containers), etc. the first requirement would tell me to define categories as objects, while the second one would tell me to define them as interfaces. The possible solutions I see: 1) The simplest solution is to store the categories as text strings into the annotations of the object. So categories actually are just tags. 2) The second solution is to do the same, but replace text strings with category objects, that implement ICategory. And categories can be stored separately in a category container, or in a registered utility that gives the list of available categories. This is a bit better, but this way I don't know how to easily let my categorized objects behave differently according to their categories. 3) The third solution is to define categories as interfaces extending ICategory. I can retrieve the list of categories with ICategory.dependents But to present them in a form, I must have a pretty name for each interface. Should I store them in a Tagged Value? 4) The fourth solution I see, is to define an interface type, ICategoryType, extending IInterface just like IContentType. Then my categories would be interfaces whose type is ICategoryType. But with IContentType, is there a way to retrieve the list of all available content types? Do you have some advice on the subject? Am I asking the wrong questions? Is there an obvious solution I've not seen? Am I going too far and should I rather keep it simple and stupid? regards, Christophe ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] z3c.ajax help
Hi all ! Could anyone help me with z3c.ajax ? I cannot find neither instructions nor examples showing how to use or deploy it. Thanks in advance ! Sixel ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Zope3 with RDBMS (avoiding ZODB)?
David, Good point! I found same problem with ZAlchmey, and SQLOs could you please share your RBDMS package and procedures with me? maybe we can establish a new open source project to develop it. thanks. On 3/3/07, David Johnson <[EMAIL PROTECTED]> wrote: > 1. Is Zope3 already in use in productive environments? Where are > they (URLs)? We are using Zope 3 pretty heavily in a productive environment, but unfortunately the URLs are secure at this point. We build financial applications and we are building more. Our live RDBMS application is an administrative tool that queries 4 different financial databases. > 2. Are there any bigger sites running on Zope3 (> 5 mio. accesses > per month)? We expect to have loads much greater than this when we are completed, but we do not have any in production. > > 3. Our main problem is: in our Zope2-application we stored our > content in a > RDBMS, we avoided ZODB for that stuff. We are definitely going to > use an RDBMS > (PostgreSQL/MySQL) for the new (Zope3 or Django)-project and still > want to avoid > ZODB where possible. This architectural decision is carved out of > stone. > > Now, where should we start with it in Zope3 to connect it to an RDBMS? We do mostly SQL/RDBMS. We have tried ZAlchmey, and SQLOs, but we find them both a bit limiting and simultaneous complex to get them to work they way we wanted. In general when one develops and RDBMS application of any size, the database structure can get very complex. In order to integrate them into Zope 3 just right, it's best to manually code the containers and objects. We have been able to simplify the process quite a bit and we are very happy with it. It's amazing scalable.If you do decide to go this way, I would be glad to share our RBDMS package and procedures. We've developed some guidelines to improve development. We use MySQL exclusively. > > 3.1 We have found 'PostGreSQL Database Adapter' and 'MySQL Database > Adapter'. Both are from the Isar sprint (2004-11-06). Are they out > of date, > or just 'nearly perfect'? Is anybody using these adapters? > We use the MySQL adapter. Zope 3 has a bug in the database adapters that requires having to use global utilities (etc/overrides.zcml). It is otherwise stable. In otherwords you cannot currently add and use database adapters in Zope 3 through the ZMI but can through overrides.zcml. > 3.2 sqlos - SQLObject Support package (http://codespeak.net/z3/ > sqlos/): > Is it stable? Has someone experiences with it? > In http://mail.zope.org/pipermail/zope3-users/2006-January/001797.html > Stephan Richter says: "On the other hand, not many people use > sqlos, so > it might not be as supported as you wish it would be." Is that > still right? > > 3.3 Also there is 'zsqlmap: Zope3 wrapper for SQLObject' > (http://www.zope.org/Members/garanin/zsqlmap). This is not really a > solution for us because the version number is 0.01b and the author > says: > 'NOTE: i tested only postgres.' Not really a capable product... I find it easier to hand code than use the third party packages. We have created our own classes that we find a bit more simple and versatile. I suppose this is a preference thing. > 4. Has anybody practical experience and hints with Zope3 and RDBMS? > > 5. The ZMI: In Zope2 we never used it. > Do we need the ZMI in Zope 3 just if we will not use the ZODB for > storing our > content objects but an RDBMS instead. According to 'Web Component > Development > with Zope 3' by Philipp von Weiterhausen the ZMI is used to manage > content objects > stored in the ZODB, so our assumption is, if we do not store them > in the ZODB, > we do not need the ZMI. Is that right or do we need the ZMI for > anything else? > Do we need ZMI in Zope3 for administration or can we do that with > scripts etc.? The ZMI is everything in regards to management. The new approach is to skin the ZMI to match your own design scheme. The staff who uses our old management applications in UNIX and PHP loves the new Zope 3 stuff we've done. It's so simple that we plan on extending some of the administrative functionality to our clients. > > 6. Last but not least two quotes from the zope3-dev mailinglist > (http://mail.zope.org/pipermail/zope3-dev/2006-February/018217.html): >> >Shane Hathaway wrote: >>> >> It could >>> >> turn out that people who don't want ZODB really shouldn't use >>> Zope at >>> >> all. >> >This has been the case in my experience... >> >Chris Withers I disagree completely. We use SQL although I do wish that SQL integration was stronger. The structure of Zope is excellent for scalability. You'll pay up front a little, but the simplicity and versatility is really great. We've basically only found 2 platforms that scaled well, J2EE and Zope 3. Zope 3 is vastly better in nearly every way in my opinion, except perhaps documentation. The documentation is very weak, but it is a young platform. The content view model of Zope 3 and the clean API's is wonderful. The pla
[Zope3-Users] Re: ZAlchemy demos (z3c.zalchemy) - Unknown directive: engine
Stephan Richter wrote: On Tuesday 06 March 2007 07:07, Stefan Krumbiegel (Galileo Press) wrote: What could it be? Did you type make after isntalling ZAlchemy? Make sure that alchemy is not included using a symlink, since the MAkefile will not pick this up. "make" will only work if he's using a subversion checkout of Zope 3 *and* is working inside that checkout instead of an instance. That's pretty unlikely (and it's not what I'd recommend anybody getting started with Zope 3 should do). -- http://worldcookery.com -- Professional Zope documentation and training Next Zope 3 training at Camp5: http://trizpug.org/boot-camp/camp5 ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Re: ZAlchemy demos (z3c.zalchemy) - Unknown directive: engine
Stefan Krumbiegel (Galileo Press) wrote: I installed Zope3 (http://www.zope.org/Products/Zope3/3.3.1/Zope-3.3.1.tgz) and z3c.zalchemy from the repository (http://svn.zope.org/z3c.zalchemy/trunk/). I followed the steps in the README.txt to try the ZAlchemy demos... An error occured while starting the Zope3 instance: zope.configuration.xmlconfig.ZopeXMLConfigurationError: File "/web/zope3_instance_worldcookery/etc/site.zcml", line 7.2-7.55 ZopeXMLConfigurationError: File "/web/zope3_instance_worldcookery/etc/package-includes/z3c.zalchemy.demo-configure.zcml", line 2.0-2.46 ZopeXMLConfigurationError: File "/usr/local/lib/python2.4/site-packages/z3c.zalchemy-trunk-py2.4.egg/z3c/zalchemy/demo/demo_1/configure.zcml", line 8.2 ConfigurationError: ('Unknown directive', u'http://namespaces.zalchemy.org/alchemy', u'engine') What could it be? z3c.zalchemy registers a bunch of new directives. Whenever a package does that, you need to load it's "meta" configuration. To do that, add a "z3c.zalchemy-meta.zcml" file to INSTANCE/etc/package-includes with the following contents: -- http://worldcookery.com -- Professional Zope documentation and training Next Zope 3 training at Camp5: http://trizpug.org/boot-camp/camp5 ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Re: ZAlchemy demos (z3c.zalchemy) - Unknown directive: engine
Stefan Krumbiegel (Galileo Press) wrote: I installed Zope3 (http://www.zope.org/Products/Zope3/3.3.1/Zope-3.3.1.tgz) and z3c.zalchemy from the repository (http://svn.zope.org/z3c.zalchemy/trunk/). I followed the steps in the README.txt to try the ZAlchemy demos... An error occured while starting the Zope3 instance: zope.configuration.xmlconfig.ZopeXMLConfigurationError: File "/web/zope3_instance_worldcookery/etc/site.zcml", line 7.2-7.55 ZopeXMLConfigurationError: File "/web/zope3_instance_worldcookery/etc/package-includes/z3c.zalchemy.demo-configure.zcml", line 2.0-2.46 ZopeXMLConfigurationError: File "/usr/local/lib/python2.4/site-packages/z3c.zalchemy-trunk-py2.4.egg/z3c/zalchemy/demo/demo_1/configure.zcml", line 8.2 ConfigurationError: ('Unknown directive', u'http://namespaces.zalchemy.org/alchemy', u'engine') I'm almost 100% sure you need to add z3c.zalchemy-configure.zcml and z3c.zalchemy-meta.zcml to your package-includes. Jürgen ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] ZAlchemy demos (z3c.zalchemy) - Unknown directive: engine
On Tuesday 06 March 2007 07:07, Stefan Krumbiegel (Galileo Press) wrote: > What could it be? Did you type make after isntalling ZAlchemy? Make sure that alchemy is not included using a symlink, since the MAkefile will not pick this up. Regards, Stephan -- Stephan Richter CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student) Web2k - Web Software Design, Development and Training ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] ZAlchemy demos (z3c.zalchemy) - Unknown directive: engine
I installed Zope3 (http://www.zope.org/Products/Zope3/3.3.1/Zope-3.3.1.tgz) and z3c.zalchemy from the repository (http://svn.zope.org/z3c.zalchemy/trunk/). I followed the steps in the README.txt to try the ZAlchemy demos... An error occured while starting the Zope3 instance: zope.configuration.xmlconfig.ZopeXMLConfigurationError: File "/web/zope3_instance_worldcookery/etc/site.zcml", line 7.2-7.55 ZopeXMLConfigurationError: File "/web/zope3_instance_worldcookery/etc/package-includes/z3c.zalchemy.demo-configure.zcml", line 2.0-2.46 ZopeXMLConfigurationError: File "/usr/local/lib/python2.4/site-packages/z3c.zalchemy-trunk-py2.4.egg/z3c/zalchemy/demo/demo_1/configure.zcml", line 8.2 ConfigurationError: ('Unknown directive', u'http://namespaces.zalchemy.org/alchemy', u'engine') What could it be? Thanks and best regards Stefan ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users