[Zope] Help me!
David H
bluepaul at earthlink.net
Mon Jan 9 19:04:28 EST 2006
Bruno Grampa wrote:
> Hello,
> i'm building a site to sell images (this is the concept, the reality is
> different...).
> All the images are in a directory mapped through LocalFS product.
> For every image i have a record in a SQL table with all the basic
> informations: author, name of the file, cost.
>
> What i haven't understood is how to block users from getting images if
> they have not enough credit to buy them.
> I need to control the view method, but i don't know if this idea is the
> right one or there are better solutions.
>
> Any hints?
>
> Thanks,
> Bruno
>
>
> ____
Bruno,
Maybe you can better explain your question. Im not at all sure the
following will help:
Seems like you can check a users credit at login, store the credit score
in SESSION and use that for branching logic. You could also update the
creditScore as it changes.
Then you can develope your pages with stuff like this: (syntax not checked)
in TAL
<a hRef="somewhere" tal:condition="python:
request.SESSION['hasCredit'];">This link only shows up if session's
'hasCredit' is true.</a>
In DTML
<dtml-if "SESSION['hasCredit']">
<a hRef="somewhere ...
<dtml-else>
< hRef="somewhereelse">
In Python: (and TAL macros)
if context.REQUEST.SESSION['hasCredit']:
return container.Images.macros['allImages']
else
return container.Images.macros['someImages']
David
More information about the Zope
mailing list