Am Freitag, den 29.07.2005, 11:39 -0400 schrieb Mark Jordan:
> Could someone explain where to store the custom validator and it's regist=
ration or what else I might be missing?
> I am running Plone 2.0.5 with Python 2.3.3 and Archetypes 1.3.1 final.
btw.: with Archetypes 1.3.4rc2 you have an ExpressionValidator, which
makes your validation tasks and so your life more funny.
> I'm having problems trying to do the same kind of comparison,=20
> but even with the simplest test validator, Plone just removes my
> Product and AT from the installation without any errors in the log,
> and with no way to restore them other than removing the new validation
> code. I get a line on the Product in the ZMI stating that the AT & my
> product have been uninstalled (that the product is "Broken"). In the
> ZMI Control_Panel/Products/Myproduct a traceback states "ImportError:
> cannot import name validation", but I am using the ivalidator (see
> below) so I'm at a loss as to why.
> I have a validator BoolMatchValidator.py
> in "C:\Program Files\Plone 2\Data\Products\validation\validators\BoolMatc=
> *****start simple ver of BoolMatchValidator.py code ******
> from Products.validation.interfaces.ivalidator import ivalidator
> from Acquisition import aq_base
> except ImportError:
> import sys, os
> sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir)=
> from interfaces.ivalidator import ivalidator
> del sys, os
> _marker =3D 
> class BoolMatchValidator:
> __implements__ =3D (ivalidator,)
> def __init__(self, name, title=3D'', description=3D''):
> self.name =3D name
> self.title =3D title or name
> self.description =3D description
> def __call__(self, value, *args, **kwargs):
> if (value =3D=3D "bool"):
> return "Validation failed"
> return 1
> in "C:\Program Files\Plone 2\Data\Products\validation\validators\__init__=
.py & Basevalidators.py & validator.py " I have ...
> "from BoolMatchValidator import BoolMatchValidator"=20
> and also in Basevalidators.py I have ...
> baseValidators =3D [
> BoolMatchValidator('isBoolMatch', title=3D'', description=3D''),
> Any help you can provide would be greatly appreciated.
> >Ok, I undesrstand!
> >Thx U!
> >On 7/21/05, Raphael Ritz <r.ritz-CrNPMedtCwFWHkni68sgO9AswbaBtrod@...=
> >> RedTurtle wrote:
> > =20
> >>>> >>Also within a validator you have access to the request and
> >>>> >>therefore all form variables. Do some introspection to
> >>>> >>see what get's passed via the kwargs.
> >>>> >Is a bad or deprecated thing using the methods pre_validate or post=
> >>> =20
> >>> >This seems to do all I need but in a simpler way...
> >> Of course! Me bad. I should have thought about that option too.
> >> The difference is that 'pre/post_validate' are defined
> >> for a content type, while digging deeper into the
> >> validator would allow you to hook this up at
> >> field level (irrespective of object type).
> >> Raphael
Klein & Partner KEG eduplone OSBN EEIG
agentur f=C3=BCr informationsmanagement founding memb=
+43 512 890077 Angerzellgasse 4 6020 Innsbruck Austria