Plone Conference 2008: ZopeSkel Sprint Reportout

NOTE: Sorry for the delay here, I’ve had a little trouble getting all of the changes merged, and I wanted to hold off on reporting until after the code was in trunk.

The Sprint Subject

ZopeSkel is a collection of Paste Script templates for the Python Paste suite of tools, that are invoked by the "paster create" command. ZopeSkel’s templates are designed to assist with Plone and Zope development. There are templates for creating plone, zope and silva buildouts, plone products, archetypes-based content and more. ZopeSkel also implements a special sub-command for it’s plone-related templates, called "paster addcontent".

ZopeSkel is distributed via the Python Package Index, so the current stable version can be installed via easy_install. Development occurs in the Plone Collective, so you can get the bleeding edge version via Anonymous Subversion or, if you have commit access to the collective, via Subversion over SSL.

My general opnion of ZopeSkel: it’s freaking sweet. For Plone development in particular, it’s been a tremendous time saver. Plone development means a lot of boilerplate code. ZopeSkel helps you do this effectively (and more!).

ZopeSkel makes you code. That’s a good thing for software developers :) ZopeSkel guides you. ZopeSkel takes you everywhere you want to be.

Got questions? Suggestions? We’ve established #zopeskel on freenode.net! Come on by and say "hey!"

Getting Started

I’ve got a ZopeSkel Archetypes Quick Start Guide availble to get you up and running, and creating archetypes-based content types. Even if you aren’t using ZopeSkel for building AT-content types, the first steps will get you set up to use ZopeSkel and buildout. It’s split into two sections, one for Windows, and the other for Unix/Linux.

The Sprinters

The sprint had a huge turnout. We had something like 10 people, including a remote
sprinter from South America. I want to mention everyone that contributed. I’m going to try to
associate real people with IRC/SVN nicknames.

I’m SURE there are people missing from this list. PLEASE, if you or someone you know was there
but isn’t listed, PLEASE PLEASE drop me an e-mail or leave a comment.

I’m taking a best guess at the information here. If you’d prefer a different name, email (or no email), url, organization, etc listed, please speak up

Sprinters (in no particular order):

  • Josh Johnson [jjmojojjmojo] (me :), from UNC)

  • Clayton Parker [claytron] (clayton at sixfeetup dot com, of Six Feet Up)

  • Mark van Lent [markl] (mark at zestsoftware dot nl)

  • Jason R. Coombs [jraco/jraco-mobile] (jaraco at jaraco dot com)

  • Emanuel Sartor [esartor/emanuel] (emanuel at menttes dot com)

  • Alan Hoey [evilbungle] (alan dot hoey at teamrubber dot com)

  • Edmund Moseley [edo102] (UNC M.E. Office)

  • Mark Biggers [mbiggers] (UNC CCBC)

  • Stephan Altmueller [mond21] (UNC, OASIS)

  • Jan Murre [Pareto]

  • Mara Dragan [???]

Super-Awesome people who we consulted during the sprint:

Special Thanks:

  • TriZPUG, specifically Chris Calloway for urging me to
    volunteer to organize this sprint.

The Back Log, What Got Done, How To Demo

Prior to the sprint, I had been using ZopeSkel for the bigger part of a year, and during that time I’ve noticed areas that I thought needed improvement. There have also been discussions on mailing lists and in IRC about what could be done to ZopeSkel to make it an even more useful tool.

In preparation for the sprint, I collected the ideas that I had gleaned from the mailing lists into a list of user stories. I posted the stories onto the OpenPlans wiki page for the sprint, and solicited feedback from the community. I got more stories, and some other great feedback.

At the start of the sprint, a few more stories came up as well.

Over all, it was a very effective way to organize the outstanding issues that ZopeSkel had and the features that we wanted to make it rock even harder.

Atschema needs validators
The User Story

The atschema local command for the archetype template doesn’t handle validators.

When you create a new schema field, there’s no question about validators. Also,
when you pick something like “integer” for your field type, for reasons beyond
my comprehension, the integerField class doesn’t validate user input. You’d
think, with it being an integer field, that it would prevent you from putting in
a string. It doesn’t, in fact, it breaks with an error. Nice.

The Fix

edo102 and markb1 added the required functionality to the atschema templates, and added a new question to the atschema output. Now you can specify your own validator, one of the stock validators that come with Plone, or an intelligent default based on what type of field you’re creating.

Try It Out

$ cd ~/
$ paster create -t archetype my.product
Enter title (The title of the project) ['Plone Example']: 
Enter namespace_package (Namespace package (like plone)) ['plone']: my
Enter package (The package contained namespace package (like example)) ['example']: product
Enter zope2product (Are you creating a Zope 2 Product?) [True]: 
Enter version (Version) ['1.0']: 
Enter description (One-line description of the package) ['']: 
Enter long_description (Multi-line description (in reST)) ['']: 
Enter author (Author name) ['Plone Foundation']: Josh Johnson
Enter author_email (Author email) ['plone-developers@lists.sourceforge.net']:                
Enter keywords (Space-separated keywords/tags) ['']: 
Enter url (URL of homepage) ['http://svn.plone.org/svn/plone/plone.example']: 
Enter license_name (License name) ['GPL']: 
Enter zip_safe (True/False: if the package can be distributed as a .zip file) [False]: 
...
$ cd my.product
$ paster addcontent contenttype
Enter contenttype_name (Content type name ) ['Example Type']: 
Enter contenttype_description (Content type description ) ['Description of the Example Type']: 
Enter folderish (True/False: Content type is Folderish ) [False]: 
Enter global_allow (True/False: Globally addable ) [True]: 
Enter allow_discussion (True/False: Allow discussion ) [False]: 
...
$ paster addcontent atschema
Welcome to the ATSchema Builder. Field names/widgets can be specified in lowercase or upper case.
NOTE: No need to add 'widget' or 'field' to the names. atschema does the work for you!
See 
    http://plone.org/documentation/manual/archetypes-developer-manual/fields/fields-reference/
and 
    http://plone.org/documentation/manual/archetypes-developer-manual/fields/widgets-reference
for field and widget details
Enter content_class_filename (What is the module (file)name of your content class?) ['exampletype']: 
Enter field_name (What would you like to name this field?) ['newfield']: myfloat
Enter field_type (What kind of field should I make for you?
Some examples: [boolean,computed,cmfobject,datetime,file,fixedpoint,float,image,integer,lines,reference,string,text]) ['string']: float
Enter widget_type (What kind of widget do you want to use?) ['default']: 
Enter field_label (What should be the label of this field (title)?) ['New Field']: Test Float
Enter field_desc (What should be the description of this field (help text)?) ['Field description']: 
Enter required (Is this field required?) ['False']: 
Enter default (If you'd like a default type it here, otherwise leave it blank) ['']:
Enter validator (Enter a validator (isEmail), or None, or get a default validator for your specified field type.) ['use default validator']: 

Notice the question I’ve highlighted. This is where you can specify your validator. The result of this is evident in the content type code:

# my.product/my/product/content/exampletype.py
...
ExampleTypeSchema = schemata.ATContentTypeSchema.copy() + atapi.Schema((

    # -*- Your Archetypes field definitions here ... -*-

    atapi.FloatField(
        'myfloat',
        storage=atapi.AnnotationStorage(),
        widget=atapi.DecimalWidget(
            label=_(u"Test Float"),
            description=_(u"Field description"),
        ),
        validators=('isDecimal'),
    ),


))
...
Generated Python Code Needs to Be Cleaned Up

The User Story

The python code generated by zopeskel templates needs to be consistent and
preferably follow PEP8

See: http://www.fantascienza.net/leonardo/ar/python_best_practices.html

and: http://www.python.org/dev/peps/pep-0008/

The Fix

claytron originally suggested this user story, and saw it through to completion during the sprint. It’s hard to say exactly what was done, since the changes were very widespread. We can let the diffs speak for themselves :).

ZCML Needs to be Cleaned Up

The User Story

ZCML generated by zopeskel needs to be consistent and follow the ZCML style
guide

See: http://wiki.zope.org/zope3/ZCMLStyleGuide

The Fix

This one was also claytron’s baby (I split them up in case somebody wanted to takle the zcml separately from the rest of the code). See the change set for details.

Documentation: We need better user feedback during interactive sessions

The User Story

Paster works by asking the user a bunch of questions. Those questions aren’t
always very helpful if you’ve never done plone or zope stuff before. I’d like to
see them cleaned up.

