[Zope] Re: Zope QuotaFolder -- scripting API ?

Ivo van der Wijk ivo@amaze.nl
Tue, 4 Feb 2003 20:03:30 +0100


On Mon, Feb 03, 2003 at 03:16:14PM -0500, cmulcahy@avenirsolutions.com wrote:
> 
> Ivo, 
> 
> I love your QuotaFolder product and I would like to user it in a python 
> script. ( Please forgive me, I am new to zope ) 
> 
> I installed QuotaFolder and I can create new QuotaFolder objects from the 
> ZMI,
> but I would like to use it in a script like: 
> 
> try:
>   context.manage_addQuotaFolder(username,"Portfolio of %s" % 
> username,quota_bytes=10485760,quota_objects=1000,quota_maxsize=0,REQUEST=Non 
> e)
> except Exception, e:
>   print "Create folder failed : %s" % e
>   return printed 
> 
> or: 
> 
> try:
>   context.manage_addQuotaFolder(username,"Portfolio of %s" % 
> username,10485760,1000,0)
> except Exception, e:
>   print "Create folder failed in first exception: %s" % e
>   return printed 
> 
> etc. etc. 
> 
> but in every case the script fails to do anything, the 'try' fails and 
> throws an Excpetion 'e' that stringifies to "manage_addQuotaFolder" 
> 

Correct. The right way is:

container.manage_addProduct['QuotaFolder'].manage_addQuotaFolder(username,"Portfolio of %s" % username,quota_bytes=10485760,quota_objects=1000,quota_maxsize=0,REQUEST=None)

Cheers

	Ivo

-- 
Drs. I.R. van der Wijk                                      -=-              
Brouwersgracht 132                             Amaze Internet Services V.O.F.
1013 HA Amsterdam, NL                                       -=-              
T +31-20-4688336         F +31-20-4688337        Linux/Web/Zope/SQL/MMBase   
W http://www.amaze.nl    E info@amaze.nl             Network Solutions        
W http://vanderwijk.info E ivo@amaze.nl                 Consultancy          
PGP http://vanderwijk.info/pgp                              -=-