Problem solved: The class _is_ overridden when i subclass my theme layer
marker interface from IDefaultPloneLayer (instead of zope.interface.Interface),
like so:

from plone.theme.interfaces import IDefaultPloneLayer

class IPloneInvitePolicy(IDefaultPloneLayer):
    """ A marker interface for the theme layer """

Kees


Kees Hink wrote:
> It turns out the view class for plone.app.form's '@@register' form isn't
> overridden. I have this in my browser/configure.zcml:
>     <browser:page
>       name="register"
>       for="Products.CMFPlone.Portal.PloneSite"
>       class=".register.InviteRegistrationForm"
>       permission="zope.Public"
>       layer="..interfaces.IPloneInvitePolicy"
>       />
> When i change name="register" to name="xregister" in browser/configure.zcml,
> the code _is_ run.
> 
> How can i override the "register" view class? I googled around for it, but
> found nothing that works. One of the things i tried was registering
> "@@register" in an "overrides.zcml" file. The code is picked up Zope won't
> start if i put a syntax error in it), but that's all.
> 
> Kees
> 
> Kees Hink wrote:
>> I'm trying to modify Plone 4's registration form in a product. The new
>> plone.app.users layout in Plone 4 should make it possible to do this in a
>> non-intrusive way to do this. (This is a part of porting Products.PloneInvite
>> to Plone 4,
>> https://svn.plone.org/svn/collective/Products.PloneInvite/branches/plone4_RegistrationForm.
>> The previous version had an overridden join_form in the skin templates.)
>>
>> My plan is to do the following:
>>  - register a new browser layer
>>  - for this layer, override plone.app.users' RegistrationForm
>>  - InviteRegistrationForm subclasses RegistrationForm and modifies:
>>    * form_fields method:
>>      o appends 'invite_code' to super class's
>>    * validate_registration:
>>      o first checks if 'invite_code' is valid
>>      o then executes super class's validate_registration
>>
>> Q1. Is this a good approach? Any other suggestions?
>>
>> Currently the form class's form_fields method (decorated with '@property') is
>> not being modified. I have:
>>
>>>     print "this is printed"
>>>     @property
>>>     def form_fields(self):
>>>         defaultFields = super(InviteeRegistrationForm, self).form_fields
>>>         print "this is not"
>>>         return defaultFields
>> Code inside the class is executed (once, at startup), but code inside the
>> method is never run.
>>
>> Q2. How can i override the super class's method?
>>
>> Kees

_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers

Reply via email to