Q: Product adding Properties and Objects
Is there any special syntax for a Zope Product (not a ZClass) to add, say, a File object? context.manage_addFile(id=file_id, file=file, title=title, content_type='application/msword') ..doesn't work. Zope complained about "context". I have seen code that, for a DTML Document, uses "ob = DTMLDocument(data, __name__ = id). Unfortunately, I don't know the corresponding syntax for a File object. Any hints? TIA, Ron
+-------[ complaw@hal-pc.org ]---------------------- | Is there any special syntax for a Zope Product (not a ZClass) to add, say, a | File object? | | context.manage_addFile(id=file_id, file=file, title=title, | content_type='application/msword') | | ..doesn't work. Zope complained about "context". s/context/self/ assuming you can acquire a manage_addFile method. You might have to import it and put it into your product so you've got one. -- Totally Holistic Enterprises Internet| | Andrew Milton The Internet (Aust) Pty Ltd | | ACN: 082 081 472 ABN: 83 082 081 472 | M:+61 416 022 411 | Carpe Daemon PO Box 837 Indooroopilly QLD 4068 |akm@theinternet.com.au|
Andrew, thanks for the tip. The answer is: from OFS.Image import File ...then... self.manage_addFile(id=file_id, file=file, title=title, content_type='application/msword') That works. Cheers, Ron Andrew Kenneth Milton wrote:
+-------[ complaw@hal-pc.org ]---------------------- | Is there any special syntax for a Zope Product (not a ZClass) to add, say, a | File object? | | context.manage_addFile(id=file_id, file=file, title=title, | content_type='application/msword') | | ..doesn't work. Zope complained about "context".
s/context/self/
assuming you can acquire a manage_addFile method. You might have to import it and put it into your product so you've got one.
-- Totally Holistic Enterprises Internet| | Andrew Milton The Internet (Aust) Pty Ltd | | ACN: 082 081 472 ABN: 83 082 081 472 | M:+61 416 022 411 | Carpe Daemon PO Box 837 Indooroopilly QLD 4068 |akm@theinternet.com.au|
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (3)
-
Andrew Kenneth Milton -
complaw@hal-pc.org -
Ronald L. Chichester