Personal tools
You are here: Home Lists ZPUG DC List Archives 2005 2005-04 Python/Plone question / David Diskin <david.diskin@verizon.net>
Navigation
Log in


Forgot your password?
New user?
Mailing Lists
You can read our ZPUGDC mailing list archives online.
You can subscribe to our mailing list:
Book Review

The Definitive Guide to Plone

Reviewer: joel
 

Python/Plone question / David Diskin <david.diskin@verizon.net>

Python/Plone question
David Diskin <david.diskin(at)verizon.net>
2005-04-09 16:43:06 [ FULL ]
hi everyone,

I'm very much a newbie in Python.  I'm trying to run a modified version 
of the "import_users_with_groups" script from McKay's book.  I add an 
external method in /custom in the ZMI and test there.  I got it to sort 
of work, but not exactly as I want.  I've attached 2 versions.  Version 
4 does not run at all as I get an error message which is mysterious to 
me.  This is the error: file object has no attribute writeLines.  I 
thought a file object does indeed have this method.

Version 5 runs correctly except that (1) there is no outFile produced 
although the results are returned to my ZMI test window, but without 
new lines for each person.

any help is greatly appreciated.
Attachments: 
import_users_v4.py application/octet-stream - 1612 Bytes
import_users_v5.py application/octet-stream - 1655 Bytes

Re: [ZPUGDC] Python/Plone question / Jules <jules@jules.com>

Re: [ZPUGDC] Python/Plone question
Jules <jules(at)jules.com>
2005-04-11 06:36:24 [ FULL ]
Morning, David.

It's 'writelines' not 'writeLines'. Also, specify a path to a writable 
directory for your out file. It'll probably work on Windows but Unix 
it's good practice to write this throwaway stuff to, say, /tmp/.

     outFile = open('/tmp/membersCreated','w')

Do these things and the script works -- at least on OS X a moment ago.

Cheers,
Jules

On Apr 9, 2005, at 5:57 PM, David Diskin wrote:
[...]

Re: [ZPUGDC] Python/Plone question / David Diskin <david.diskin@verizon.net>

Re: [ZPUGDC] Python/Plone question
David Diskin <david.diskin(at)verizon.net>
2005-04-11 14:42:13 [ FULL ]
Afternoon, Jules.

Thanks much for your help on this.  I had some computer problems  
earlier today and just got around to trying your suggestion.  It works  
fine.

David


On Apr 11, 2005, at 7:50 AM, Jules wrote:
[...][...][...]
==============================
David Diskin, david.diskin(at)verizon.net

Powered by Plone, the Open Source Content Management System

This site conforms to the following standards: