On Thu, 2005-09-29 at 00:20, Chris Withers wrote:
> eep, another one, hope we're not related ;-)
When I saw your posts on newsgroups years ago, I almost gave up python
programming altogether Chris, thinking that any given field of endeavor
needs only one Withers, but decided to go ahead and chance it.

> > Can anyone tell me what the default working directory for an external
> > method is?
> You can't rely on it being anything. If you're working with files, you 
> need to be very careful...
> > Further, I need this to create a file temporarily in Extensions. 
> Why?

Because I need to feed the file to Mailman for evil purposes of my own
(well, fairly mundane purposes of allowing my zope app to manipulate
mailman list memberships, really) that the prototype mailman adapter I
found doesn't meet. And yeah, tempfile would work, although, I have to
admit I really don't see the point of it when you are only storing one
file. I am probably missing some usecase or good programming practice
here, but it seems like it saves you a single line for the delete in
return for an extra module import. 

Peter Bengtsson gave me the solution in just using the INSTANCE_HOME
variable directly, which is bound in external scripts. That beat the
daylights out of the solution that had come up wjth the help of some
folks on ICQ of using self.Control_Panel.getINSTANCE_HOME(). And Deiter
is right and it is dim to put the temporary file in Extensions and it
will be put in var instead. Not sure what I was thinking there.

John Withers 

> > I would prefer not to have to hardwire the location of Extension into the
> > code, since that would make the script non-portable to other instances 
> > easily.
> > 
> > Any advice on this would be appreciated.
> I'd suggest looking at python's tempfile module...
> Chris

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

Reply via email to