zopeskel & buildout packages

Download ZopeSkel & Buildout packages

If you can't read please download the document

Post on 19-May-2015




2 download

Embed Size (px)


  • 1. ZopeSkel & Buildout Andriy Mylenkyy Quintagroup, 2008

2. ZopeSkel author: Daniel Nouri 3. Plan for ZopeSkel

  • Problem & Purposes
  • Command line options
  • Templates overview
  • Local command
  • Template development

4. Problem & Purposes

  • Problem:
  • Performing many routine work
  • Eat time
  • Lead to some mistakes -> debugging, fixing.
  • Useful for:Administrators, Developers, Designers


  • paster create -t [template] PACK_NAME [var_1=val_1 var_2=val_2 ...]
  • Management options:
  • -t TEMPLATE, --template=TEMPLATE
  • --svn-repository=REPOS
  • --config=CONFIG
  • -o DIR,--output-dir=DIR
  • --no-interactive
  • -f, --overwrite

Command line options 6. Informative & other options

  • --list-templates
  • --list-variables
  • --inspect-filesShows where the files in the given (already created) directory came from
  • -n, --simulate
  • -q, --quiet
  • -h, --help
  • -v, --verbose

7. Example plone creating 8. Config file example

  • [pasterscript]
  • namespace_package = plone
  • package =HAS NO SENCE
  • description = Description of my test example
  • long_description =Not found how enter
  • description for several lines .. ?
  • ...

9. --svn-repository test 10. Basic templates

  • basic_package :A basic setuptools-enabled package. Actually fill entered data in setup.py file.
  • basic_namespace :A project with a namespace package. Created in ZopeSkel, put package in a namespace, add more information in README.txt, HISTORY.txt files. Uses asrequired_templatein many other templates (plone, basic_zope,plone25> themes).
  • nested_namespace :A project with two nested namespaces. Add additional nested namespace in root namespace. Uses in plone-3 based templates (plone_app, plone3_portlet).

11. Plone/Content Templates

  • basic_zope :A Zope project. Create Zope product structure with zcml conffile, initalization file, if project is for Zope2. Add doctests skeletons.
  • plone :A Plone project. Usebasic_namespacetemplate, add zip_safe var, extends documentation info for setup_tools package. Package similar to basic_zope template.
  • archetype :A Plone project that uses Archetypes. Useplonetemplate. Prepare dir structure for content, browser view, portlets, GS profiles. May be used for both plone2 and plone3 products .
  • plone_app : A Plone App project. Usesnested_namespace . Actually plone template, but put in nested namespace.
  • plone3_portlet : A Plone 3 portlet.Usesnested_namespace . Create skeletons for template and browser views for add/edit/render portlet; register through zcml; add GS installation profile. Actually create unit tests for new portlet.

12. Theme templates

  • plone2_theme : A Theme Product for Plone 2.1 & Plone 2.5. Create skin-product python package for put in Products directory. Add QI-enabled installation with installation/uninstallation skin, registering resource registries. Skin directory contains css stiles. On creation ask for base skin. Added power installation/uninstallation unit tests.
  • plone2.5_theme :A Theme for Plone 2.5.Usesplonetemplate. Uses GS for installation resources, skins. Allows installation with both tools- QI and GS. Contains extended skin directory structure: for images, styles, templates. No browser views.
  • plone3_theme :A Theme for Plone 3.0.Usesplonetemplate. Create browser directory with prepared interfaces and viewlet browser view modules, images and stylesheets resources dirs. Register in configure.zcml views and resources for skin-interface. Setup implemented only with GS.

13. Buildout templates

  • plone3_buildout : A buildout for Plone 3 projects. Create directory structure for zc.buildout: src, products, var; bootstrap.py, buildout.cfg files. Use followinf vars on buildout creation: (zope2_install, plone_products_install), (zope_user, zope_password, http_port, debug_mode, verbose_security).
  • plone2.5_buildout : A buildout for Plone 2.5 projects. Usesplone3_buildout . Differences from plone3 only in installation plone from plone-2.5 archive (not from recipe, as in plone-3)
  • plone_hosting : Plonebuildout with ZEO and any Plone version. Use vars: zope_password, http_port, zeo_port, proxy_port, plone (version). Linke plone-3 buildout, but addbindir with control shell script. Use zeo and conditionally varnish recipes for setup zeoserver/varnish. Varnish installation control by proxy_port var. On creating perform bootstrap and run buildout.
  • recipe : A recipe project for zc.buildout.
  • silva_buildout : A buildout for Silva projects

14. A ddcontent -local command

  • Currently used only forArchetypetemplate
  • In 1.9 version implemented 5 local templates: portlet, view, zcmlmeta(register new directive), contenttype, atschema.
  • Extend standard template mechanism with_insertsuffix

15. Template example

  • Add some templates to template dir.
  • update entry_points:paste.paster_create_template
    • paster create -t base_package mytemplate
    • cd mytemplate
    • cat mytemplate/__init__.py
    • from zopeskel.base import BaseTemplate
    • class MyTemplate(BaseTemplate):
    • _template_dir = template
    • summary = Template Example

16. Notes for template developing

  • Templatemust inheritfrom paste.script.template.Template class
  • Must declare:summary, _template_dirvars.
  • For using ZopeSkel'local commandinclude egg_plugins=['ZopeSkel']
  • required_templates list of templates, which use by this one
  • vars declare variables for templates
  • use_cheetah variable defines what template mechanism used for.

17. Notes for template developing 2

  • There are 2 main entry points for template:
    • check_vars(vars, command)
    • run(comm, out_dir, vars)
  • There are 2 utility methods:
    • pre (out_dir, va rs)
    • post(out_dir, vars)
  • Subtempates for localcommands registered forzopeskel.zopeskel_sub_templateentry point

18. BUILDOUT (zc.buildout) author: Jim Fulton 19. Plan for Buildout

  • Basic information
  • Buildout creation
  • Buildout structure
  • buildout script
  • Installation/reinstallation/uninstallation
  • Buildout configuration file
  • Options of [buildout] section
  • Recipe developing
  • Plone recipes

20. Basic information

  • Resolve problems:
  • Glue many parts in one buildout
  • Unify developing/testing/production sandbox
  • Use eggs or setuptools distributed products
  • Useful for: Needed:
  • administrators
  • developers

21. Buildout creation. Simple steps

  • 1. a)python bootstrap.py
  • create main directory structure
  • b)python bootstrap.py init
  • create bootstrap.cfg
  • 2. From created bin directory use buildout script.
  • bin/buildout create buildout

22. Buildout structure bin/buildout buildout.cfg zc.buildout setuptools Base products bootstrap.py part 1 part 2 part .. Directory structure eggs bin (scripts) develop-eggs src parts 23. buildout script:options

  • Usage: buildout [options] [assignments] [command [command arguments]]
  • Options:
  • -c config_file -path to the configuration file. Defaults buildout.cfg. Can be passed as url, but than buildout:directory= [current directory]must be pointed
  • -UDon't read user defaults, specified in ~/.buildout/default.cfg file.
  • -o (-O)Run in off-line(not off-line) mode. Equivalent to buildout:offline=true
  • -n (-N)Run in newest (non-newest) mode. Equivalent to buildout:newest=true (false). Default-newest, and buildout will try to find the newest versions of distributions available that satisfy its requirements.
  • -DDebug errors. On error - the post-mortem debugger will be started.
  • -v( -q)Increase(decrease) the level of verbosity by 10.Can be used multiple times.

24. buildout script :assignments

  • Usage: buildout [options] [assignments] [command [command arguments]]
  • Assignments:
  • provide configuration options that override those given in the configuration file.
  • form:
  • section: