Bruno Grampa wrote:

i'm building a site to sell images (this is the concept, the reality is
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?




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>


<dtml-if "SESSION['hasCredit']">
<a hRef="somewhere ...
< hRef="somewhereelse">

In Python: (and TAL macros)

  if context.REQUEST.SESSION['hasCredit']:
return container.Images.macros['allImages'] else return container.Images.macros['someImages']

Zope maillist  -
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to