<div dir="ltr">Hello, <div><br></div><div>I am running into an issue that I can't quite figure out. <br></div><div><br></div><div>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: </div><div><br></div><div><span style="font-family:monospace,monospace"><dtml-if "REQUEST.SESSION.get('testVarDict</span><span style="font-family:monospace,monospace">')"></span><br></div><div><div><font face="monospace, monospace">  <dtml-call "REQUEST.set('testVarDict',REQUEST.SESSION.get('vx9member'))"></font></div><div><font face="monospace, monospace"><dtml-else></font></div><div><font face="monospace, monospace">  <dtml-call "RESPONSE.redirect(BASE1+'/login')"></font></div><div><font face="monospace, monospace"></dtml-if></font></div></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"><dtml-var testVarDict></font></div><div><font face="monospace, monospace"><br></font></div><div><div>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. </div></div><div><br></div><div>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: </div><div><br></div><div><div><span style="font-family:monospace,monospace"><dtml-var headerDoc</span><span style="font-family:monospace,monospace">></span><br></div><div><div><div><font face="monospace, monospace"><dtml-var testVarDict></font></div></div><div><span style="font-family:monospace,monospace"><dtml-var footerDoc</span><span style="font-family:monospace,monospace">></span><br></div></div></div><div><br></div><div>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. </div><div><br></div><div>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: </div><div><br></div><div><div><font face="monospace, monospace">if context.REQUEST.SESSION.get('</font><span style="font-family:monospace,monospace">testVarDict</span><font face="monospace, monospace">'):</font></div><div><font face="monospace, monospace">  context.REQUEST.set('vx9member',context.REQUEST.SESSION.get('testVarDict'))</font></div><div><font face="monospace, monospace">else: </font></div><div><font face="monospace, monospace">  return context.REQUEST.RESPONSE.redirect('/login')</font></div></div><div><br></div><div>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. </div><div><br></div><div>If anyone could assist or show me a different way then I would greatly appreciate it. <br></div><div><br></div><div>Thanks,</div><div>J</div></div>