You are not logged in Log in Join
You are here: Home » Members » vernier » Debian » CMF_Creator

Log in
Name

Password

 
 

History for CMF_Creator

??changed:
-
**CMF Creator Issues**

Problem that this page attempts to solve: *when a manager joins other people into a CMF, the new folder and index_html become owned by the manager which makes searches showing owners of such document appear to be authored by manager*

- Creator is a method that returns the **owner** of an object in CMF

- Several people have posted ways to change the ownership of an object in zope (and thus in CMF) by using an external method.  I called mine **chown**::

  def set_owner(self,user='bruno'): 
    """ change Creator """
    try:
      try:
        acl_users=getattr(self,'acl_users')
        user = acl_users.getUser(user).__of__(acl_users)
      except:
        return "%s not in acl_user folder"%user
      try:
        self.changeOwnership(user=user,recursive=1)
        return "done by "%self.Creator()
      except: return "perhaps it did or did not change %s  (check)"%user
    except: return "something not right %s"%user

- usage: *URL/CMF_Document_name/chown?user=whoever*  or as part of a python script that systematically changes ownership of Members folders to be the same as the id of the corresponding folder::

 print "<html>"
 for I in context.Members.objectIds():
   print "<li>"
   try:
       print context.Members[I].chown(context.rec.REC.Members[I],user=I)
   except StandardError,msg: print "<u>%s</u> %s"%(I,msg)
   try: print "%s <i>%s</i>   "%(I,context.Members[I].index_html.Creator())
   except: print "no index for %s"%I
 return printed


- The above could be shortened to 3 lines.  The problem I have is that some users are in the **acl_user** folder in the CMF and others in acquired earlier **acl_user folders** . I am not totally pleased with this program since it returns false negative results even though it does the job correctly but only for those who have an entry in the immediate **acl_user** folder.

- Another issue is that **CMF Documents** seem to **cook in** the **Creator** so that unless one re-edits and saves a CMF Document, it appears to still have the old owner.