Arlen:

I agree that documentation is sparse to non-existent.  However, I have have 
found no useful links to enlighten you --- most of the stuff I figured out by 
grepping for the 'def' functions in ZenModel to figure out what features of 
device retrieval were built-in.

Since it sounds like you went thru my examples to understand TAL better, I'll 
just give you my top 3 pointers:

1. TAL is about as iterative as Windows cmd/batch Scripting --- whereas 
everything is done via tal:repeat/condition loops similar to for-if-loops.  You 
can nest loops, but you cannot break apart begin/end tags.  The thing that 
makes it more powerful than cmd.bat is python, of course, so bear in mind 
little tal-to-python thing like 
Code:
tal:content="hash/key"

 is identical to 
Code:
tal:content="python:hash['key']"

 

2. Do all the heavy work in a plugin.  If you're like me, you'll only want to 
create as few report files as possible and reuse them based on GET parameters.  
However, since you only want to pass one parameter to the plugin, you'll have 
to recreate the tuple by merging the request pairs with your new pairs:

Code:

  dk python:here.REQUEST.keys() + ['newkey1','newkey2'];
  dv python:here.REQUEST.values() + [val1, val2];
  objects python:here.ReportServer.plugin('pluginName', dict(zip(dk,dv)));




3. Not sure how Zenoss guys tested their plugins, but they didn't allow for 
command-line execution (so I butchered a few of their Performance Reports in 
order to understand them better).  I, for one, am heavily in favor of it, 
therefore, all my plugins begin with something like this:

Code:

try:
  import Plugin
except:
  from Products.ZenReports.plugins import Plugin




to allow for it to run both the Zope GUI and CLI --- i.e.:

Code:

$ cd $ZENHOME/Products/ZenReports
$ python plugin/pluginName.py key1=val1 key2=val2 ...
[]







-------------------- m2f --------------------

Read this topic online here:
http://community.zenoss.com/forums/viewtopic.php?p=7927#7927

-------------------- m2f --------------------



_______________________________________________
zenoss-users mailing list
[email protected]
http://lists.zenoss.org/mailman/listinfo/zenoss-users

Reply via email to