Re: Strange session behavior with macro-call
Jeff Peterson <[email protected]> Tue, 27 Jun 2006 08:12:45 -0500
| Newsgroups | gmane.comp.web.zope.page-templates |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format.
--------------080102010200000900090601
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Chris Withers wrote:
> Jeff Peterson wrote:
>> I have a page template that calls a couple of scripts at the
>> beginning, they are setting session objects and redirecting to a
>> login screen if certain session objects don't exist.
>
> Why not just use PAS or Cookie Crumbler? ;-)
I guess I could look at that...I am having to authenticate against an
existing database of usernames and passwords so I just wrote it myself.
>
>> the content for this page. When the macro is rendered, the scripts
>> fail to operate properly (commented out they work perfectly).
>
> I'll bet your doing something like:
>
> <mytag tal:define="dummy here/myScript"
> metal:use-macro="something">
> ...
>
> The macro replaces the whole tag before the tal:define gets called.
Actually I am not doing anything of the sort.
The whole page is a macro to start. The scripts that are being called
are all in this format:
<metal:block metal:fill-slot="defines">
<!-- define any template specific variables here -->
<tal:x tal:define="baseurl context/root/baseurl"></tal:x>
<tal:x tal:define="global session request/SESSION"></tal:x>
<tal:x tal:condition="python:not session.has_key('user')">
<tal:x tal:define="bookmark
context/commonRoot/bookmarks/setBookmark"></tal:x>
</tal:x>
<tal:x tal:condition="python:session.has_key('user')">
<tal:x tal:define="global accountname
session/user/account_name;
global username
session/user/user_name;
global account_id
session/user/account_id;
global roles
session/user/role;
global uadm python:'uadm' in roles;
global dadm python:'dadm' in roles;
global padm python:'padm' in
roles"></tal:x>
</tal:x>
</metal:block>
then below, the macro is being pulled in inside a different fill-slot.
>
> Anyway, overarchingly, don't mix presentation and logic like this,
> 'cos it causes these kind of problems ;-)
>
> cheers,
>
> Chris
>
--
Jeffrey D Peterson
--------------080102010200000900090601
Content-Type: text/x-vcard; charset=utf-8;
name="jpeterso.vcf"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="jpeterso.vcf"
begin:vcard
fn:Jeffrey Peterson
n:Peterson;Jeffrey
org:Crary Industries;Information Systems
adr:;;237 12th Street NW;West Fargo;ND;58078;US
email;internet:[email protected]
title:Web Applications Developer
tel;work:701-282-5520
x-mozilla-html:FALSE
url:http://crary.com
version:2.1
end:vcard
--------------080102010200000900090601
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
ZPT mailing list
[email protected]
http://mail.zope.org/mailman/listinfo/zpt
--------------080102010200000900090601--