Schema Extension to IPayable

10 views
Skip to first unread message

kevin gill

unread,
Mar 11, 2011, 5:12:15 PM3/11/11
to getpaid-dev
Hi,

I am finding myself extending IPayable.(To add vat codes to
products).

I have forked the getpaid.core.interfaces code base to add the code I
want into the base class. This obviously causes long term problems.

Is there a schema extension approach I should be using?

This is probably a generic Plone issue. I am not a very experienced
Plone user.

Thanks,

Kevin

Darryl Dixon

unread,
Mar 11, 2011, 7:06:42 PM3/11/11
to getpa...@googlegroups.com

Sub-class the interface.

D


--
GetPaid for Plone: http://www.plonegetpaid.com (overview info) | http://code.google.com/p/getpaid (code and issue tracker)
You received this message because you are subscribed to the Google Groups "getpaid-dev" group.
To post to this group, send email to getpa...@googlegroups.com
To unsubscribe from this group, send email to getpaid-dev...@googlegroups.com

For more options, visit this group at
http://groups.google.com/group/getpaid-dev?hl=en?hl=en

kevin gill

unread,
Mar 12, 2011, 3:37:28 AM3/12/11
to getpaid-dev


On Mar 12, 12:06 am, Darryl Dixon <darryl.di...@gmail.com> wrote:
> Sub-class the interface.

Sublcassing isn't a solution in my case because I want to write a
plugin. Any other user extension or plugin would also sub-class the
base class and so only one set of extensions would be available.

Subclassing also leads me to having to sub-class the sub-classed
interfaces and the adapters and the viewlets - basically everything
using the interface.


Directly extending the interface from an external piece of code works
to a point.

from getpaid.core.interfaces import IPayable
from zope import schema
IPayable.vat_method=schema.Choice(title=u'VAT Method', values=[u'A',
u'B'])

The view "fields" are initialised when the class is declared, not when
the views are created, i.e. the following element is ignored by @@edit-
payable. I have to apply the same logic to the classes, i.e. import
edit-payable and re-initialise the fields.

This patching approach would work. However, I hope there is something
cleaner.

Kevin

>
> D
>
> On 12/03/2011 11:12 AM, "kevin gill" <movieextras.ke...@gmail.com> wrote:
>
> Hi,
>
> I am finding myself extending IPayable.(To add vat codes to
> products).
>
> I have forked the getpaid.core.interfaces code base to add the code I
> want into the base class. This obviously causes long term problems.
>
> Is there a schema extension approach I should be using?
>
> This is probably a generic Plone issue. I am not a very experienced
> Plone user.
>
> Thanks,
>
> Kevin
>
> --
> GetPaid for Plone:http://www.plonegetpaid.com(overview info) |http://code.google.com/p/getpaid(code and issue tracker)
Reply all
Reply to author
Forward
0 new messages