[Zope] Newbie: Missing a Variable (TAL/METAL Question)

beno - purabachata at yahoo.com
Fri Jul 28 18:43:34 EDT 2006


Dieter Maurer <dieter at handshake.de> wrote:If you use "repeat/variable" (again, "variable" is not meant literally,
but *some* "variable"), then "variable" must be a repeat variable
defined by an enclosing 'tal:repeat="variable ..."'.
If this is the case, then "repeat/variable/number" should work.
Here is the code again:

<table tal:define="objects here/objectValues;
                   sort_on python:(('title', 'nocase', 'asc'),
                                   ('bobobase_modification_time', 'cmp', 'desc'));
                   sorted_objects python:sequence.sort(objects, sort_on);
                   start python:getattr(request, 'start', 0);
                   batch python:modules['ZTUtils'].Batch(sorted_objects, size=10, start=start);
                   previous python:batch.previous;
                   next python:batch.next">
  <tr tal:repeat="item batch">
    <td tal:define="number repeat/item/number"
            tal:content="number">1</td>
    <td tal:content="item/title">title</td>
    <td><tal:content metal:use-macro="here/?number/macros/author">author</tal:content></td>
    <td><tal:content metal:use-macro="here/?number/macros/content">content</tal:content></td>
    <td tal:content="item/bobobase_modification_time">
      modification date</td>  
  </tr>
</table>


Here is the error it throws as reported through the TTW:

Site Error   An error was encountered while publishing this resource.   
   KeyError
    Sorry, a site error occurred.Traceback (innermost last): 

     Module ZPublisher.Publish, line 175, in publish_module_standard
     Module ZPublisher.Publish, line 132, in publish
     Module Zope.App.startup, line 204, in zpublisher_exception_hook
     Module ZPublisher.Publish, line 101, in publish
     Module ZPublisher.mapply, line 88, in mapply
     Module ZPublisher.Publish, line 39, in call_object
     Module Shared.DC.Scripts.Bindings, line 306, in __call__
     Module Shared.DC.Scripts.Bindings, line 343, in _bindAndExec
     Module Products.PageTemplates.ZopePageTemplate, line 222, in _exec
     Module Products.PageTemplates.PageTemplate, line 96, in pt_render
 <ZopePageTemplate at /rejoice.2012.vi/en-us/Books/getQuote used for /rejoice.2012.vi/en-us/Books/test>
     Module TAL.TALInterpreter, line 190, in __call__
     Module TAL.TALInterpreter, line 234, in interpret
     Module TAL.TALInterpreter, line 613, in do_loop_tal
     Module TAL.TALInterpreter, line 234, in interpret
     Module TAL.TALInterpreter, line 657, in do_useMacro
     Module Products.PageTemplates.TALES, line 221, in evaluate
 URL: /rejoice.2012.vi/en-us/Books/getQuote
 Line 22, Column 4
 Expression: standard:'here/?number/macros/author'
 Names:
{'container': <Folder instance at 9cb67a0>,
 'context': <Folder instance at 9cd1e60>,
 'default': <Products.PageTemplates.TALES.Default instance at 0x8a1d62c>,
 'here': <Folder instance at 9cd1e60>,
 'loop': <SafeMapping instance at 99ef7a0>,
 'modules': <Products.PageTemplates.ZRPythonExpr._SecureModuleImporter instance at 0x8a1d06c>,
 'nothing': None,
 'options': {'args': ()},
 'repeat': <SafeMapping instance at 99ef7a0>,
 'request': <HTTPRequest, URL=http://rejoice.2012.vi/Books/test/getQuote>,
 'root': <Application instance at 9a4c8f0>,
 'template': <ZopePageTemplate at /rejoice.2012.vi/en-us/Books/getQuote used for /rejoice.2012.vi/en-us/Books/test>,
 'traverse_subpath': [],
 'user': Anonymous User}

     Module Products.PageTemplates.Expressions, line 174, in __call__
     Module Products.PageTemplates.Expressions, line 162, in _eval
     Module Products.PageTemplates.Expressions, line 101, in _eval
KeyError: 'number' (Also, an error occurred while attempting to render the standard error message.)



The error from the error log makes no sense to me. The time is off, too. I don't understand, but here it is:

Time   2006/07/28 22:42:06.706 Universal       User Name (User Id)    tick (tick)       Request URL   http://2012.vi:7080/error_log/manage_workspace       Exception Type   Redirect       Exception Value   http://2012.vi:7080/error_log/manage_main     Traceback (innermost last): 

     Module ZPublisher.Publish, line 101, in publish
     Module ZPublisher.mapply, line 88, in mapply
     Module ZPublisher.Publish, line 39, in call_object
     Module App.Management, line 85, in manage_workspace
Redirect: http://2012.vi:7080/error_log/manage_main 
   Display    traceback as text51
         
  [input] 43        REQUEST formcookiestree-s'eJzT0MgpMOQKVneEA09bda4CI67EkgJjLj0AeJsHfw'lazy itemsSESSION<bound method SessionDataManager.getSessionData of <SessionDataManager instance at 9a56890>>otherTraversalRequestNameStack[]AUTHENTICATED_USERtickURL'http://2012.vi:7080/error_log/manage_workspace'SERVER_URL'http://2012.vi:7080'AUTHENTICATION_PATH''PUBLISHED<bound method SiteErrorLog.manage_workspace of <SiteErrorLog at /error_log>>URL1'http://2012.vi:7080/error_log'ACTUAL_URL'http://2012.vi:7080/error_log/manage_workspace'URL0http://2012.vi:7080/error_log/manage_workspaceURL1http://2012.vi:7080/error_logURL2http://2012.vi:7080BASE0http://2012.vi:7080BASE1http://2012.vi:7080BASE2http://2012.vi:7080/error_logBASE3http://2012.vi:7080/error_log/manage_workspaceenvironHTTP_COOKIE'tree-s="eJzT0MgpMOQKVneEA09bda4CI67EkgJjLj0AeJsHfw"'SERVER_SOFTWARE'Zope/(Zope 2.7.8-final, python 2.3.5, freebsd5)
 ZServer/1.1'SCRIPT_NAME''REQUEST_METHOD'GET'PATH_INFO'/error_log/manage_workspace'SERVER_PROTOCOL'HTTP/1.1'channel.creation_time1154126516CONNECTION_TYPE'keep-alive'HTTP_ACCEPT_CHARSET'ISO-8859-1,utf-8;q=0.7,*;q=0.7'HTTP_USER_AGENT'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4'HTTP_REFERER'http://2012.vi:7080/manage_main'SERVER_NAME'localhost'REMOTE_ADDR'67.143.135.132'PATH_TRANSLATED'/error_log/manage_workspace'SERVER_PORT'7080'HTTP_HOST'2012.vi:7080'HTTP_ACCEPT'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5'GATEWAY_INTERFACE'CGI/1.1'HTTP_ACCEPT_LANGUAGE'en-us,en;q=0.5'HTTP_ACCEPT_ENCODING'gzip,deflate'HTTP_KEEP_ALIVE'300'

 		
---------------------------------
Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls.  Great rates starting at 1¢/min.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20060728/adf80961/attachment.htm


More information about the Zope mailing list