[Zope-dev] Adding resource in z3c.pt

Binseer N binseer at musmo.com
Tue Oct 14 02:37:39 EDT 2008


Hi all,
Can anybody tell me how can i add resource by using z3c.pt. i know how to
add it by using zope.pagetemplate, i tried it and it was working well. The
following is the code i am working with and it was not working with z3c.pt


*configure.zcml:-

.
.
*<adapter
        factory=".resizing_font.form_template"
        for=".resizing_font.ResizingFont"
        name="tatr_css_js.form"
        />   *

 *<browser:resourceDirectory
       name="tatr_js"
       directory="tatr_resource_js"
       />  *

.
.
.


resizing_font.pt :-

*<html>*
*     <head>
       <script type="text/javascript" src="jquery-1.2.6.js"
        tal:attributes="src
context/++resource++tatr_js/jquery-1.2.6.js">
       </script>
      </head>
   <body>
       This is a test :)
   </body>

</html>*



resizing_font.py :-

*from z3c.pt.pagetemplate import ViewPageTemplateFile*

*class ResizingFont(FormBase):
    template = NamedTemplate('tatr_css_js.form')
    form_fields=[]
    def __init__(self,context,request):
        self.request=request
        self.context=context
form_template = NamedTemplateImplementation(
    ViewPageTemplateFile('resizing_font.pt'))


*While running with this code i am getting the error

*2008-10-14T06:14:36 ERROR SiteError
http://192.168.0.43:8080/resizing_font.html
Traceback (most recent call last):
  File "/home/z3.4/lib/python/zope/publisher/publish.py", line 133, in
publish
    result = publication.callObject(request, obj)
  File "/home/z3.4/lib/python/zope/app/publication/zopepublication.py", line
167, in callObject
    return mapply(ob, request.getPositionalArguments(), request)
  File "/home/z3.4/lib/python/zope/publisher/publish.py", line 108, in
mapply
    return debug_call(obj, args)
   - __traceback_info__: <security proxied
zope.app.publisher.browser.viewmeta.ResizingFont instance at 0x98deeac>
  File "/home/z3.4/lib/python/zope/publisher/publish.py", line 114, in
debug_call
    return obj(*args)
  File "/home/z3.4/lib/python/zope/formlib/form.py", line 774, in __call__
    return self.render()
  File "/home/z3.4/lib/python/zope/formlib/form.py", line 768, in render
    self.form_result = self.template()
  File "/home/z3.4/lib/python/z3c/pt/pagetemplate.py", line 40, in render
    return template.render(**parameters)
  File "/home/z3.4/lib/python/chameleon/zpt/template.py", line 51, in render
    return super(PageTemplateFile, self).render(**kwargs)
  File "/home/z3.4/lib/python/chameleon/core/template.py", line 156, in
render
    return super(TemplateFile, self).render(**kwargs)
  File "/home/z3.4/lib/python/chameleon/core/template.py", line 62, in
render
    template = self.cook_check(parameters=kwargs)
  File "/home/z3.4/lib/python/chameleon/core/template.py", line 152, in
cook_check
    return Template.cook_check(self, **kwargs)
  File "/home/z3.4/lib/python/chameleon/core/template.py", line 57, in
cook_check
    template = self.cook(parameters=parameters, **kwargs)
  File "/home/z3.4/lib/python/chameleon/core/template.py", line 138, in cook
    template = self.compiler(**kwargs)
  File "/home/z3.4/lib/python/chameleon/core/translation.py", line 597, in
__call__
    self.root.start(stream)
  File "/home/z3.4/lib/python/chameleon/core/translation.py", line 438, in
start    self.node.visit()
  File "/home/z3.4/lib/python/chameleon/core/translation.py", line 107, in
visit    self.body()
  File "/home/z3.4/lib/python/chameleon/core/translation.py", line 92, in
body
    element.node.visit()
  File "/home/z3.4/lib/python/chameleon/core/translation.py", line 107, in
visit    self.body()
  File "/home/z3.4/lib/python/chameleon/core/translation.py", line 92, in
body
    element.node.visit()
  File "/home/z3.4/lib/python/chameleon/core/translation.py", line 107, in
visit    self.body()
  File "/home/z3.4/lib/python/chameleon/core/translation.py", line 92, in
body
    element.node.visit()
  File "/home/z3.4/lib/python/chameleon/core/translation.py", line 106, in
visit    self.begin()
  File "/home/z3.4/lib/python/chameleon/core/translation.py", line 72, in
begin
    self.stream.begin(self.serialize())
  File "/home/z3.4/lib/python/chameleon/core/translation.py", line 174, in
serialize
    dynamic_attrs = self.dynamic_attributes or ()
  File "/home/z3.4/lib/python/chameleon/zpt/language.py", line 74, in
dynamic_attributes
    if self.element.tal_attributes is not None:
  File "/home/z3.4/lib/python/chameleon/core/utils.py", line 52, in get
    return f(value)
  File "/home/z3.4/lib/python/chameleon/zpt/expressions.py", line 236, in
definitions
    raise e
SyntaxError: Not a valid path-expression.
192.168.0.43 - - [14/Oct/2008:06:14:36 +0000] "GET /resizing_font.html
HTTP/1.1" 500 84 "http://192.168.0.43:8080/" "Mozilla/5.0 (X11; U; Linux
i686; en-US; rv:1.8.1.16) Gecko/20080702
Iceweasel/2.0.0.16(Debian-2.0.0.16-0etch1)"


Thanks in advance :)
*

*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope-dev/attachments/20081014/755c0eee/attachment.html 


More information about the Zope-Dev mailing list