On Mon, 18 Oct 2010 02:09:16 -0700 (PDT)
Ivanov Dmitriy <[email protected]> wrote:

> I decided to store the DB in an external file, called files.txt in
> JSON format.
> 

[code snipped]

Couldn't see where in the code you read the info. in, so it seemed you were 
just overwriting the info. each time - was that the intent?

Given a Leo node `nd` you can read and write JSON to it with:

  files = json.loads(nd.b)

  and

  nd.b = json.dumps(files)

  (loads and dumps are the *s*tring versions of their file counterparts)

Minor picky thing, built in open() returns a python file object, not a 
operating system file-handle, so calling it 'FH' potentially confusing.  
os.open() returns file handles, I think, but you probably need python file 
objects or at least something with a .write() method, so your code's correct 
but the name's odd.

Cheers -Terry

> --------------------------------------------------------------------------
> I wrote the module in leo - does anybody know, how to attach the file
> here? And is it possible to store files.txt contents inside a leo
> node, so I won't need to have a separate file with each leo file?
> --------------------------------------------------------------------------
> files.txt:
> 
> [
> ['d:/www/dubai/modules/file1.pm', 'host.ru/cgi-bin/modules/file1.pm',
> 1287345652.84375],
> ['d:/www/dubai/modules/file2.pm', 'host.ru/cgi-bin/modules/file2.pm',
> 1287392182.886375],
> ]
> 

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.

Reply via email to