[Zope] Executing a text file as a ZPT from a product

2009-05-03 Thread Jakob Schou Jensen
Im am writing a product and would like to include ZPT's as part of the
product. Is there a way that I can evaluate a piece of text (preferrably
stored as a text file in the product folder) as a ZPT?

Thanks,

Jakob Schou Jensen
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Touching an object / updating the modification time

2009-03-27 Thread Jakob Schou Jensen
Is it possible to update the modification time of an object (in this case an
Image object)?

(I need to do this from a python script)

Thanks,

Jakob
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Changing the error page

2009-01-17 Thread Jakob Schou Jensen
How do I change the standard error page that is displayed when zope
encounters an error?

Thanks,

Jakob
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] webdav upload - controlling type, hook

2008-10-11 Thread Jakob Schou Jensen
Thanks Tres,

The PUT_factory works fine for controlling the upload type. In addition to
this I need a hook that gets called whenever a document is created OR
updated (the put_factory is only called on creation). I need this hook to
update some derived/cached data. Is there any way to do this?

Jakob

2008/9/25 Tres Seaver [EMAIL PROTECTED]



 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Jakob Schou Jensen wrote:
  When uploading a file to the zope db using the webdav interface zope
 select
  on object type based on the file contents (or extension?). For instance
 when
  I upload a html file it becomes a DTML document. Is there any way to
 control
  what type of object is selected?
 
  Additionally I would like to execute some script code after a webdav
 upload.
  Is there any way to get a hook or callback or something similar?

 You need to implement the 'PUT_factory' hook for your container:

  http://wiki.zope.org/zope2/PUTFactory


 Tres.
 - --
 ===
 Tres Seaver  +1 540-429-0999  [EMAIL PROTECTED]
 Palladion Software   Excellence by Designhttp://palladion.com
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.6 (GNU/Linux)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

 iD8DBQFI2+lV+gerLs4ltQ4RAkEAAJ9vdWXskaVEB4IJAjFnxJc9HQ7K8ACgiCBy
 7oWAtfQCkvyVKHfQ3B6NQzA=
 =uAf+
 -END PGP SIGNATURE-


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] webdav upload - controlling type, hook

2008-09-25 Thread Jakob Schou Jensen
When uploading a file to the zope db using the webdav interface zope select
on object type based on the file contents (or extension?). For instance when
I upload a html file it becomes a DTML document. Is there any way to control
what type of object is selected?

Additionally I would like to execute some script code after a webdav upload.
Is there any way to get a hook or callback or something similar?

Thanks,

Jakob
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] How do I write to a text file from Python?

2008-09-09 Thread Jakob Schou Jensen
Hi Dieter,

Where is the 'manage_upload' function documented?

The problem that I had with manage_addFile seems to because I passed it a
unicode object rather than a string. The error message was *'unicode'
object has no attribute 'seek'* which led me to think a file-like object
was needed.

Thanks,

Jakob

2008/9/2 Dieter Maurer [EMAIL PROTECTED]

 Jakob Schou Jensen wrote at 2008-9-2 09:25 +0200:
 By file object I meant the OFS.Image.File kind. I had two problems
 creating and modifying the file (at least). The first was that the
 manage_addFile() function that you mention seemed to insist on a os-file
 like object for the file parameter.

 It is ready to accept a string or a file like object
 (usually, it gets a ZPublisher.HTTPRequest.FileUpload instance).

 Appart from that I got a security error when I called the
 File.update_data()
 function.

 This is internal. The corresponding official method
 is manage_upload.

  ...
 Well ... it works ... there may be a simpler way as you suggest. If you
 have
 some sample code I would like to see it. I am using zope 2.4.something.

 In an interactive Python session (under *nix: bin/zopectl debug):

  app.manage_addProduct['OFSP'].manage_addFile('test_file',
 'test_content')
  tf=app.test_file
  str(tf)
 'test_content'

 The example shows you, that a string is accepted as file value.



 --
 Dieter

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] How do I write to a text file from Python?

2008-09-02 Thread Jakob Schou Jensen
Hi Dieter

By file object I meant the OFS.Image.File kind. I had two problems
creating and modifying the file (at least). The first was that the
manage_addFile() function that you mention seemed to insist on a os-file
like object for the file parameter. I got some kind of seek error when
trying to supply a string. But I might have done something else wrong.
Appart from that I got a security error when I called the File.update_data()
function. Using external methods I could call update_data() and import the
StringIO python module that allows creating of string based file which I
could in turn pass on to manage_addFile().

Well ... it works ... there may be a simpler way as you suggest. If you have
some sample code I would like to see it. I am using zope 2.4.something.

Thanks,

Jakob
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] How do I write to a text file from Python?

2008-08-29 Thread Jakob Schou Jensen
I would like to create a File object in the and store some text in it from a
Python script. Everything I try seems to end up in a security restriction of
some kind. Is there some obvious way that I have overlooked?

Thanks,

Jakob Schou Jensen
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )