[Zope] flat file db, favorite links, and zope

sean@horse101.com sean@horse101.com
Wed, 20 Sep 2000 17:18:01 -0700


Dieter,
Thanks for the information.  I created a test db file and followed the 
zope external methods how-to, but when I went to create the 
external method I received a syntax error.  Is there something 
wrong with your syntax, or how I am doing it?  (Also, if my db file 
was a semi-colon delimited file it looks like I would replace the ',' 
portion with ':' right?  I really must pick up a python book!)
Here is the code (.py file) and the test db file:

py file:
import string

	def importCommaSeparatedFile(testdb.db):
	  """returns list of items in comma separated 
file with name *filename*."""
	  return 
string.split(open(testdb.db).read(),',')

testdb.db file:

run,sean,dogs
walk,joe,cats
sprint,ted,camel


On 21 Sep 2000, at 0:33, Dieter Maurer wrote:

> sean@horse101.com writes:
>  > I have a comma delimited file ...
>  > ...  If so, does one of them allow me to use 
>  > my existing db file (at least import it)?
> There will be no problem to import your file.
> 
> The following external method imports the file
> and returns the list of its elements.
> This list can then be processed with "dtml-in":
> 
> 	import string
> 
> 	def importCommaSeparatedFile(filename):
> 	  """returns list of items in comma separated file with name *filename*."""
> 	  return string.split(open(filename).read(),',')
> 
> 
> To do the whole work, you have to learn something about
> Zope, external methods, "dtml-in" and maybe Z SQL methods
> (if your links go into a relational database).
> 
> You will have to do some homework.
> 
> 
> Dieter
>