[triangle-zpug] report on *last* Plone Jam - 6 Feb 2008 at TOT in Morrisville

Chris Calloway cbc at unc.edu
Sat Feb 23 00:31:37 CET 2008


On 2/22/2008 8:23 AM, Josh Johnson wrote:
> In other news, I may be moving away from model-driven development, in 
> favor of the "Martin Book" and ZopeSkel [1] :P Might be a good topic for 
> a lightning talk at the next meeting.

I know of one person with whom I had lunch today who should love to hear 
about this. :)

AT is supposed to be around for while. But there are two moves afoot.

One is to find a way to turn your AT models into Z3 packages.

Another is a way to move modeling content types up into the Plone UI itself.

Expect to see both of these in the Plone 4 family at some point.

It kind of feels like the days when AT was young and everybody was 
scared of them.

I know I was. :)

Report from last night:

All the regulars were ill, taking care of the ill, or otherwise indisposed.

I learned to take more care getting a hub set up in the meeting room. 
Med Center wireless doesn't work on main campus, I've learned. Apologies 
and it won't happen again.

Rafael Salazar wanted a way to introspect his ZODB. So we went through 
Clouseau. MY FAVORITE PLONE TRICK!!!

Notes:
1) Don't do this on production!
2) Put DocFinderTab from zope.org in Products. It's a pure Zope product.
3) Put Clouseau from zope.org in Products. Works great with Plone 3, too.
4) Edit clouseau/config.py to make debug flags to your liking.
5) Restart Zope!
6) Login to Plone as a site manager.
7) Add Clouseau through the quick installer.
8) Go look at some content.
9) Click on the new Inspector Clouseau content icon
10) Python shell appears at bottom of page!!!
11) Note pre-defined namespaces (app = root of Zope, portal = root of 
Plone, context = you are here)
12) Type import sys; print sys.path. See where Plone loads modules from!
13) Type name of something in your current namespace (like context)
14) Put a dot at the end. Watch objects contained in that namespace 
appear!!!
15) Type name of callable after the dot. Type open paren after the 
callable name. Watch docstring of callable appear!!!
16) Clear line and type context.listCreators(). Watch tuple of creators 
of current piece of content appear.
17) Type context.setCreators(('someotheruseridofyourchoice',)) ...Note: 
you might need to create that other userid first :)
18) Type context.reindexObject(). Because Creators are indexed.
19) Type utils.commit() if you want to make this permanent. utils is a 
name provided by Clouseau. It is not portal_utils.
20) Now look at the byline widget on the piece of content. See that the 
Creator has changed!!!

Dr. Joshua Smith of NCSU also came with an idea. It requires having 
Plone ingest LaTEX. He has a Python LaTEX package already (PlasTEX). We 
took a look inside the PortalTransforms product that ships with Plone. 
Inside PortalTransforms/transforms, we looked at what the format of a 
latex_to_html transform should look like:

from Products.PortalTransforms.interfaces import itransform
from DocumentTemplate.DT_Util import html_quote
from PlasTex import some_magic_function

class LaTexToHTML:
     """Transform LaTEX to HTML"""

     __implements__ = itransform

     __name__ = "latex_to_html"
     output = "text/html"

     def __init__(self,
                  name=None,
                  inputs=('application/x-latex',)):
         self.config = { 'inputs' : inputs, }
         self.config_metadata = {
             'inputs' : ('list',
                         'Inputs',
                         'Input(s) MIME type. Change with care.')
         }
         if name:
             self.__name__ = name

     def name(self):
         return self.__name__

     def __getattr__(self, attr):
         if attr == 'inputs':
             return self.config['inputs']
         if attr == 'output':
             return self.config['output']
         raise AttributeError(attr)

     def convert(self, orig, data, **kwargs):
         # Magic with PlasTEX happens here
         data.setData(some_magic_function(orig))
         return data

def register():
     return LaTexToHTML()

Note: plone.transforms is the new Z3 way to do this. Just like in lib 
instead of Products.

Some references:

http://plone.org/documentation/tutorial/portal-transforms/
http://plone.org/events/sprints/past-sprints/marseille-2007/pastis-sprint-2007-in-marseille/
http://plone.org/products/arofficetransforms/
http://plone.org/products/plone/roadmap/165/
http://zopyx.com/en

Note: there is something called "Stream-based portal transforms 
replacement" coming in Plone 4:

http://plone.org/products/plone/releases/4.0/

-- 
Sincerely,

Chris Calloway
http://www.secoora.org
office: 332 Chapman Hall   phone: (919) 599-3530
mail: Campus Box #3300, UNC-CH, Chapel Hill, NC 27599








More information about the TriZPUG mailing list