RE: [Zope] My Items will not show themself in manage_main (objectItems)

2000-11-01 Thread Max Møller Rasmussen

From: Ender [mailto:[EMAIL PROTECTED]]

First os all. Thank you for the patience. I know it is boring to "Solve
other peoples problems for them", but I am really trying hard myself,
reading the source 
of Zope and other products. It's just such a steap learning curve because it
is underdocumented. (I have 6+ years of experience in web scripting and 12+
in programming + database overall, so usually i catch on fast.)

>> I was under the impression that when I inherit ObjectManager that my
object
>> would be a complete ObjectManager. But do I have to overwrite some
methods
>> with my own?

>No you don't but generally an objectmanager would wants to add some
>custom logic, like a Folder which is a specialized objectmanager.

I don't want that in this product. It should just be a plain folder, where
anything can be put. Well at least Foders, images and dtml methods.

>ok, i'm not certain that i understand your problem. you original problem
>was getting dtml methods to show up in the manage views. in your product
>your it appears that your methods aren't really dtml methods that are
>contained within the objectmanager but rather class methods of the
>discussion class. to have them show up in the manage_views you need to
>change them to be methods that are added to a discussion object.

In my mxm_diskuss class I have a list containing messages:

self.testComments = [.] (will be renamed to "comments" when it's done.)

These comments are not meant to be seen in the folder view, they should only
be visible when called through dtml methods. like this method to make a list
of all messages:

index_html:


 
By:  



What I find "brilliant" about the idea is that when a customer wants a
discussion group I only have to change 3 standard dtml files to give it a
new functional interface. And I can build a library of look and feels. And
there is no recursion in it so it will behave like a list, and be easily
codeable from dtml.

The last discussion product ever needed :-) It will be ZPL (when it's done.)

>here some code that illustrates how.
># add a folder for view
>self.manage_addFolder('views')
># get a file handle
>fh = open(join(Views_Dir, 'DiscussionIndex.dtml'))
># add a DTML method with contents of the file.
>self.views.manage_addDTMLMethod(id='news_center_index_html', file=fh)

>a method created this way will show up in the manage_view of the object.

My problem is not adding object programatically, but doing it in the
management  interface. When I add them I can press "add & edit" and I can
paste the dtml source, and the method works. But they don't show up on the
list when viewing the folder.

Well I guess that if I dont have to do anything special to add objects to an
objectmanager, then I must have a permission problem when viewing them. I
guess I will look more into that. Currently I am lookin for a permission
that prevents seing the ObjectItems in an objectmanager, but so far without
any luck.

grr... documentation.

Kind regards Max M

___
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] My Items will not show themself in manage_main (objectItems)

2000-10-30 Thread Ender

Max M wrote:
> 
> I have made a product that inherits:
> "OFS.ObjectManager.ObjectManager"
> and so should be able to contain other object.

In python any object can be a container, the use of the ObjectManager
assists in creating an api and ui for the container's management of
objects.

> I have given the product a manage option:
> {'label':'Contents', 'action':'manage_main'}
> This is inherited from ObjectManager, To make it possible to
> add content to my product.
> 
> But when I add ie. a dtml method to my folderish object, it does it
> allright, and the document gets added. I know because I can see it directly
> when going to it's url. And if I try to add another document with the same
> name I get an error saying that the id is allready used.
> 
> But the Item doesn't show up in Itemlist on the "manage_main" page. So I
> cannot edit the items that I have added.
> 
> I only get the:
> "There are currently no items in XXX"

some more information on what you changed in the container would be
useful.

> Why is this? is there any special methods or something that I need to create
> for the Items to show up in "objectItems".

this pseudo code should give you the result you want?, it works for me
to display objects in the manage_main. 


def manage_addMyContainer:
foo = MyContainer()
bar = MyObject()

foo._setObject(bar, 'bar')

self._setObject(foo, 'foo')

caveat, register your permissions properly on the manage_add, and note
that adding bar in this way will mean it won't have access to
acquisition properties from further up the tree at creation (including
manage_afterAdd).

also for registering manage options this syntax is a little more
inclusive.

manage_options=(
OFS.ObjectManager.ObjectManager.manage_options+
(
{'label':'YourTabHere', 'action':'YourMethodHere'},
)+
AccessControl.Role.RoleManager.manage_options+
OFS.SimpleItem.SimpleItem.manage_options
)

hth

kapil

___
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] My Items will not show themself in manage_main (objectItems)

2000-10-30 Thread Andy McKay

> Why is this? is there any special methods or something that I need to
create
> for the Items to show up in "objectItems".

Not from what I can remember. I would have to see your constructor for more
info.

Andy.



___
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 )