[Zope] Product question, third posting

2000-08-18 Thread Daniel Rusch

I've created a folderish product. When I select that product from the
available objects list, thus creating an instance of that product, I can
create objects like dtml document and dtml method in the new folderish
object (very similar to what happens when you instantiate a folder
object, you can have a dtml method created in the new folder).

The question is why can't I create objects from the Products directory,
such as Local File System?


The code below works great, I get a dtml document, two folders each with
a dtml method in them
HOW CAN I CREATE A LOCAL FILE SYSTEM OR ANY OTHER OBJECT FROM THE
PRODUCTS DIRECTORY IN THIS MANAGE_ADD FUNCTION???


def manage_addSimpleSite(self, id, title='',
 createNewFolder=0,
 createEditFolder=0,
 REQUEST=None):
"""Add a new SimpleSite object with id *id*.

If the 'createNewFolder' and 'createEditFolder' parameters are set
to any true
value, an 'New sub Folder' and an 'edit sub Folder' objects are
created respectively
in the new SimpleSite.
"""
ob=SimpleSite()
ob.id=id
ob.title=title
self._setObject(id, ob)
try: user=REQUEST['AUTHENTICATED_USER']
except: user=None
ob.manage_addDTMLDocument(id='index_html', title='')
if createNewFolder:
if (user is not None) and not (
user.has_permission('Add User SimpleSites', self)):
raise 'Unauthorized', (
  'You are not authorized to add User SimpleSites.'
  )
ob.manage_addFolder(id='New'+id, title='', createPublic=1)
if createEditFolder:
if (user is not None) and not (
user.has_permission('Add Documents, Images, and Files',
self)):
raise 'Unauthorized', (
  'You are not authorized to add DTML Documents.'
  )
ob.manage_addFolder(id='Edit'+id, title='', createPublic=1)
if REQUEST is not None:
return self.manage_main(self, REQUEST, update_menu=1)


Thanks,

Dan


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] Product question

2000-08-15 Thread Loren Stafford


From: "Daniel Rusch" <[EMAIL PROTECTED]>

> I've created a product, installed it and it appears on the Product
> Management at /Control_Panel / Products list.
>
> The question is how do I get it to appear in the drop down of Available
> Objects?
>

You have to register the class it defines. If you want the class to be
subclassable by ZClasses, you also have to registerBaseClass. Here's an
example copied from the __init__.py of my Xron product:

  context.registerClass(
XronDTMLMethod.XronDTMLMethod,
permission = 'Add Scheduled Method',
constructors = (
  XronDTMLMethod.manage_addXronDTMLMethodForm,
  XronDTMLMethod.manage_addXronDTMLMethod),
icon = 'www/Event.gif')
  context.registerBaseClass(XronDTMLMethod.XronDTMLMethod)
  context.registerHelp()

-- HTH
-- Loren


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] Product question

2000-08-15 Thread Daniel Rusch

Not to sound like a completely blithering idiot, but how does one go about
setting the permissions to allow it to be created. I'd assume in the
__ac_permissions class attribute. What the specific permission is escapes me.

DR


Andy McKay wrote:

> Make sure you have the permissions set correctly for that product, so that
> you are allowed to create it.
>
> --
>  Andy McKay, Developer, ActiveState
>  http://www.ActiveState.com
>  Programming for the People
>
> - Original Message -
> From: "Daniel Rusch" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, August 15, 2000 9:11 AM
> Subject: [Zope] Product question
>
> > I've created a product, installed it and it appears on the Product
> > Management at /Control_Panel / Products list.
> >
> > The question is how do I get it to appear in the drop down of Available
> > Objects?
> >
> > Dan
> >
> >
> > ___
> > Zope maillist  -  [EMAIL PROTECTED]
> > http://lists.zope.org/mailman/listinfo/zope
> > **   No cross posts or HTML encoding!  **
> > (Related lists -
> >  http://lists.zope.org/mailman/listinfo/zope-announce
> >  http://lists.zope.org/mailman/listinfo/zope-dev )
> >
>
> ___
> Zope maillist  -  [EMAIL PROTECTED]
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] Product question

2000-08-15 Thread Andy McKay

Make sure you have the permissions set correctly for that product, so that
you are allowed to create it.

--
 Andy McKay, Developer, ActiveState
 http://www.ActiveState.com
 Programming for the People


- Original Message -
From: "Daniel Rusch" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, August 15, 2000 9:11 AM
Subject: [Zope] Product question


> I've created a product, installed it and it appears on the Product
> Management at /Control_Panel / Products list.
>
> The question is how do I get it to appear in the drop down of Available
> Objects?
>
> Dan
>
>
> ___
> Zope maillist  -  [EMAIL PROTECTED]
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




[Zope] Product question

2000-08-15 Thread Daniel Rusch

I've created a product, installed it and it appears on the Product
Management at /Control_Panel / Products list.

The question is how do I get it to appear in the drop down of Available
Objects?

Dan


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )