Re: [Zope] Avoiding page redirects from TAL

2009-03-09 Thread Andrew Milton
+---[ Analog Kid ]--
| Hi All:
| 
| I have a customized page template product which subclasses from
| ZopePageTemplate. In this product class, I have a method that redirects to a
| certain fixed page that I have created in the ZMI. One of the objects of this
| type makes calls to this method and also has some conditional redirects (based
| on certain request variables). Here is a representation
| 
| In my Product class, I have a method which conditionally redirects ...
| 
| def check_and_redirect(self):
| request = self.REQUEST
| if request.get('redirect_to_fixed_page', False):
| request.RESPONSE.redirect('http://somefixedurl_in_my_domain')
| 
| def getValue(self):
| self.check_and_redirect()
| # do some more stuff
| 
| 
| return 'some value'
| 
| My ZPT looks like this ...
| ...
| 
| ...
| ...
| ...
| ...
| 
| 
| 
| ...
| ...
| ...
| 
| 
| What is happeninig is that the redirect in the PT is taking precedence over my
| redirect (which Im doing in the method). My question is: Can I make sure that
| my redirect takes precedence without modifying the PT itself. Is there any
| other ZopePageTemplate method which I can patch so that my own redirect kicks
| in first??

add a flag to getValue that says don't redirect

def getValue(self, redirect = False):
   if(redirect):
   self.check_and_redirect()

or pass it up to check_and_redirect

Which means you have to change other calls that aren't in the ZPT
If you're happy to change the one ZPT, you can reverse the flag to be
True and pass False in from the ZPT.

It depends which way is more work.

You'll also find that doing a redirect and then adding more stuff to the
response will cause the redirect to "not work" under certain browsers
under certain conditions. It's best to terminate processing as soon as
possible when you decide to redirect, so it's probably unwise to
redirect without returning some status to the caller than indicates the
rest of the processing is redundant.

-- 
Andrew Milton
a...@theinternet.com.au
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Avoiding page redirects from TAL

2009-03-09 Thread Analog Kid
Hi All:

I have a customized page template product which subclasses from
ZopePageTemplate. In this product class, I have a method that redirects to a
certain fixed page that I have created in the ZMI. One of the objects of
this type makes calls to this method and also has some conditional redirects
(based on certain request variables). Here is a representation

In my Product class, I have a method which conditionally redirects ...

def check_and_redirect(self):
request = self.REQUEST
if request.get('redirect_to_fixed_page', False):
request.RESPONSE.redirect('http://somefixedurl_in_my_domain')

def getValue(self):
self.check_and_redirect()
# do some more stuff


return 'some value'

My ZPT looks like this ...
...

...
...
...
...

http://someotherurl";)"/>

...
...
...


What is happeninig is that the redirect in the PT is taking precedence over
my redirect (which Im doing in the method). My question is: Can I make sure
that my redirect takes precedence without modifying the PT itself. Is there
any other ZopePageTemplate method which I can patch so that my own redirect
kicks in first??

Thanks for you time and help.

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


Re: [Zope] timeout on a page

2009-03-09 Thread Lennart Regebro
On Mon, Mar 9, 2009 at 15:36, Dvir Bar-lev  wrote:
> Any ideas how I can do this 2 things?

Set and check access times in the session.

-- 
Lennart Regebro: Pythonista, Barista, Notsotrista.
http://regebro.wordpress.com/
+33 661 58 14 64
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] timeout on a page

2009-03-09 Thread Andrew Milton
+---[ Dvir Bar-lev ]--
| Hi all.
| 
|  
| 
| First of all let me say that I found the solution to my user roles problems by
| using the  coockiecrumbler plugin,  so that?s behind me now J

Goodo.

| I need help with something else, I will explain what I want to accomplish:

[snip]

| Any ideas how I can do this 2 things?

Do some reading, or advertise for a competent zope coder.

I'm all for helping people, but, you don't seem to be doing the minimum
amount of preparation before asking for help.

-- 
Andrew Milton
a...@theinternet.com.au
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] timeout on a page

2009-03-09 Thread Dvir Bar-lev
Hi all.

 

First of all let me say that I found the solution to my user roles
problems by using the  coockiecrumbler plugin,  so that's behind me now
J

 

I need help with something else, I will explain what I want to
accomplish:

 

I have a page ( well call it Page a), the user gets to  page a and from
there goes to another page, now he returns to the page a,

What I want to happen is this, I he returned to page a before 3 minutes
passed from the last time I want to to redirect him to another page,

If more than 3 minutes passed than he will see page a again.

 

The 2nd thing I need is this:

The user entered my site, lets say he browsed the site and now is just
staying in some page there and went off, and he forgot to log off my
site,

What I want is that lets say the after 3 minutes of inactivity from his
part while hes on my site I want to automatically log him off, meaning I
will redirect him to the home page and reset his status.

 

Any ideas how I can do this 2 things?

 

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


Re: [Zope] fstest reports time-stamp reduction, what does it mean and should I be worried?

2009-03-09 Thread Dieter Maurer
Chris Withers wrote at 2009-3-8 12:26 +:
>Nope, Zope 2.9.8.
>
>> In older ZODB versions, this should happen when your clock
>> jumped back into the past.
>
>The clocks on both the storage servers are NTP synched and I'm pretty 
>sure they've not jumped back at any point...

Another (more serious) cause can be a corruption of the storage file.
The timestamp is part of the file data -- it the data changes,
the timestamps may seem to be out of order.



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