Views
Allow modules in python script
last edited 2 years ago by pf
http://www.zope.org/Control_Panel/Products/PythonScripts/Help/ModuleAccess.stx Greetings, all! How am I supposed to properly use 'import re' in a .cpy? I'm getting an "Unauthorized" security violation (it's a customized sendEmail script, but now anon users can't use it!). I have a hazy recollection of somebody (RaFromBRC ?) explaining this before, but obviously, it didn't stick! It's something about importing from outside the cpy 'sandbox' but I can't recall the solution!>? Pointers greatly appreciated! [6:11pm] RaFromBRC: peterf: there's a setting somewhere that specifies what modules are allowed in python scripts, but i don't remember where it is off-hand [6:12pm] peterf: aha. Cool. Yes, I think that's what it was! Is there a serious security problem with using 're' in a py script? [6:13pm] peterf: thanks RaFromBRC ! [6:13pm] sparcd: peterf: some things are blocked because they take a long time to execute etc [6:14pm] peterf: sparcd: ah. makes sense... [6:14pm] RaFromBRC: peterf: http://www.zope.org/Control_Panel/Products/PythonScripts/Help/ModuleAccess.stx [6:14pm] peterf: is there a more appropriate approach to dealing with regex in a script? Maybe I'm barking up the wrong tree? [6:15pm] peterf: thanks RaFromBRC.... again! [6:15pm] RaFromBRC: peterf: it's not a setting, you have to get some code to execute when zope starts that expliclitly allows the import [6:15pm] RaFromBRC: peterf: or you delegate to an external method or a tool or something that doesn't have the limitation [6:16pm] peterf: ah, ok, yes it's coming back.. Deja vu all over again. I'll get this in my wiki this time ;-) [6:18pm] peterf: cool, MyScriptModules should do that trick... Guess I still don't quite get why 're' is not included as a general rule... [6:18pm] sparcd: peterf: too Computationally Expensive [6:19pm] peterf: sparcd: as you said ;-) [6:19pm] peterf: so it's up to the developer to bite that bullet when necessary...
