[Zope3-dev] Back to Job editing
Magnus Heino
magnus.heino@pleon.sigma.se
Wed, 4 Sep 2002 07:28:40 +0200
> > Which makes a degree of sense - it's easier to protect a single 'upda=
te'
> > method than to allow direct attribute setting. But, with Schema and
> > Python 2.2+ Properties, is it still the right way?
>
> I hope the right way will change with these new things, but we're curre=
ntly
> in a phase where we're grasping around for idioms concerning this.
> The broader question is "should I make this a property or a method?".
>
> In theory properties/schema help with introspection and I think the cod=
e
> can look more readable too.
Will it be easy to extend existing types with new properties too?
Example from today;
def addCollectorIssue(self,
id,
title=3D'',
description=3D'',
submitter_id=3DNone,
submitter_name=3DNone,
submitter_email=3DNone,
kibitzers=3DNone,
topic=3DNone,
classification=3DNone,
security_related=3D0,
importance=3DNone,
version_info=3DNone,
assignees=3DNone,
file=3DNone, fileid=3DNone, filetype=3DNone,
REQUEST=3DNone):
"""Create a new issue in the collector.
We return a string indicating any errors, or None if there weren't an=
y."""
it =3D CollectorIssue(id=3Did,
container=3Dself,
title=3Dtitle,
description=3Ddescription,
submitter_id=3Dsubmitter_id,
submitter_name=3Dsubmitter_name,
submitter_email=3Dsubmitter_email,
kibitzers=3Dkibitzers,
topic=3Dtopic,
classification=3Dclassification,
security_related=3Dsecurity_related,
importance=3Dimportance,
version_info=3Dversion_info,
assignees=3Dassignees,
file=3Dfile, fileid=3Dfileid, filetype=3Dfiletype=
)
it =3D self._getOb(it.id)
got =3D it.do_action('request', description, assignees,
file, fileid, filetype)
return got
Adding a new "field" foo to a CollectorIssue isnt fun as it is today... :=
-P
--=20
/Magnus Heino