[Zope] Accessing Files within Zope?

Laurie Nason lnason@bcm.tmc.edu
Fri, 5 Jul 2002 10:48:18 -0500


I just did this with a file:
    my_file = split(file.data,'\r\n')
the .data returns the contents of the file

hth

Laurie


-----Original Message-----
From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of
Andreas Lauser
Sent: Friday, July 05, 2002 5:32 AM
To: Dianne Van Dulken
Cc: zope@zope.org
Subject: Re: [Zope] Accessing Files within Zope?


On Friday 05 July 2002 06:58, Dianne Van Dulken wrote:
> Hi all,
>
> I have just set up a folder which is designed to contain details of all
our
> users.  I've set up a ZClass for these users.
>
> The problem I am having is the transferance from our old system to our new
> one.  I have a file containing all the email addresses of the old users
> (which is all I need initially), one per line, and want to write a script
> that steps through this file and processes the users into the Zope
> interface.
>
> The problem I am having is that I am finding it impossible to actually
open
> the file within zope so you can actually use it.  I've tried scripting
with
>
> filein = open(file)

Write an external method or load the file into the zope database via the
management screens.

> I've tried it in Zope methods with
>
> "<dtml-in "_.getitem(file).split('\n')">
>
> But that assumes it is a string (I admit, it was wishful thinking when I
> tried that).
>
> Does anyone know of a way to read a text file, contained in zope, and step
> through it?  I've looked in the archives, and not found a way.

save that file as DTML-Document, not as file. then you can achieve what you
intent with  <dtml-in "nameOfYourDataObject().split('\n')">

mfg
  AND

--
I doubt, therefore I might be.



_______________________________________________
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 )