[triangle-zpug] making createObject available to anon

Dimauro, Frank FDimauro at unch.unc.edu
Mon Aug 7 14:47:27 CEST 2006

Stephen et al
Thanks for the tips. I contacted Lukas Zdych who manages the Inventory
Builder product and he is going to incorporate this feature in the
product's next build. Inventory Builder is a great product BTW...Right
now only Plone members can add IB items and IB categories and that is
fine for now. I eventually want to allow anon users to add IB items. IB
can be modified for so many uses in your site...sky is the limit. I am
using it to replace our UNC Swap and shop website, where employees go to
sell/swap merchandise. Our own mini eBay, so to speak. I have it running
in .asp mode at the moment but want to fold it into our Plone site. To
see it in action, go here (only for those on UNC campus)

(best in IE)

Frank DiMauro
Information Services Division
UNC Health Care System
321 Meadowmont Village Circle, 2nd Floor 
Chapel Hill, NC 27517 
919-966-7988 (Tel) 
919-966-2110 (Fax) 

Message: 4
Date: Thu, 03 Aug 2006 10:21:54 -0400
From: Stephan Altmueller <stephan_altmueller at unc.edu>
Subject: Re: [triangle-zpug] making createObject available to anon
To: "Mailing list for North Carolina (Research Triangle area)
	Zope/Python User	Group" <triangle-zpug at python.net>
Message-ID: <44D20682.7070600 at unc.edu>
Content-Type: text/plain; charset="iso-8859-1"


If I understand the problem correctly you want to have anonymous users
fill out a form and then in the form script create some content.

I did that for a site where people could submit comments on an article.
It's basically a modified version of the the createObject code.
The steps I took are most likely overkill, but it should still contain 

Here is the relevant portion of the form script:

--------------- CODE start --------------------------------------
type_name = "Comment"

    # add the comment
    context.addComment(id, subject, comment)
--------------- CODE end --------------------------------------

and here is the method (in the Article class) that actually adds the
"Comment" instance:
--------------- CODE start --------------------------------------
    def addComment(self,id,subject,body):
        # make sure the id is autogenerated
        pu = getToolByName(self, 'plone_utils')
        if not pu.isIDAutoGenerated(id):
            raise "addComment: ID is not autogenerated !"
        new_id = self.invokeFactory(id=id, type_name="Comment")
        if new_id is None or new_id == '':
            new_id = id

        # set the values on that attribute
        o=getattr(self, new_id, None)
        o.setBody(body, mimetype='text/plain')
--------------- CODE end --------------------------------------

You can most likely fold that into the form script. You will probably
to give that script a Manager proxy role.
I also created a custom work flow for the Comment class where the 
initial state
is private. A UML diagram of that is attached.

 - Stephan

More information about the triangle-zpug mailing list