[Dev] How to fill in a Text attribute

Andi Vajda vajda at osafoundation.org
Fri Apr 23 17:32:55 PDT 2004


To create a Lob object, use the Text or Binary type's makeValue()
factory method.

The Text type is at: rep.find('//Schema/Core/Text')
The Binary type is at: rep.find('//Schema/Core/Binary')

For more information about the makeValue() method, please see the source
(until I add epydoc for this file) at repository/schema/Types.py, looking for
the Text and Binary classes.

Andi..

On Fri, 23 Apr 2004, Jeffrey Harris wrote:

> Hi Folks,
>
> I just committed code that reads a mapping from an XML dialect to
> describe how external data should be imported into Chandler.  The Test
> -> Import Contacts from Outlook CSV menu item should act exactly the
> same, but the machinery's a little different now.
>
> As I import data, I need to create Text Lobs.  I don't exactly
> understand how to do this.
>
> There's code in the repository unit tests that illuminates the fact that
> I should use the writer API to talk to the Text Lob.  But when I try:
>
> k=rep.find("//parcels/OSAF/contentmodel/notes/Note")
> n=k.newItem(None, None)
> n.body.getWriter()
>
> it fails, because n.body is empty.
>
> If I do n.body=repository.utils.Lob.Text(), then I can write to it, but
> when I commit the repository, it won't allow repository.utils.Lob.Text
> instances for the body Attribute.
>
> I'm sure I'm missing something obvious, please enlighten me!
>
> Sincerely,
> Jeffrey
>


More information about the Dev mailing list