Re: [Zope-CMF] GenericSetup and PluggableAuthService

2009-12-30 Thread Jens Vagelpohl
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Wichert Akkerman wrote:
 On 2009-12-30 15:06, Jens Vagelpohl wrote:
 Separate note: On the Import tab I see a dropdown of extension
 profiles to select. Changing the selection here never affects the list
 of available import steps, though. This is confusing to me, but I may
 have misunderstood the purpose.
 
 The list of import steps is global and not per-profile, so that is 
 expected behaviour. For most profiles only a few import steps do any 
 real work, but the setup tool has no way to detect that so all steps are 
 always listed.

The reason I thought this list of steps may (should?) change is that for
example the PluggableAuthService profiles (both of which are BASE
profiles) explicitly define what steps they provide with an
import_steps.xml and export_steps.xml file. My assumption was that if
you have one of the PAS profiles set as the baseline profile, and then
select Current base profile on the Import tab, then the list of steps
would reflect what the PAS profile import_steps.xml contains.

jens

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.8 (Darwin)

iEYEARECAAYFAks7ZTIACgkQRAx5nvEhZLJzJACeJlR4VP+XWDlDPR3Nt0FAXeIv
3icAn2nkWOVV+vou8H7xDE7EDB89xfUv
=0wEG
-END PGP SIGNATURE-
___
Zope-CMF maillist  -  Zope-CMF@zope.org
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


Re: [Zope-CMF] GenericSetup and PluggableAuthService

2009-12-30 Thread Wichert Akkerman
On 2009-12-30 15:35, Jens Vagelpohl wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Wichert Akkerman wrote:
 On 2009-12-30 15:06, Jens Vagelpohl wrote:
 Separate note: On the Import tab I see a dropdown of extension
 profiles to select. Changing the selection here never affects the list
 of available import steps, though. This is confusing to me, but I may
 have misunderstood the purpose.

 The list of import steps is global and not per-profile, so that is
 expected behaviour. For most profiles only a few import steps do any
 real work, but the setup tool has no way to detect that so all steps are
 always listed.

 The reason I thought this list of steps may (should?) change is that for
 example the PluggableAuthService profiles (both of which are BASE
 profiles) explicitly define what steps they provide with an
 import_steps.xml and export_steps.xml file. My assumption was that if
 you have one of the PAS profiles set as the baseline profile, and then
 select Current base profile on the Import tab, then the list of steps
 would reflect what the PAS profile import_steps.xml contains.

import_steps.xml and export_steps.xml were deprecated a while ago since 
they caused very confusing behaviour: they were loaded when a profile 
was activated, but they were loaded into a global registry of known 
steps. The result was that the list of steps could randomly change 
depending on which profiles you had looked at in the ZMI. In order to 
simplify things those two files were replaced with zcml directives.

I am wondering if the CMFCore import/export steps are registered for 
Interface instead of ISiteRoot? You should only see steps that are 
registered for the current context, and since a PAS user folder is not 
an ISiteRoot the CMF import and export steps should not show up or be run.

Wichert.

-- 
Wichert Akkerman wich...@wiggy.net   It is simple to make things.
http://www.wiggy.net/  It is hard to make things simple.
___
Zope-CMF maillist  -  Zope-CMF@zope.org
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


Re: [Zope-CMF] GenericSetup and PluggableAuthService

2009-12-30 Thread Hanno Schlichting
On Wed, Dec 30, 2009 at 4:19 PM, Jens Vagelpohl j...@dataflake.org wrote:
 In the debugger I see that the object in question is a absolute_url
 adapter residing in the base component registry in the site root. IMHO
 the components exporter should not look at the base registry at all,
 only a local registry if one exists in the folder the tool sits in. Correct?

Right. As you noticed nobody ever tried to use GS outside a CMF/Plone context :)

The code in question does a:

sm = getSiteManager(context.getSite())

That will get the nearest site manager, which in case of CMF will
always be the one in the CMF site root.

What you want is probably something like this:

from zope.component.interfaces import ComponentLookupError
from zope.component.interfaces import IComponentRegistry
from zope.location.interfaces import IPossibleSite

def importComponentRegistry(context):
Import local components.

# context is the portal_setup tool
# getSite is GS API to get the parent
site = context.getSite()
sm = None
if IPossibleSite.providedBy(site):
# All object managers are an IPossibleSite, but this
# defines the getSiteManager method to be available
try:
sm = site.getSiteManager()
except ComponentLookupError:
sm = None

if sm is None or not IComponentRegistry.providedBy(sm):
logger = context.getLogger('componentregistry')
logger.info(Can not register components, as no registry was found.)
return

importer = queryMultiAdapter((sm, context), IBody)
if importer:
body = context.readDataFile('componentregistry.xml')
if body is not None:
importer.body = body


And then adjust exportComponentRegistry in a similar way. This is
untested code :)

Hanno
___
Zope-CMF maillist  -  Zope-CMF@zope.org
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests