[Zope3-Users] Re: zope.schema Question
Tim Cook
timothywayne.cook at gmail.com
Mon Jul 7 11:41:41 EDT 2008
On Mon, 2008-07-07 at 16:55 +0200, Philipp von Weitershausen wrote:
> What does ItemTree.items field have to do with Activity.description
> field? I thought we're talking about the Object(schema=IItemTree) field
> inside IActivity here?
An ItemTree instance is what is being assigned to Activity.description
when the error is thrown. It is the descr parameter in:
class Activity(Locatable):
"""
A single activity within an instruction.
"""
implements(IActivity)
def __init__(self,descr,tim,atid,nodeid,**kw):
self.timing=tim
self.actionArchetypeId=atid
self.__name__=nodeid
self.description=descr
for n,v in kw.items():
setattr(self,n,v)
class IActivity(ILocatable):
"""
A single activity within an instruction.
"""
description=Object(
schema=IItemStructure,
title=_(u"Description"),
description=_(u"Description of the activity."),
required=True,
)
...<the rest of the definitions>
self.description=descr was first but I moved it down just to be sure
that I wasn't making some general mistake that would occur everywhere.
class IItemTree(IItemStructure):
u"""
Logical tree data structure.
"""
items = List(
title=_(u"items"),
description=_(u"Physical representation of the tree."),
required=False
)
class ItemTree(ItemStructure):
u"""
Logical tree data structure. The tree may be empty. Used to
represent data which are
logically a tree such as audiology results, microbiology results,
biochemistry results.
"""
implements(IItemTree)
classProvides(IItemStructure)
def __init__(self,items,**kw):
self.items=items
for n,v in kw.items():
setattr(self,n,v)
The full source is at:
webview http://www.openehr.org/wsvn/ref_impl_python/?sc=0
SVN http://www.openehr.org/svn/ref_impl_python/
> > Printed it looks like this:
> >
> > [(['include', ([(['archetype_id/value', (['/disposition\\.v1draft/'],
> > {})], {})], {})], {})] <type 'list'>
>
> As you correctly stated in your own reply, this doesn't comply with the
> List() field. The List() field expects a list object with a bunch of
> unicode values in it, e.g.: [u'text', u'more text', ...].
>
Right. But when I flattened the above structure (it's parse results
from Pyparsing), did a unicode() conversion and built a new list. It
didn't change the symptoms.
[u'include', u'archetype_id/value', u'/disposition\\.v1draft/']
> > All of my source files have the unicode declaration:
> > # -*- coding: utf-8 -*- as the first line.
>
> That's not a unicode declaration, that's just the source code encoding.
> It has nothing to do with whether your objects are unicode or not.
Thanks; confirmed my understanding. I guess I'm grabbing at straws
here. :-)
I've been Googling for a script I can run against all of my source to
test characters for unicode just in case there are more of those that I
copied into title or description fields. If you think of anything let
me know. Otherwise I may have to write one.
Thanks for your attention.
--Tim
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://mail.zope.org/pipermail/zope3-users/attachments/20080707/34d1f44c/attachment.bin
More information about the Zope3-users
mailing list