oship-dev team mailing list archive
-
oship-dev team
-
Mailing list archive
-
Message #01594
[Fwd: [Bug 301226] Re: Object field validation in _field.py fails]
Hi All,
Below is a Bug Report I filed with the Zope community on 2008-11-23.
So almost 2 years after the filing they decided to mark it Invalid.
Either I didn't explain it correctly or it was fixed at some point
during this time.
I would appreciate feedback from this list since the developers here
have basically rewritten much of what I through together. Does this
problem still exist?
Thanks,
Tim
-------- Forwarded Message --------
> From: Christian Klinger <cklinger@xxxxxxxxxxx>
> Reply-to: Bug 301226 <301226@xxxxxxxxxxxxxxxxxx>
> To: timothywayne.cook@xxxxxxxxx
> Subject: [Bug 301226] Re: Object field validation in _field.py fails
> Date: Mon, 01 Nov 2010 17:24:32 -0000
>
> ** Changed in: grok
> Status: Incomplete => Invalid
>
> --
> Object field validation in _field.py fails
> https://bugs.launchpad.net/bugs/301226
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in grok: Invalid
> Status in Zope 3: Invalid
>
> Bug description:
> When a schema contains a reference via the Object field type to another schema that contains another reference to a schema via the Object field type the _validate_fields function incorrectly causes and exception at line 467 in _field.py
>
> As discussed in this thread on the mailing list.
> http://mail.zope.org/pipermail/zope3-users/2008-October/008215.html
>
> This seems to be because if errors is None it is assigned as an empty list. When the second call is made it appears to append another empty list to the outer one. Therefore the outer list is no longer empty and raises the exception.
>
> This is a show stopper for my project where we have dozens of these chains.
>
> My solution that seems to still catch a valid exception and not fail incorrectly is to change the _validate_fields function to the code below. However, I do not know if there are other ramifications with the ZCA.
>
> def _validate_fields(schema, value, errors=None):
> if errors is not None:
> #errors = []
> for name in schema.names(all=True):
> if not IMethod.providedBy(schema[name]):
> try:
> attribute = schema[name]
> if IField.providedBy(attribute):
> # validate attributes that are fields
> attribute.validate(getattr(value, name))
> except ValidationError, error:
> errors.append(error)
> except AttributeError, error:
> # property for the given name is not implemented
> errors.append(SchemaNotFullyImplemented(error))
> return errors
>
> To unsubscribe from this bug, go to:
> https://bugs.launchpad.net/grok/+bug/301226/+subscribe
--
***************************************************************
Timothy Cook, MSc
Project Lead - Multi-Level Healthcare Information Modeling
http://www.mlhim.org
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
Skype ID == timothy.cook
Academic.Edu Profile: http://uff.academia.edu/TimothyCook
You may get my Public GPG key from popular keyservers or
from this link http://timothywayne.cook.googlepages.com/home
Attachment:
signature.asc
Description: This is a digitally signed message part