Invalid syntax in expresion replace value=

21 views
Skip to first unread message

jv

unread,
Aug 26, 2014, 4:10:13 AM8/26/14
to python-r...@googlegroups.com
Hi,

1.- I tried to do a exemple using relatiorio and genshi inside OO document. All the samples works fine except when I use the genshi replace tag. I received the following error:

generating... gnTest.odt
Traceback (most recent call last):
  File "doGnTest.py", line 34, in <module>
    content = report(o=c).render().getvalue()
  File "d:\utl\Python27\lib\site-packages\relatorio-0.6.1-py2.7.egg\relatorio\reporting.py", line 123, in __call__
    return template.generate(**data).filter(*self.filters)
  File "d:\utl\Python27\lib\site-packages\relatorio-0.6.1-py2.7.egg\relatorio\templates\opendocument.py", line 729, in generate
    stream = super(Template, self).generate(*args, **kwargs)
  File "d:\temp\easy_install-fjhx8m\Genshi-0.7-py2.7-win32.egg.tmp\genshi\template\base.py", line 545, in generate
  File "d:\temp\easy_install-fjhx8m\Genshi-0.7-py2.7-win32.egg.tmp\genshi\template\base.py", line 455, in stream
  File "d:\temp\easy_install-fjhx8m\Genshi-0.7-py2.7-win32.egg.tmp\genshi\template\base.py", line 486, in _prepare
  File "d:\temp\easy_install-fjhx8m\Genshi-0.7-py2.7-win32.egg.tmp\genshi\template\directives.py", line 492, in attach
  File "d:\temp\easy_install-fjhx8m\Genshi-0.7-py2.7-win32.egg.tmp\genshi\template\directives.py", line 115, in _parse_expr
genshi.template.base.TemplateSyntaxError: invalid syntax in expression "replace value="o.tst"" of "replace" directive (, line 1) (<string>, line 1)

After looking the code I changed  the GENSHI_EXPR on relatorio/templates/opendocument.py adding replace on tag directive. After that the error is corrected and the replace works.

2.- After the code change if I try to replace with a XML tag the < and > are translated to &gt; and &glt;. Is there a way to do the replace without symbol tanslation?

The following image shows the sample doc:



Thanks
J



Cédric Krier

unread,
Aug 26, 2014, 6:36:43 AM8/26/14
to python-r...@googlegroups.com
On 26 Aug 01:10, jv wrote:
> 2.- After the code change if I try to replace with a XML tag the < and >
> are translated to &gt; and &glt;. Is there a way to do the replace without
> symbol tanslation?

replace command is not supported for this reason and because we don't
think it is wise to write OD code ourself.

Why do you want to use replace instead of just displaying the content of
"o.tst"?

--
Cédric Krier - B2CK SPRL
Email/Jabber: cedric...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

Josep Vela

unread,
Aug 26, 2014, 7:09:25 AM8/26/14
to python-r...@googlegroups.com
Thanks cedric for your quick response.
I need to create textual aspect (font, style, etc.) based on  the parser so o.tst is "<text:span text:style-name=\"T3\">style change</text:span>" and  I don't know how to use other way to do this B-( .
I have looked at xinclude but I think the problem is the same.
Yours.
Josep
--
Josep Vela - actio ad futurum - lean IT management - Synthesis Group
Skype: josep.vela.albesa

C/ Valencia, 231 - 2on - 2a, 08006 Barcelona

Abans d'imprimir aquest missatge, assegureu-vos que és necessari.

Aquest missatge es dirigeix exclusivament al seu destinatari i pot contenir informació confidencial sotmesa a secret professional o que la divulgació estigui prohibida en virtut de la legislació vigent. Qualsevol opinió en ell continguda és exclusiva del seu autor i no representa necessàriament l'opinió de l'empresa. Si ha rebut aquest missatge per error, li preguem ens ho comuniqui immediatament per aquesta mateixa via i procedeixi a la seva eliminació.

Antes de imprimir este mensaje, asegúrese de que es necesario.
Este mensaje se dirige exclusivamente a su destinatario y puede contener información confidencial sometida a secreto profesional o cuya divulgación está prohibida en virtud de la legislación vigente. Cualquier opinión en él contenida es exclusiva de su autor y no representa necesariamente la opinión de la empresa. Si ha recibido este mensaje por error, le rogamos nos lo comunique inmediatamente por esta misma vía y proceda a su eliminación

Cédric Krier

unread,
Aug 26, 2014, 7:24:28 AM8/26/14
to python-r...@googlegroups.com
On 26 Aug 12:49, Josep Vela wrote:
> Thanks cedric for your quick response.
> I need to create textual aspect (font, style, etc.) based on the parser so
> o.tst is "<text:span text:style-name=\"T3\">style change</text:span>" and
> I don't know how to use other way to do this B-( .

The style of the placeholder will be kept when replaced by its value.

PS: Please don't top-post on this mailing list.
Reply all
Reply to author
Forward
0 new messages