The Fix

We addressed this very vague user story in various ways during the sprint, but over all, it was a low priority.

Documentation: ZopeSkel needs better plone.org docs!

The User Story

ZopeSkel is woefully represented on the plone.org site. This shouldn’t be, since
it’s such a hugely useful tool.

The Fix

This was tabled since so much code was changing. I’m considering this report-out to be the first step in that direction. :)

zope.formlib support
The User Story

We need to be able to create zope.formlib browser views

The Fix

marad, saltmueller, jjmurre worked quite diligently on making this happen. They pulled it off, and it works quite well.

This feature is implemented in two parts. First, you add a form, then you add each form
field separately.

You can set up invariants and set constraints (multi-field validators and validators for single fields).

Try It Out

Here, we’ll create a form to search for addresses. It won’t work, but it will
require you to enter a first and last name in order to search.

$ cd ~/
$ paster create -t plone3_buildout formlib
Selected and implied templates:
  ZopeSkel#plone3_buildout  A buildout for Plone 3 projects

Variables:
  egg:      formlib
  package:  formlib
  project:  formlib
Enter zope2_install (Path to Zope 2 installation; leave blank to fetch one) ['']: 
Enter plone_products_install (Path to directory containing Plone products; leave blank to fetch one) ['']: 
Enter zope_user (Zope root admin user) ['admin']: 
Enter zope_password (Zope root admin password) ['']: admin
Enter http_port (HTTP port) [8080]: 
Enter debug_mode (Should debug mode be "on" or "off"?) ['off']: on
Enter verbose_security (Should verbose security be "on" or "off"?) ['off']: on
...
$ cd formlib/src
$ paster create -t archetype formlib.test
Selected and implied templates:
  ZopeSkel#basic_namespace  A project with a namespace package
  ZopeSkel#plone            A Plone project
  ZopeSkel#archetype        A Plone project that uses Archetypes

Variables:
  egg:      test.product
  package:  testproduct
  project:  test.product
Enter title (The title of the project) ['Plone Example']: 
Enter namespace_package (Namespace package (like plone)) ['plone']: formlib
Enter package (The package contained namespace package (like example)) ['example']: test
Enter zope2product (Are you creating a Zope 2 Product?) [True]: 
Enter version (Version) ['1.0']: 
Enter description (One-line description of the package) ['']: 
Enter long_description (Multi-line description (in reST)) ['']: 
Enter author (Author name) ['Plone Foundation']: 
Enter author_email (Author email) ['plone-developers@lists.sourceforge.net']: 
Enter keywords (Space-separated keywords/tags) ['']: 
Enter url (URL of homepage) ['http://svn.plone.org/svn/plone/plone.example']: 
Enter license_name (License name) ['GPL']: 
Enter zip_safe (True/False: if the package can be distributed as a .zip file) [False]: 
...
$ cd formlib.test
$ paster addcontent form
Enter form_name (Form class name) ['ExampleForm']: AddressLookupForm
Enter form_label (Form Title) ['Example Form']: Address Lookup   
Enter form_description (Form Description) ['']: Use this field to look up an address by name
Enter form_actions (Comma separated list of form actions) ['Submit']: Search
Enter form_invariants (Comma separated list of invariants) ['']: FirstAndLastName
...
$ paster addcontent formfield
Enter form_filename (Name of the file containing the form in browser.) ['exampleform']: addresslookupform
Enter field_name (Name of the field (this should be a unique identifier).) ['examplefield']: firstname
Enter field_type (Type of field. Use one of the following 

                         bool : Field containin a truth value.
                         text : Field containing unicode text.
                         textline : Field containing a single line of unicode text.
                         datetime : Field containing a DateTime.
                         date : Field containing a date.
                         choice : Obect from a source or vocabulary.
                         password : Field containing a unicode string without newlines that is a password.
) ['textline']: 
Enter field_title ['A short summary or label']: The last name of the addressee
Enter field_description (A description of the field (to be displayed as a hint)) ['']: 
Enter field_required (Tells whether a field requires its value to exist (True/False)) [False]: 
Enter field_readonly (If true, the field's value cannot be changed (True/False)) [False]: 
Enter field_default (The field default value may be None or a legal field value) ['None']: 
Enter field_missing_value (If a field has no assigned value, set it to this value) ['']: 
Enter field_constraint (Specify the name of a function to use for validation) ['']: 
...
$ paster addcontent formfield
Enter form_filename (Name of the file containing the form in browser.) ['exampleform']: addresslookupform
Enter field_name (Name of the field (this should be a unique identifier).) ['examplefield']: lastname
Enter field_type (Type of field. Use one of the following 

                         bool : Field containin a truth value.
                         text : Field containing unicode text.
                         textline : Field containing a single line of unicode text.
                         datetime : Field containing a DateTime.
                         date : Field containing a date.
                         choice : Obect from a source or vocabulary.
                         password : Field containing a unicode string without newlines that is a password.
) ['textline']: 
Enter field_title ['A short summary or label']: The last name of the addressee
Enter field_description (A description of the field (to be displayed as a hint)) ['']: 
Enter field_required (Tells whether a field requires its value to exist (True/False)) [False]: 
Enter field_readonly (If true, the field's value cannot be changed (True/False)) [False]: 
Enter field_default (The field default value may be None or a legal field value) ['None']: 
Enter field_missing_value (If a field has no assigned value, set it to this value) ['']: 
Enter field_constraint (Specify the name of a function to use for validation) ['']: 
...

That will create all of the seleton code we need. Now we need to wire up our
product to the buildout

$ cd ..
$ vi buildout.cfg
[buildout]
...
eggs = 
    elementtree
    formlib.test
...
develop =
    src/formlib.test
...
[instance]
...
zcml =
    formlib.test
...

Now we just need to add the code for the invariant. This also gives us a chance
to look at the code that zopeskel has created for us

$ cd src/formlib.test/formlib/test/browser
$ vi addresslookupform.py
from zope import interface, schema
from zope.formlib import form
from Products.Five.formlib import formbase
from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary

from formlib.test import testMessageFactory as _

class IAddressLookupFormSchema(interface.Interface):
    # -*- extra stuff goes here -*-

    lastname = schema.TextLine(
        title=u'The persons last name',
        description=u'',
        required=False,
        readonly=False,
        default=None,
        )

    firstname = schema.TextLine(
        title=u'The last name of the addressee',
        description=u'',
        required=False,
        readonly=False,
        default=None,
        )

    @interface.invariant
    def invariant_FirstAndLastName(input):
        # If they don't specify both fields, raise an error!
        if not input.firstname or not input.lastname:
            raise interface.Invalid(_(u"Some error occurred !"))

class AddressLookupForm(formbase.PageForm):
    form_fields = form.FormFields(IAddressLookupFormSchema)
    label = _(u'Address Lookup')
    description = _(u'Use this field to look up an address by name')

    @form.action('Search')
    def actionSearch(self, action, data):
        return "HEY IT RAN!" 

Now we can bootstrap, buildout, and run plone

$ cd ~/formlib
$ python2.4 bootstrap.py
...
$ bin/buildout
...
$ bin/instance fg

And now test it in a browser. Open http://localhost:8080/manage,
log in with username/password admin/admin, and add a plone site (set it’s id to ‘plone’).

You can now open http://localhost:8080/plone/@@addresslookupform
and give it a try.

CMFFormContoller Support
The User Story

We need to be able to create the .cpy, .cpt, and .metadata files you need when
building a CMFFormController form.

Status

I still think this is a good idea, but no work was done on it during the sprint.

Namespace Specification for Eggs
The User Story

If you create an egg, you have to make sure that the foldername and the
namespace + package names match up. e.g. “paster create -t plone my.package”
means you *have* to say namespace = “my” and package = “package”.

From Martin Aspeli’s post, http://plone.org/support/forums/core#nabble-td348745

I’d like to suggest that since the folder name and the package/namespace have to
be the same, that we take one argument and parse that to get the namespace
pieces. Need to check if this makes sense from a pure egg standpoint.

The Fix

This was explored and was ultimately tabled. It’s a fundamental aspect of paster create. From what I can tell, we’d have to alter the paster create command itself to make this happen like we want it to.

Alternate Inputs for True/False
The User Story

Typing “True” and “False” sucks. We need to ensure we can accept t, f, T, F, y,
n, Y N etc.

From Martin Aspeli’s post: http://plone.org/support/forums/core#nabble-td348745

The Fix

I can’t recall who did this, I merged the changes in, but I know I didn’t actually write the code. See the changeset for details of the implementation, but basically it gives the exact functionality Martin was asking for in his post. SWEET

If you know who did this, please let me know and I’ll give them credit.

Archetype Product Tests
The User Story

You always get a tests.py, and sometimes you get a tests/ package as well. One
will beat the other. tests.py is also a bit limited for most purposes. (this
refers to the paster create “archetype” template)

See: http://plone.org/support/forums/core#nabble-td348745

The Fix

emanuel worked on this, and we now get a great base test setup that works out of the box.

Try It Out
$ cd ~/
$ paster create -t archetype my.product
Selected and implied templates:
  ZopeSkel#basic_namespace  A project with a namespace package
  ZopeSkel#plone            A Plone project
  ZopeSkel#archetype        A Plone project that uses Archetypes

Variables:
  egg:      my.product
  package:  myproduct
  project:  my.product
Enter title (The title of the project) ['Plone Example']: 
Enter namespace_package (Namespace package (like plone)) ['plone']: my
Enter package (The package contained namespace package (like example)) ['example']: product
Enter zope2product (Are you creating a Zope 2 Product?) [True]: 
Enter version (Version) ['1.0']: 
Enter description (One-line description of the package) ['']: 
Enter long_description (Multi-line description (in reST)) ['']: 
Enter author (Author name) ['Plone Foundation']: 
Enter author_email (Author email) ['plone-developers@lists.sourceforge.net']: 
Enter keywords (Space-separated keywords/tags) ['']: 
Enter url (URL of homepage) ['http://svn.plone.org/svn/plone/plone.example']: 
Enter license_name (License name) ['GPL']: 
Enter zip_safe (True/False: if the package can be distributed as a .zip file) [False]: 
...
$ cd my.product/my/product/tests
$ ls 
base.py  __init__.py  test_doctest.py
$ cd ../
$ cat README.txt
Introduction
============

This is a full-blown functional test. The emphasis here is on testing what
the user may input and see, and the system is largely tested as a black box.
We use PloneTestCase to set up this test as well, so we have a full Plone site
to play with. We *can* inspect the state of the portal, e.g. using 
self.portal and self.folder, but it is often frowned upon since you are not
treating the system as a black box. Also, if you, for example, log in or set
...

Here I’ve highlighted the files that emanuel’s changes create. There’s a base.py file which does all of the product installation stuff and sets up the test environment. test_doctest.py is the wiring code that runs README.txt as a doctest. It’s also a good example of how to do doctests in a plone test suite.

If you wanted to see the tests run (even though they don’t do much), you could wire the egg into a buildout (see My Howto for details), and run them like this:

$ cd ~/buildouts/mybuidout
$ ./bin/instance test -s my.product
Archetype Content Type Tests
The User Story

The paster addcontent template for content types doesn’t add any tests. I think
some very basic boilerplate tests (even if they fail because the content isn’t
globally addable) illustrating how to test a content type would be great

The Fix

Using what was acomplished in the previous story as a base, emanuel added tests to the addcontent contenttype template. These ammend the README.txt file for each content type.

Try It Out
$ cd ~/
$ paster create -t archetype my.product
Selected and implied templates:
  ZopeSkel#basic_namespace  A project with a namespace package
  ZopeSkel#plone            A Plone project
  ZopeSkel#archetype        A Plone project that uses Archetypes

Variables:
  egg:      test.product
  package:  testproduct
  project:  test.product
Enter title (The title of the project) ['Plone Example']: 
Enter namespace_package (Namespace package (like plone)) ['plone']: test
Enter package (The package contained namespace package (like example)) ['example']: product
Enter zope2product (Are you creating a Zope 2 Product?) [True]: 
Enter version (Version) ['1.0']: 
Enter description (One-line description of the package) ['']: 
Enter long_description (Multi-line description (in reST)) ['']: 
Enter author (Author name) ['Plone Foundation']: 
Enter author_email (Author email) ['plone-developers@lists.sourceforge.net']: 
Enter keywords (Space-separated keywords/tags) ['']: 
Enter url (URL of homepage) ['http://svn.plone.org/svn/plone/plone.example']: 
Enter license_name (License name) ['GPL']: 
Enter zip_safe (True/False: if the package can be distributed as a .zip file) [False]: 
...
$ cd my.product
$ paster addcontent contenttype
Enter contenttype_name (Content type name ) ['Example Type']: 
Enter contenttype_description (Content type description ) ['Description of the Example Type']: 
Enter folderish (True/False: Content type is Folderish ) [False]: 
Enter global_allow (True/False: Globally addable ) [True]: 
Enter allow_discussion (True/False: Allow discussion ) [False]: 
$ cd my/product/

Now if you look at the README.txt in ~/my.product/my/product (not the one in ~/my.product), you’ll notice there is testing code for your new contenttype.

How Do You Test ZopeSkel?
The User Story

There needs to be some R&D done to see how we can go about testing ZopeSkel and
the code it generates. Specifically, I’d like to see a test for the buildout and
archetype templates that verifies that the code generated works. Also, I’d like
to see tests for the different possible combinations of input for the atschema
local command. I think part of this means switching the option parser so that it
can take command line arguments to automatically answer questions.

jjmojojjmojo: I looked into using the –config command line option, and I realized
that it’s not available in the base local command :(

The Fix

I did a lot of research on this and couldn’t find a viable option. I think that ultimately the addcontent local command will need to be re-written.

plone Template Needs Localcommands
The User Story

The plain plone paster create template doesn’t put in hooks so you can later use
addcontent.

The Fix

markvl handled this, so now if you start with a plain plone product, you can use addcontent later on.

Try It Out
$ cd ~/
$ paster create -t plone my.otherproduct
Selected and implied templates:
  ZopeSkel#basic_namespace  A project with a namespace package
  ZopeSkel#plone            A Plone project

Variables:
  egg:      my.otherproduct
  package:  myotherproduct
  project:  my.otherproduct
Enter namespace_package (Namespace package (like plone)) ['plone']: my
Enter package (The package contained namespace package (like example)) ['example']: otherproduct
Enter zope2product (Are you creating a Zope 2 Product?) [False]: True
Enter version (Version) ['1.0']: 
Enter description (One-line description of the package) ['']: 
Enter long_description (Multi-line description (in reST)) ['']: 
Enter author (Author name) ['Plone Foundation']: 
Enter author_email (Author email) ['plone-developers@lists.sourceforge.net']: 
Enter keywords (Space-separated keywords/tags) ['']: 
Enter url (URL of homepage) ['http://svn.plone.org/svn/plone/plone.example']: 
Enter license_name (License name) ['GPL']: 
Enter zip_safe (True/False: if the package can be distributed as a .zip file) [False]: 
...

At this point, you’ve got the most bare-bones plone product egg possible. It’s great if you are just adding some zope3 views or something of that nature.

Note that since this is for Plone, you have to specify “True” for the zope2product question.

Now you can use the addcontent command to add contenttypes, browser views, etc.

$ cd my.otherproduct
$ paster addcontent contenttype
Enter contenttype_name (Content type name ) ['Example Type']: 
Enter contenttype_description (Content type description ) ['Description of the Example Type']: 
Enter folderish (True/False: Content type is Folderish ) [False]: 
Enter global_allow (True/False: Globally addable ) [True]: 
Enter allow_discussion (True/False: Allow discussion ) [False]: 
...
Buildout Options
The User Story

plone3_buildout – discuss feasibility of local commands for adding instances and
products (Suggestion from MatthewWilkes but can’t commit time :()

Matthew suggested that we talk about what can be done to make mundane/unclear
tasks related to changing buildout.cfg. Specifically, adding non-egg products
and multiple instances. He mentioned that evilbungle wrote some ZopeSkel code
(not committed yet) to add instances to buildout.cfg.

Status

I’m not sure what’s up with this story. I need to look into it further.

Display Available Local Commands When Available
The User Story

From Joel Burton – it’d be great if the user could be alerted when a template that
just completed running could give the user a note about the local commands that
are made available by the template.

The Fix

jaraco and markvl implemented this and I swiftly bowled over their changes in trunk :). It’s there now, and it works quite well.

Try It Out

$ paster create -t archetype test.product
Selected and implied templates:
  ZopeSkel#basic_namespace  A project with a namespace package
  ZopeSkel#plone            A Plone project
  ZopeSkel#archetype        A Plone project that uses Archetypes

Variables:
  egg:      test.product
  package:  testproduct
  project:  test.product
Enter title (The title of the project) ['Plone Example']: 
Enter namespace_package (Namespace package (like plone)) ['plone']: 
Enter package (The package contained namespace package (like example)) ['example']: 
Enter zope2product (Are you creating a Zope 2 Product?) [True]: 
Enter version (Version) ['1.0']: 
Enter description (One-line description of the package) ['']: 
Enter long_description (Multi-line description (in reST)) ['']: 
Enter author (Author name) ['Plone Foundation']: 
Enter author_email (Author email) ['plone-developers@lists.sourceforge.net']: 
Enter keywords (Space-separated keywords/tags) ['']: 
Enter url (URL of homepage) ['http://svn.plone.org/svn/plone/plone.example']: 
Enter license_name (License name) ['GPL']: 
Enter zip_safe (True/False: if the package can be distributed as a .zip file) [False]: 
...
------------------------------------------------------------------------------
The project you just created has local commands. These can be used from within
the product.

usage: paster COMMAND

Commands:
  addcontent  Adds plone content types to your project

For more information: paster help COMMAND
------------------------------------------------------------------------------

Get Rid of -t
The User Story

From Joel Burton – the -t necessary when calling paster create is confusing.

This is a paste script thing, but might be worth looking into to simplify
ZopeSkel.

The Status

From what I can tell, this is an integral paste script thing. When you don’t
specify a template, it assumes you want just a simple python egg.

Windows issues with Python in a path containing spaces
The User Story

Issue 9 from the ZopeSkel issue tracker: http://plone.org/products/zopeskel/issues/9

A workaround has been uploaded as attachment 3 below (copies bootstrap.py from
zc.buildout trunk). A more robust solution is still being investigated.

Plus, zc.buildout also has problems in the same environment (patch for this issue
as attachment 1 below; applies to zc.buildout trunk).

Suggested commit message:
Removed _safe_arg and updated spawn* calls to subprocess.Popen.
Refactored much of the jython support code to its own module.

Jason R. Coombs (jaraco/jaraco_mobile) is working on patches.

Discussion

This is an interesting problem. One of the benefits of having a template-based
code generation tool is that all of the potential code is right there in with the
tool in the templates. This becomes a disadvantage, however, when the source of
the template code is external to the tool itself.

This is the case here. The file (bootstrap.py) in the plone3_buildout template that’s causing
problems in windows is just copied verbatim from the standard plone buildout.

The Fix

jaraco came up with a patch that would actually grab the lastest bootstrap.py
(see http://www.openplans.org/projects/plone-conference-2008-dc/zopeskel/20081011-zc-buildout-windows-path-handling-patch)
from SVN. This was a great idea but I was concerned with imparting non-standard
code into a standard script (in this case easy_install.py), and the patch was
for zc.buildout which I felt was out of band since this was a ZopeSkel problem.

To solve the issue, we just updated the bootstrap.py file with the most recent
changes.

JJ’s atschema Changes Break Tests
The User Story

Currently the tests (executed by running python setup.py test in the main zopeskel egg)
fail due to problems with atschema.

jjmojojjmojo: This is due to at least two problems with atschema:

  • I moved some stuff around in the archetypes template.

  • I have a bunch of print statements in __init__() inside the template

I’m working on this but will probably table it. It’s really hard to find a
good place to put the notice that atschema prints to the user, and I’ll fix the
tests that look for file layouts all at once.

The Fix

I resolved the issues and the tests run fine now :)

The addcontent command doesn’t support the –config parameter
The User Story

paster create offers a –config command. It allows you to save the answers to the questions
as a config file. paster addcontent doesn’t support this, and it should.

The Fix

This was tabled. After talking with Ian Bicking I came to the conclusion that
this was a problem with the way addcontent was implemented. Will leave for another day :).

Advertisements
This entry was posted in plone, python. Bookmark the permalink.

2 Responses to Plone Conference 2008: ZopeSkel Sprint Reportout

  1. Alex Clark says:

    This is great stuff! Thanks for the update, and all the hard work on ZopeSkel.

  2. Jan Murre says:

    In the list of sprinters, the [???] can be replaced with Pareto. :-)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s