[Zope-dev] Adding resource in z3c.pt

Binseer N binseer at musmo.com
Tue Oct 14 07:50:42 EDT 2008


2008/10/14 Wichert Akkerman <wichert at wiggy.net>

> Previously Binseer N wrote:
> > 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>*
>
> Try adding a trailing ; after your TALES expression.
>
> Wichert.
>

>
> --
> Wichert Akkerman <wichert at wiggy.net>    It is simple to make things.
> http://www.wiggy.net/                   It is hard to make things simple.







Thank you   for the reply  Wichert.
       Do you mean i have to add ";" after the  TAL expression  . I tried so
but the result is same .

 Initially i tried with the following code , but it fired the same error

ie  <script type="text/javascript" src="jquery-1.2.6.js">
         tal:attributes="src  context/++resource++tatr_js/jquery-1.2.6.js;">


then i tried with the following
<script type="text/javascript" src="jquery-1.2.6.js"
        tal:attributes="src
context++resource++tatr_jsjquery-1.2.6.js";>
   </script>

it fired the error

2008-10-14T11:45:52 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 0x9913d6c>
  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/template.py", line 46, in
compiler
    encoding=self.encoding)
  File "/home/z3.4/lib/python/chameleon/core/translation.py", line 517, in
__init__
    self.root, parsed_doctype = parser.parse(body)
  File "/home/z3.4/lib/python/chameleon/zpt/language.py", line 250, in parse
    root, doctype = super(Parser, self).parse(body)
  File "/home/z3.4/lib/python/chameleon/core/etree.py", line 39, in parse
    return parse(body, self.element_mapping)
  File "/home/z3.4/lib/python/chameleon/core/etree.py", line 202, in parse
    tree = lxml.etree.parse(StringIO(body), parser)
  File "lxml.etree.pyx", line 2576, in lxml.etree.parse
(src/lxml/lxml.etree.c:22796)
  File "parser.pxi", line 1483, in lxml.etree._parseDocument
(src/lxml/lxml.etree.c:60359)
  File "parser.pxi", line 1511, in lxml.etree._parseMemoryDocument
(src/lxml/lxml.etree.c:60613)
  File "parser.pxi", line 1390, in lxml.etree._parseDoc
(src/lxml/lxml.etree.c:59530)
  File "parser.pxi", line 932, in lxml.etree._BaseParser._parseDoc
(src/lxml/lxml.etree.c:56815)
  File "parser.pxi", line 538, in
lxml.etree._ParserContext._handleParseResultDoc
(src/lxml/lxml.etree.c:53512)
  File "parser.pxi", line 624, in lxml.etree._handleParseResult
(src/lxml/lxml.etree.c:54372)
  File "parser.pxi", line 564, in lxml.etree._raiseParseError
(src/lxml/lxml.etree.c:53770)
XMLSyntaxError: attributes construct error, line 12, column 16
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope-dev/attachments/20081014/d94ef61d/attachment-0001.html 


More information about the Zope-Dev mailing list