Hi everyone, I want to create a LocalFS with a script but I get the following error: Error Type: TypeError Error Value: unsubscriptable object here's the script (thanks to Casey Duncan!): context.manage_addFolder(folderid, foldertitle) product = context[folderid].manage_addProduct['PageTemplates'] product.manage_addPageTemplate('index_html', foldertitle, file) product.manage_addProperty('onsite_only',1,'boolean') product.manage_addProperty('status','statustype','selection', 'private') # works up to here if inc_images: product.manage_addProduct['LocalFS'].manage_addLocalFS('images', 'images', '/www/doc/images') TIA Marie Robichon Web Task Force European Synchrotron Radiation Facility BP 220 38043 Grenoble Cedex France http://www.esrf.fr Tel: (33) 04 76 88 21 86 Fax: (33) 04 76 88 24 27
context.manage_addFolder(folderid, foldertitle) product = context[folderid].manage_addProduct['PageTemplates'] product.manage_addPageTemplate('index_html', foldertitle, file)
product.manage_addProperty('onsite_only',1,'boolean') product.manage_addProperty('status','statustype','selection', 'private') # works up to here if inc_images: product.manage_addProduct['LocalFS'].manage_addLocalFS('images', 'images', '/www/doc/images')
You probably want: folder = context[folderid] folder.manage_addProduct['LocalFS'].manage_addLocalFS('images', 'images', '/www/doc/images') Florent -- Florent Guillaume, Nuxeo (Paris, France) +33 1 40 33 79 87 http://nuxeo.com mailto:fg@nuxeo.com
I cannot find a correct way to use manage_addLocalFS(). I experience error with the following Python Script: new_id='3' context.manage_addFolder(new_id, 'Folder Title') folder=context[new_id] context.manage_addProduct['LocalFS'].manage_addLocalFS('id1', 'title1', '/usr/local/Zope-orl/mirror') The error is: Error Type: TypeError Error Value: unsubscriptable object Traceback (innermost last): File /usr/local/Zope-orl-new/lib/python/ZPublisher/Publish.py, line 150, in publish_module File /usr/local/Zope-orl-new/lib/python/ZPublisher/Publish.py, line 114, in publish File /usr/local/Zope-orl-new/lib/python/Zope/__init__.py, line 159, in zpublisher_exception_hook (Object: lf) File /usr/local/Zope-orl-new/lib/python/ZPublisher/Publish.py, line 98, in publish File /usr/local/Zope-orl-new/lib/python/ZPublisher/mapply.py, line 88, in mapply (Object: z) File /usr/local/Zope-orl-new/lib/python/ZPublisher/Publish.py, line 39, in call_object (Object: z) File /usr/local/Zope-orl-new/lib/python/Shared/DC/Scripts/Bindings.py, line 252, in __call__ (Object: z) File /usr/local/Zope-orl-new/lib/python/Shared/DC/Scripts/Bindings.py, line 283, in _bindAndExec (Object: z) File /usr/local/Zope-orl-new/lib/python/Products/PythonScripts/PythonScript.py, line 302, in _exec (Object: z) (Info: ({'script': <PythonScript instance at 8d89ad8>, 'context': <Folder instance at 89e1198>, 'container': <Folder instance at 89e1198>, 'traverse_subpath': []}, (), {}, None)) File Script (Python), line 8, in z File /usr/local/Zope-orl/lib/python/Products/LocalFS/LocalFS.py, line 1353, in manage_addLocalFS File /usr/local/Zope-orl-new/lib/python/App/FactoryDispatcher.py, line 104, in manage_main TypeError: (see above) -- Milos Prudek
Milos Prudek wrote at 2003-1-8 19:39 +0100:
I cannot find a correct way to use manage_addLocalFS(). ... context.manage_addProduct['LocalFS'].manage_addLocalFS('id1', 'title1', '/usr/local/Zope-orl/mirror') ... 1353, in manage_addLocalFS File /usr/local/Zope-orl-new/lib/python/App/FactoryDispatcher.py, line 104, in manage_main TypeError: (see above) Line 104 od "FactoryDispatcher" looks like:
REQUEST['RESPONSE'].redirect(self.DestinationURL()+d) This means, the unsubscriptable object is "REQUEST". Apparently "manage_addLocalFS" need a "REQUEST" object and has a default value of "None" (which is unsubscriptable). Pass in a valid REQUEST argument. Dieter
Thank you for trying to help me. OK, I probably do not know how to pass REQUEST. This is what I tried: new_id='3' context.manage_addFolder(new_id, 'Folder Title') folder=context[new_id] context.manage_addProduct['LocalFS'].manage_addLocalFS('id1', 'title1', '/usr/local/Zope-orl/mirror',container.REQUEST) return output The same error as before appears. Error Type: TypeError, Error Value: unsubscriptable object -- Milos Prudek
participants (4)
-
Dieter Maurer -
Florent Guillaume -
Marie Robichon -
Milos Prudek