newbie help ? - thanks as i though crash stoopidity

Duncan Booth duncan at NOSPAMrcp.co.uk
Fri May 16 05:33:31 EDT 2003


"Beanie" <nospam at diving.ukdiver.com> wrote in
news:J12xa.20$i_5.8 at news-binary.blueyonder.co.uk: 

> so the script works or i assume it would if zope had the open function
> -its been removed for security reason :(
> 
> Error Type
> NameError
> Error Value
> global name 'open' is not defined
> 
> ta

Write an external method to encapsulate the file access. An external method 
doesn't have security restrictions.

However, think very, very carefully before you do this. Your method doesn't 
have any code to allow for multiple simultaneous accesses. If you store 
data in an external file you must assume that multiple copies of the code 
can be running at the same time and explicitly handle this. If you store 
your data in the ZODB instead, then Zope will automatically detect if two 
threads try to update the same piece of data and automatically retry one of 
them, so most of the time you can get away without explicitly coding for 
multi threading.

-- 
Duncan Booth                                             duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?




More information about the Python-list mailing list