Jumpstart Your Development with ZopeSkel

1,197 views
624 views

Published on

Learn to use ZopeSkel and the extensibility of the underlying templer system to create skeleton templates that support your needs as a developer. Spend minutes instead of hours starting new projects so you can use your time for your customers' code.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,197
On SlideShare
0
From Embeds
0
Number of Embeds
7
Actions
Shares
0
Downloads
7
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Jumpstart Your Development with ZopeSkel

    1. Jump Start yourDevelopment with ZopeSkel Cris Ewing Cris Ewing, Developer LLC Plone Conference 2012 Arnhem, the Netherlands
    2. Overview
    3. Overview• When and Why to Use Zopeskel
    4. Overview• When and Why to Use Zopeskel• Basics of Template Writing
    5. Overview• When and Why to Use Zopeskel• Basics of Template Writing• Explanation of the API
    6. When
    7. When• You have code you write over and over
    8. When• You have code you write over and over• Most of that code is identical
    9. When• You have code you write over and over• Most of that code is identical• What isn’t identical can be abstracted
    10. Why
    11. Why• You can avoid writing all that stuff
    12. Why• You can avoid writing all that stuff• You can set things up your way
    13. Why• You can avoid writing all that stuff• You can set things up your way• You can apply vc to your process
    14. Writing a Template
    15. What do you want?
    16. mycompany_policy
    17. What have you got?
    18. bin/templer --listbin/templer <template_name> --list-variables
    19. max(in_common()) min(needs_doing())
    20. Wire It Up
    21. Create a Class
    22. from templer.plone.plone import Ploneclass PolicyPackage(Plone): summary = "My skeleton for policy packages" help = "Control the customization of a project" _template_dir = policypackage
    23. Import toPackage Namespace
    24. in __init__.pyfrom templates import PolicyPackage
    25. Provide an Entry Point
    26. in setup.py...install_requires=[ setuptools, # -*- Extra requirements: -*-],entry_points="""# -*- Entry points: -*-[paste.paster_create_template]mycompany_policy = mycompany.policy:PolicyPackage""",
    27. Install$ python setup.py develop
    28. did it work? $ bin/templer --list
    29. Flesh It Out
    30. Change a Var
    31. In Your Classimport copy # newfrom templer.core.base import get_var # newfrom templer.plone.plone import Ploneclass PolicyPackage(Plone): summary = "My skeleton for policy packages" help = "Control the customization of a project" _template_dir = policypackage vars = copy.deepcopy(Plone.vars) # new get_var(vars, add_profile).default = True # new get_var(vars, ‘add_profile’).modes = [] # new
    32. Add a Var
    33. import copy In Your Classfrom templer.core.base import get_varfrom templer.core.vars import EASYfrom templer.core.vars import StringVarfrom templer.plone.plone import Ploneclass PolicyPackage(Plone): summary = "My skeleton for policy packages" help = "Control the customization policy of a project" _template_dir = policypackage vars = copy.deepcopy(Plone.vars) get_var(vars, add_profile).default = True get_var(vars, add_profile).modes = [] vars.append( StringVar( add_on_profile, provide the name of an add-on profile to be installed, modes=(EASY,), ), )
    34. Add Structure
    35. Your Package
    36. metadata.xml_tmpl<?xml version="1.0"?><metadata> <version>001</version>#if $add_on_profile <dependencies> <dependency>${add_on_profile}</dependency> </dependencies>#end if</metadata>
    37. Did it Work?
    38. http://templer-manual.readthedocs.org/
    39. API
    40. Template• Attributes • summary • help • post_run_msg • category
    41. Template• Attributes • _template_dir • required_templates • default_required_structures • use_local_commands
    42. Template• Methods • pre • post
    43. Var• Attributes • name • title • description • help • category
    44. Var• Attributes • default • modes • structures
    45. Var• Methods • pretty_description • further_help • validate
    46. Entry Point Categories• paste.paster_create_template • for templates you want users to run• templer.templer_structure • for structures users should never see• templer.templer_sub_template • for local commands
    47. Questions?cris@crisewing.com cewing @crisewing

    ×