[Zope] Programmatically adding LocalFS objects
abg@comco-inc.com
abg@comco-inc.com
Fri, 1 Mar 2002 11:28:15 -0600
Solved my own problem...
Create the following External Method:
<code>
from Products.LocalFS.LocalFS import LocalFS
from Products.LocalFS.LocalFS import manage_addLocalFS
def addLocalFSInstance(self, id, path):
ob = LocalFS('file_attachments', '', path, None, None)
ob.id = id
self._setObject(id, ob)
</code>
To call it via DTML:
<dtml-call "addLocalFSInstance('foobar', 'C:/foobar/')">
Aaron Gillette
abg@comco-inc.com
> I'm sure there's an easy fix for this one, but I sure can't find it.
> According to LocalFS' source, this should add a LocalFS to the ZODB:
>
> <dtml-call "manage_addLocalFS('name', 'title', 'basepath')">
>
> It doesn't work. Here's the error:
>
> Error Type: NameError
> Error Value: global name 'manage_addLocalFS' is not defined
>
> I've searched the message boards and found users with the
> same problem, but
> no posted solutions.
>
> Thanks In Advance,
>
> Aaron