DSM

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • session-timeout-minutes value in runtime Zope

    6 answers - 354 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    This might be an FAQ but I wasn't able to find it when searching.
    How do I get access to the value of 'session-timeout-minutes' coming
    from etc/zope.conf in runtime Zope?
    My app knows when people log in. I want the app to say "You'll be
    securely logged in for another 25 minutes unless you log out or log in
    again".
  • No.1 | | 822 bytes | |

    1/23/07, Peter Bengtsson <peter (AT) fry-it (DOT) comwrote:
    This might be an FAQ but I wasn't able to find it when searching.
    How do I get access to the value of 'session-timeout-minutes' coming
    from etc/zope.conf in runtime Zope?

    The trail to figure this out:

    - ZCML directives for zope.conf are defined in
    Zope2/Startup/zopeschema.xml. It defines a 'session_timeout_minutes'
    handler.

    - Handlers are defined in Zope2/Startup/handlers.py;
    session_timeout_minutes sets the defined value as a environment
    variable: ZSESSIN_TIMEUT_MINS

    Presumably you can read out this var from os.environ for your own
    purposes; note however that I have found no mention of the ZSESSIN_
    variables outside of handlers.py, they appear to be otherwise unused.
  • No.2 | | 522 bytes | |

    Martijn Pieters wrote:
    1/23/07, Peter Bengtsson <peter (AT) fry-it (DOT) comwrote:
    >This might be an FAQ but I wasn't able to find it when searching.
    >How do I get access to the value of 'session-timeout-minutes' coming
    >from etc/zope.conf in runtime Zope?


    - Handlers are defined in Zope2/Startup/handlers.py;
    session_timeout_minutes sets the defined value as a environment
    variable: ZSESSIN_TIMEUT_MINS
    Great. I'll try that.
    Thanks!
  • No.3 | | 370 bytes | |

    To get number of zope threads from zope.conf I used this code:

    from App.config import getConfiguration
    conf = getConfiguration()
    print conf.zserver_threads

    Possibly you'll find session-timeout-minutes there too.

    BTW. AFAIR session timeout is not a precise value especially
    if you're using high value for session-resolution-seconds
  • No.4 | | 617 bytes | |

    Peter Bengtsson wrote at 2007-1-23 13:44 +0000:
    >This might be an FAQ but I wasn't able to find it when searching.
    >How do I get access to the value of 'session-timeout-minutes' coming
    >from etc/zope.conf in runtime Zope?


    The value is used to configure the so called "Session Data Manager"
    (usually "/temp_folder/session_data").

    Its management page is able to show you the value.

    This means, there is some way to access it. You can use this
    way in your own application (you might need a proxy role to
    get sufficient privileges).
  • No.5 | | 1472 bytes | |

    I don't know if this is what you want. If you want to have access, in
    your code, to the session-timeout-minutes variable, you can try this
    methode on your session_data_manager object :

    getTimeoutMinutes(self):

    Return the number of minutes allowed for subobject inactivity before
    expiration. PermissionView management screens

    This is from the api documentation of TransientContainer class, found
    in the help link in the ZMI of

    In your code, you can use something like :
    <tal code>
    you'll be
    securely logged in for another <span tal:replace="python
    () "></span>
    minutes unless you log out or log in
    again".
    </tal>

    Y.Chaouche

    2007/1/23, Dieter Maurer <dieter (AT) handshake (DOT) de>:
    Peter Bengtsson wrote at 2007-1-23 13:44 +0000:
    >This might be an FAQ but I wasn't able to find it when searching.
    >How do I get access to the value of 'session-timeout-minutes' coming
    >from etc/zope.conf in runtime Zope?
    >

    The value is used to configure the so called "Session Data Manager"
    (usually "/temp_folder/session_data").

    Its management page is able to show you the value.

    This means, there is some way to access it. You can use this
    way in your own application (you might need a proxy role to
    get sufficient privileges).
    >
    >
    >
  • No.6 | | 2546 bytes | |

    Thanks but I solved it using::

    from App.config import getConfiguration
    conf = getConfiguration()
    setattr(MyProductClass, 'SESSIN_TIMEUT_MINUTES',
    conf.session_timeout_minutes)

    Now I can use this::

    class MyProductClass:
    def getLoggedInSecurelyMinutesLeft(self):
    """ return how many minutes there is left on the securely
    logged in session. """
    ts = self.get_session(, None)
    if ts is None:
    return 0
    minutes = self.SESSIN_TIMEUT_MINUTES - (time.time() - ts) / 60
    return int(minutes)

    yacine chaouche wrote:
    I don't know if this is what you want. If you want to have access, in
    your code, to the session-timeout-minutes variable, you can try this
    methode on your session_data_manager object :

    getTimeoutMinutes(self):

    Return the number of minutes allowed for subobject inactivity before
    expiration. PermissionView management screens

    This is from the api documentation of TransientContainer class, found
    in the help link in the ZMI of

    In your code, you can use something like :
    <tal code>
    you'll be
    securely logged in for another <span tal:replace="python
    () "></span>
    minutes unless you log out or log in
    again".
    </tal>

    Y.Chaouche

    2007/1/23, Dieter Maurer <dieter (AT) handshake (DOT) de>:
    >Peter Bengtsson wrote at 2007-1-23 13:44 +0000:
    >>This might be an FAQ but I wasn't able to find it when searching.
    >>How do I get access to the value of 'session-timeout-minutes' coming
    >>from etc/zope.conf in runtime Zope?
    >>

    >The value is used to configure the so called "Session Data Manager"
    >(usually "/temp_folder/session_data").
    >>

    >Its management page is able to show you the value.
    >>

    >This means, there is some way to access it. You can use this
    >way in your own application (you might need a proxy role to
    >get sufficient privileges).
    >>
    >>
    >>

    >--
    >Dieter
    >
    >Zope maillist - Zope (AT) zope (DOT) org
    >
    >** No cross posts or HTML encoding! **
    >(Related lists -
    >
    >)
    >>


    Zope maillist - Zope (AT) zope (DOT) org

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

Re: session-timeout-minutes value in runtime Zope


max 4000 letters.
Your nickname that display:
In order to stop the spam: 4 + 4 =
QUESTION ON "DSM"

EMSDN.COM