[Zope] Using Template in script (python)

2015-04-08 Thread Miguel Beltran R.
Hi list,
I'm trying to use the make a  string using a Template and fill it with the
result of a query, but gime this error
You are not allowed to access 'safe_substitute' in this context

Zope = 2.12

from string import Template
rst=someSQL()[0]
txt=Template(
span id=datos_vehiculo
   data-placa=${placa}
   data-serie=${serie}
   data-marca=${marca}
   data-submarca=${submarca}
   data-modelo=${modelo}
/span
)
newtxt=txt.safe_substitute(rst)

do exist some way to do it?
-- 

Lo bueno de vivir un dia mas
es saber que nos queda un dia menos de vida
___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


[Zope-CMF] cmf-tests -

2015-04-08 Thread CMF tests summarizer
This is the summary for test reports received on the 
cmf-tests list between 2015-04-07 00:00:00 UTC and 2015-04-08 00:00:00 UTC:

See the footnotes for test reports of unsuccessful builds.

An up-to date view of the builders is also available in our 
buildbot documentation: 
http://docs.zope.org/zopetoolkit/process/buildbots.html#the-nightly-builds

Reports received



Non-OK results
--

___
Zope-CMF maillist  -  Zope-CMF@zope.org
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


[Zope-CMF] Successful - CMF-trunk_Zope-trunk - Build # 704

2015-04-08 Thread Jenkins
CMF-trunk_Zope-trunk - Build # 704 - Successful:

Check console output at 
https://jenkins.starzel.de/job/CMF-trunk_Zope-trunk/704/ to view the results.___
Zope-CMF maillist  -  Zope-CMF@zope.org
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


[Zope] Sessions DTML Execution

2015-04-08 Thread Justin Dunsworth
Hello,

I am running into an issue that I can't quite figure out.

I'm trying to leverage storing data within sessions then setting a variable
in the header of my page to the session variable (for ease of calling)
where I can then use it throughout the rest of my document. Here's the way
it goes:

dtml-if REQUEST.SESSION.get('testVarDict')
  dtml-call REQUEST.set('testVarDict',REQUEST.SESSION.get('vx9member'))
dtml-else
  dtml-call RESPONSE.redirect(BASE1+'/login')
/dtml-if

dtml-var testVarDict

Here I am wanting to redirect to login should testVarDict not be set.
Instead it seems like Zope is still wanting to execute the rest of the page
prior to redirecting so this will throw a NameError for testVarDict should
the session data not be set.

I then found out that I can change the dtml-call to a dtml-return for the
redirect and it will stop executing the dtml and redirect. This is all fine
but if I have another page I'm going to call that uses the header like so:

dtml-var headerDoc
dtml-var testVarDict
dtml-var footerDoc

This then will throw the same NameError regardless of the dtml-return
redirect in the header. I can get around this by placing the same checks in
the top of every.single.page that I want to utilize testVarDict variable
but that's too cumbersome.

I then tried to make a script that would check the same thing and then
redirect but it doesn't seem to work at all - for fun here's the python
script:

if context.REQUEST.SESSION.get('testVarDict'):

context.REQUEST.set('vx9member',context.REQUEST.SESSION.get('testVarDict'))
else:
  return context.REQUEST.RESPONSE.redirect('/login')

I've also tried just the context.REQUEST.RESPONSE.redirect without the
return but it doesn't seem to work and I suspect it's because python return
is not the same as dtml-return.

If anyone could assist or show me a different way then I would greatly
appreciate it.

Thanks,
J
___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )