How to export Plone session configuration?

I would like to export my Plone session configuration to my portal product.

Session configuration is set using ZMI -> acl-users -> session -> properties

I tried to create a snapshot of the site but cannot find the session configuration in the xml snapshot ...

+5
source share
1 answer

Indeed, support for GenericSetup support is not included in plone.session; There is currently nothing that will export it for you, and nothing to import settings.

Instead, you will need to write a configuration step for it and manually configure the session plugin.

Add the import step to the configuration file configure.zcml:

<?xml version="1.0"?>
<configure
    xmlns="http://namespaces.zope.org/zope"
    xmlns:genericsetup="http://namespaces.zope.org/genericsetup"

<genericsetup:importStep
    name="yourpackage.a_unique_id_for_your_step"
    title="Configures the plone.session plugin"
    description="Perhaps an optional description"
    handler="your.package.setuphandlers.setupPloneSession"
    />

</configure>

'sentinel' youpackage.setup-plonesession.txt

setuphandlers.py ( handler ):

def setupPloneSession(context):
    if context.readDataFile('youpackage.setup-plonesession.txt') is None:
        return

    portal = context.getSite()
    plugin = portal.acl_users.session

    # Configure the plugin manually
    plugin.path = '/'
    plugin.cookie_name = '__ac'
    plugin.cookie_domain = ''

    # Set up a shared auth_tkt secret
    plugin._shared_secret = 'YourSharedSecretKey'
    plugin.mod_auth_tkt = True

, , -; , , .

, , , .

+4

All Articles