trivial: hello world with filesystem based egg sources
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello, I try to develop something in the egg way, but still missing a point. I have a nice, fresh chrooted env with python, zope, plone etc. For installation I used buildout. Zope works neatly. In the home dir of chroot there is subdir of my project with subdirs like bin (scripts buildout, instance..), eggs, fake-eggs, products, src.. and in the root of project there is buildout.cfg. I'd like to start with easiest possible piece of python code in the egg form (to be redistributable), which could be treated by zope. I started with paster -t plone and answered a few questions. It created couple of dirs in src. I put the name of newly created directory to buildout.cfg sections [buildout]/eggs, [buildout]/develop, [instance]/zcml and rerun buildout. The path_to_chroot/src/projectname seems to be listed in the Debug Information of Zope instance. And now, please, what to do now, to have a few python lines somewhere in the egg dir, which the zope would know how to deal with? And on what url will be the "hello world" available then? Thank you for a patience.. With regards David -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFJsvNP3oCkkciamVERAgNkAJ47T0+XeXwPTEINNHbFfIMVlWfKJgCgh6CS 7xxUW25bnAgBTpD7TeRSmno= =uENF -----END PGP SIGNATURE-----
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Your question makes little sense. The term "egg sources" has nothing to do how to develop something for Zope. In Zope land you either write a Zope 2 Product (the traditional old way) or as a python package - depending on your needs and use case. We don't write eggs - we write packages and distribute them usually as source code distribution. An *egg* is basically only an setuptools *deployment* format. So you don't write eggs, you write proper Python packages. - -aj On 07.03.2009 23:21 Uhr, David Zejda wrote:
Hello,
I try to develop something in the egg way, but still missing a point.
I have a nice, fresh chrooted env with python, zope, plone etc. For installation I used buildout. Zope works neatly.
In the home dir of chroot there is subdir of my project with subdirs like bin (scripts buildout, instance..), eggs, fake-eggs, products, src.. and in the root of project there is buildout.cfg.
I'd like to start with easiest possible piece of python code in the egg form (to be redistributable), which could be treated by zope.
I started with paster -t plone and answered a few questions. It created couple of dirs in src. I put the name of newly created directory to buildout.cfg sections [buildout]/eggs, [buildout]/develop, [instance]/zcml and rerun buildout.
The path_to_chroot/src/projectname seems to be listed in the Debug Information of Zope instance.
And now, please, what to do now, to have a few python lines somewhere in the egg dir, which the zope would know how to deal with? And on what url will be the "hello world" available then?
Thank you for a patience.. With regards David
Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev ) - -- ZOPYX Ltd. & Co. KG - Charlottenstr. 37/1 - 72070 Tübingen - Germany Web: www.zopyx.com - Email: info@zopyx.com - Phone +49 - 7071 - 793376 Registergericht: Amtsgericht Stuttgart, Handelsregister A 381535 Geschäftsführer/Gesellschafter: ZOPYX Limited, Birmingham, UK - ------------------------------------------------------------------------ E-Publishing, Python, Zope & Plone development, Consulting -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkmzaiMACgkQCJIWIbr9KYyLAgCfSQmI54Tm8IzGcWsmD7qBmfGQ EWsAoJErxADTP9uh2FqhvhXirki1Wqj3 =JcdG -----END PGP SIGNATURE-----
On Sat, Mar 7, 2009 at 23:21, David Zejda <dvid@atlas.cz> wrote:
And now, please, what to do now, to have a few python lines somewhere in the egg dir, which the zope would know how to deal with?
The "egg dir" as you call it is a Python module, and you put Python code there. Zope knows how to deal with it, that is not the problem. What you need to do is get the Python code to deal with Zope. :)
And on what url will be the "hello world" available then?
That is completely up to you. :) The question now, is this Zope 3 or Zope 2? For Zope 3, you should probably get a book. http://worldcookery.com/ There was another book to in the beginning of Zope 3, but I don't know it has been updated. You could also, for Zope 3, opt to use Grok, which is a framework built on Zope 3 that makes Zope 3 easier: http://grok.zope.org/ For Zope 2, you can start here: http://docs.zope.org/zope2/zdgbook/source/ Then, you should probably buy the above book too. Zope 3 technologies are getting very common in Zope 2. -- Lennart Regebro: Pythonista, Barista, Notsotrista. http://regebro.wordpress.com/ +33 661 58 14 64
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Thanks for a tips, I have looked on the Guide you suggested. I think I understand the concepts, but still missing something. To make the simplest case, 1. I started with fresh instance prepared by the paster, 2. created this source: # src/my.py class Contact(object): "blah blah" firstName = "aaaa" c = Contact() 3. to the sys.path in bin/instance added the "/path/to/src" (which contains my.py), 4. started instance and checked, that the /path/to/src is on loaded sys.path, 5. pointed browser to localhost:8091/c/firstName . Resource c not found, Zope says. Yes, it can't be SO simple, but please, what should I do? Thanks for your patience.. David Lennart Regebro napsal(a):
On Sat, Mar 7, 2009 at 23:21, David Zejda <dvid@atlas.cz> wrote:
And now, please, what to do now, to have a few python lines somewhere in the egg dir, which the zope would know how to deal with?
The "egg dir" as you call it is a Python module, and you put Python code there. Zope knows how to deal with it, that is not the problem. What you need to do is get the Python code to deal with Zope. :)
And on what url will be the "hello world" available then?
That is completely up to you. :)
The question now, is this Zope 3 or Zope 2?
For Zope 3, you should probably get a book. http://worldcookery.com/ There was another book to in the beginning of Zope 3, but I don't know it has been updated. You could also, for Zope 3, opt to use Grok, which is a framework built on Zope 3 that makes Zope 3 easier: http://grok.zope.org/
For Zope 2, you can start here: http://docs.zope.org/zope2/zdgbook/source/ Then, you should probably buy the above book too. Zope 3 technologies are getting very common in Zope 2.
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkm25GQACgkQ3oCkkciamVFQ0QCeOHfaWDV4dSvM+TaZKyIyNpKC JpEAn0R65e8asVaogcfaCeQF5qDoj1vb =FtXB -----END PGP SIGNATURE-----
If you want simple: 1. download this product and put it into your products directory. http://www.zope.org/Members/gtk/Boring 2. Start Zope and go to 127.0.0.1:8080/manage and add the Boring product. Click test, there is your url. 3. Modify the 'Boring' code and repeat. -Tim On Tue, Mar 10, 2009 at 3:06 PM, David Zejda <dvid@atlas.cz> wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Thanks for a tips,
I have looked on the Guide you suggested. I think I understand the concepts, but still missing something. To make the simplest case,
1. I started with fresh instance prepared by the paster, 2. created this source:
# src/my.py class Contact(object): "blah blah"
firstName = "aaaa"
c = Contact()
3. to the sys.path in bin/instance added the "/path/to/src" (which contains my.py), 4. started instance and checked, that the /path/to/src is on loaded sys.path, 5. pointed browser to localhost:8091/c/firstName .
Resource c not found, Zope says. Yes, it can't be SO simple, but please, what should I do?
Thanks for your patience..
David
Lennart Regebro napsal(a):
On Sat, Mar 7, 2009 at 23:21, David Zejda <dvid@atlas.cz> wrote:
And now, please, what to do now, to have a few python lines somewhere in the egg dir, which the zope would know how to deal with?
The "egg dir" as you call it is a Python module, and you put Python code there. Zope knows how to deal with it, that is not the problem. What you need to do is get the Python code to deal with Zope. :)
And on what url will be the "hello world" available then?
That is completely up to you. :)
The question now, is this Zope 3 or Zope 2?
For Zope 3, you should probably get a book. http://worldcookery.com/ There was another book to in the beginning of Zope 3, but I don't know it has been updated. You could also, for Zope 3, opt to use Grok, which is a framework built on Zope 3 that makes Zope 3 easier: http://grok.zope.org/
For Zope 2, you can start here: http://docs.zope.org/zope2/zdgbook/source/ Then, you should probably buy the above book too. Zope 3 technologies are getting very common in Zope 2.
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkm25GQACgkQ3oCkkciamVFQ0QCeOHfaWDV4dSvM+TaZKyIyNpKC JpEAn0R65e8asVaogcfaCeQF5qDoj1vb =FtXB -----END PGP SIGNATURE----- _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Tim, thanks, I'm playing with a simple product called JWFind, derived from Boring now. The product sits in the products directory, can be added and removed using ZMI, it is all OK. Because I'm willing to use it in Plone, the Zope version is 2.10.6-final. Now, I'm trying to handle the view of product using form made of z3c.form. There is a problem. Currently, I'm getting Traceback (innermost last): Module ZPublisher.Publish, line 119, in publish Module ZPublisher.mapply, line 88, in mapply Module ZPublisher.Publish, line 42, in call_object Module Products.JWFind.JWFind, line 55, in index_html Module z3c.form.form, line 189, in __call__ Module z3c.form.form, line 184, in update Module z3c.form.form, line 134, in update Module z3c.form.form, line 120, in updateWidgets Module zope.component._api, line 103, in getMultiAdapter Module zope.component._api, line 103, in getMultiAdapter ComponentLookupError: ((<Products.JWFind.Person.Person object at 0xb5003b2c>, <HTTPRequest, URL=http://localhost:8091/pokus/index_html>, <JWFind at /pokus>), <InterfaceClass z3c.form.interfaces.IWidgets>, u'') I guess, the error tells, that something implementing ``IWidgets`` cannot be found. But, I have no idea, how to deal with it. Maybe, should I prepare the specific layer and skin to be able to use z3cforms and If so, how to do it and especially how to register it properly? Or is there a problem with the form definition itself? Or should I register something to zope in addition to registration made in __init__? The relevant part of product source JWFind.py: def index_html(self, REQUEST=None): """JWFind Form""" out = Person(self, REQUEST)() return out.PersonView The form is in separate file Person.py: from zope import interface, schema from z3c.form import form, field, button from plone.app.z3cform.layout import wrap_form class IPerson(interface.Interface): age = schema.Int( title=u"Age", required=True) class Person(form.Form): fields = field.Fields(IPerson) ignoreContext = True # don't use context to get widget data label = u"Please enter your age" @button.buttonAndHandler(u'Apply') def handleApply(self, action): data, errors = self.extractData() print data['age'] # ... or do stuff PersonView = wrap_form(Person) The whole source is attached. Please, any ideas? Thanks a lot.. David Tim Nash napsal(a):
If you want simple: 1. download this product and put it into your products directory. http://www.zope.org/Members/gtk/Boring 2. Start Zope and go to 127.0.0.1:8080/manage and add the Boring product. Click test, there is your url. 3. Modify the 'Boring' code and repeat.
-Tim
On Tue, Mar 10, 2009 at 3:06 PM, David Zejda <dvid@atlas.cz> wrote:
Thanks for a tips,
I have looked on the Guide you suggested. I think I understand the concepts, but still missing something. To make the simplest case,
1. I started with fresh instance prepared by the paster, 2. created this source:
# src/my.py class Contact(object): "blah blah"
firstName = "aaaa"
c = Contact()
3. to the sys.path in bin/instance added the "/path/to/src" (which contains my.py), 4. started instance and checked, that the /path/to/src is on loaded sys.path, 5. pointed browser to localhost:8091/c/firstName .
Resource c not found, Zope says. Yes, it can't be SO simple, but please, what should I do?
Thanks for your patience..
David
Lennart Regebro napsal(a):
On Sat, Mar 7, 2009 at 23:21, David Zejda <dvid@atlas.cz> wrote:
And now, please, what to do now, to have a few python lines somewhere in the egg dir, which the zope would know how to deal with? The "egg dir" as you call it is a Python module, and you put Python code there. Zope knows how to deal with it, that is not the problem. What you need to do is get the Python code to deal with Zope. :)
And on what url will be the "hello world" available then? That is completely up to you. :)
The question now, is this Zope 3 or Zope 2?
For Zope 3, you should probably get a book. http://worldcookery.com/ There was another book to in the beginning of Zope 3, but I don't know it has been updated. You could also, for Zope 3, opt to use Grok, which is a framework built on Zope 3 that makes Zope 3 easier: http://grok.zope.org/
For Zope 2, you can start here: http://docs.zope.org/zope2/zdgbook/source/ Then, you should probably buy the above book too. Zope 3 technologies are getting very common in Zope 2.
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAknCK1IACgkQ3oCkkciamVGtDACfTe7/Nj9NBsTRPAOBkOowN6lJ 31YAnAlz37ZuBgcNylLDbIyaTQDEw9yn =uJ4o -----END PGP SIGNATURE-----
participants (4)
-
Andreas Jung -
David Zejda -
Lennart Regebro -
Tim Nash