Re: [Zope3-Users] Re: Next steps...
On 7/24/06, Philipp von Weitershausen [EMAIL PROTECTED] wrote: Note that in newer Zopes we have a debug shell which saves you a lot oftyping. Simply execute bin/zopectl debug from your instance (you don'teven have to put $INSTANCE/lib/python on your PYTHONPATH), the effect is the same as the Debugger stanza you see in my book. zopectl debug wasn'taround when I wrote the first edition, unfortunately.Does this mean that a second edition is in the works? Given that I am writing my code somewhere different than my zope instance, how to I extend the default site.zcml to include my stuff? I'm sure that the debugger does much more, but after a few minutes thinking about how to add things it seemed relatively obvious - just not explicitly described anywhere. For the benefit of others: - put your development directory in your PYTHONPATH - add a include package=xxx/ in the site.zcml for your package.Indeed that's what you have to do (instead of editing site.zcml you canalso put a worldcookery-configure.zcml slug into etc/package-includes).This is, btw, described in Chapter 2 as a necessary step for making theexamples work anyway (especially the interactive interpreter sessions). Sorry, missed the bit in chapter 2 about this, or had just forgotten by the time I needed to do it.Is adding the slug to the etc/package-includes the preferred way of extending then? In chapter 5 (Content Components), the Recipe object ends up using FieldProperty to initialise members based on the interfaces schema, however in chapter 6 (Persistency) these are dropped and empty unicode strings and PersistentLists used instead.Does this mean that you loose the schema checks on assignment now?Confused :???: Yes, you lose schema checks on assignment. Usually you don't care aboutthem, though. Automated add and edit forms will perform those checks onthe user input anyways, having them on the Python level is (almost) useless. PhilippOK, thanks. It is excellent to have the author answer the questions :)Tim ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Next steps...
On Friday 21 July 2006 16:24, Tim Penhey wrote: Hi All, Going through Philipp's book some more... Once the sections get to content types the samples always show: from zope.app.debug import Debugger debugger = Debugger(db=var/Data.fs, config_file=etc/site.zcml) Given that I am writing my code somewhere different than my zope instance, how to I extend the default site.zcml to include my stuff? I'm sure that the debugger does much more, but after a few minutes thinking about how to add things it seemed relatively obvious - just not explicitly described anywhere. For the benefit of others: - put your development directory in your PYTHONPATH - add a include package=xxx/ in the site.zcml for your package. Next question: In chapter 5 (Content Components), the Recipe object ends up using FieldProperty to initialise members based on the interfaces schema, however in chapter 6 (Persistency) these are dropped and empty unicode strings and PersistentLists used instead. Does this mean that you loose the schema checks on assignment now? Confused :???: Still interested in an answer for this. Tim ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Next steps...
Hi All, Going through Philipp's book some more... Once the sections get to content types the samples always show: from zope.app.debug import Debugger debugger = Debugger(db=var/Data.fs, config_file=etc/site.zcml) The purpose for this doesn't seem to be described anywhere. I can guess, but I am curious to the actual reason. Is it just to initalise the zope environment, set the persistant store and config? Given that I am writing my code somewhere different than my zope instance, how to I extend the default site.zcml to include my stuff? I am developing on both linux and win xp. Next question: In chapter 5 (Content Components), the Recipe object ends up using FieldProperty to initialise members based on the interfaces schema, however in chapter 6 (Persistency) these are dropped and empty unicode strings and PersistentLists used instead. Does this mean that you loose the schema checks on assignment now? Confused :???: Tim ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] A gentle push in the right direction needed
Hi all, I have an application that is written with Struts (Java servlet and JSP) with a postgresql database which I am attempting to rewrite with zope 3. Having read over half of Web Component Development with Zope 3 I thought it was high time to get started. However I seem to have hit my first snag. In the java app I have a customer class which has a postal address, and a list of delivery addresses. So I started with: from zope.interface import Interface from zope.schema import TextLine class IAddress(Interface): Address details line1 = TextLine( title=uLine 1, description=uThe first line of the address, required=True ) line2 = TextLine( title=uLine 2, description=uThe second line of the address, required=False ) city = TextLine( title=uCity, description=uThe city, required=False ) county = TextLine( title=uCounty, description=uCounty for the address, required=False ) postcode = TextLine( title=uPostcode, description=uPostcode of the address, required=False ) Then... from zope.interface import Interface from zope.schema import Bool, Float, Text, TextLine, Int, InterfaceField class ICustomer(Interface): Information about our customers id = Int( title=uID, description=uThe customer's unique id, required=True, min=1 ) name = TextLine( title=uName, description=uThe name of the customer, required=True ) postal_address = InterfaceField( title=uPostal Address ) Now it is with the postal_address I hit my first snag. I really want to say that it is an IAddress. Am I using InterfaceField correctly here? Is there an option to specify the type of the interface? Also how do I specify a list of addresses? Thanks. Tim ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] A gentle push in the right direction needed
On Wednesday 19 July 2006 22:03, Darryl Cousins wrote: Hi Tim, My solution was to use an address container to act as the 'addressbook'. An adapter is used to attach (using annotations) the addressbook to any object which implements IHaveAddressInfo. An interesting idea. Doctest: http://www.tfws.org.nz/tfws.portal.address.README.html Code: http://projects.treefernwebservices.co.nz/tfws.org.nz/browser/trunk/src/tfw s/portal/address/ Thanks for the reference. Reading real life code really helps understand sometimes. Cheers, Tim ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users