[Zope] Re: Declare constructor as public

2007-07-24 Thread J Cameron Cooper

Garito wrote:

Hi Andrew!
In a normal method inside the product's class I use this:
security = ClassSecurityInfo()
security.setPermissionDefault('Freemind', ('Manager', 'Developer'))
security.declareProtected ('Freemind', 'freemind')

But outside the class I have no idea how to create security object

Can I put a code like this outside the class?


No. Permission for a constructor is set when you register it, usually in 
the __init__.py. (context.registerClass)


   --jcc


2007/7/24, Andrew Milton 
[EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED]:


+---[ Garito ]--
| Hi all!
|
| How can I declare a product's constructor public?
|
| Thanks!

You have to declare a permission first such as: Add Garito Product
when you
create your product, and register the class.

Then in the ZMI you simply add the roles you want access to that
permission.


--
Connexions
http://cnx.org

Building Websites with Plone
http://plonebook.packtpub.com

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Re: Declare constructor as public

2007-07-24 Thread Garito

Hi, J Cameron!
With constructor I mean the function I use to create the object. In this
case:
context.manage_addProduct['Yanged'].CrearYanged(NuevaId)

CrearYanged

How can I convert it to public?

Thanks!

2007/7/24, J Cameron Cooper [EMAIL PROTECTED]:


Garito wrote:
 Hi Andrew!
 In a normal method inside the product's class I use this:
 security = ClassSecurityInfo()
 security.setPermissionDefault('Freemind', ('Manager', 'Developer'))
 security.declareProtected ('Freemind', 'freemind')

 But outside the class I have no idea how to create security object

 Can I put a code like this outside the class?

No. Permission for a constructor is set when you register it, usually in
the __init__.py. (context.registerClass)

--jcc


 2007/7/24, Andrew Milton
 [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED]:

 +---[ Garito ]--
 | Hi all!
 |
 | How can I declare a product's constructor public?
 |
 | Thanks!

 You have to declare a permission first such as: Add Garito Product
 when you
 create your product, and register the class.

 Then in the ZMI you simply add the roles you want access to that
 permission.

--
Connexions
http://cnx.org

Building Websites with Plone
http://plonebook.packtpub.com

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





--
Mis Cosas
http://blogs.sistes.net/Garito
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Re: Declare constructor as public

2007-07-24 Thread Jonathan


- Original Message - 
From: Garito [EMAIL PROTECTED]

To: zope@zope.org
Sent: Tuesday, July 24, 2007 10:44 AM
Subject: Re: [Zope] Re: Declare constructor as public



Hi, J Cameron!
With constructor I mean the function I use to create the object. In this
case:
context.manage_addProduct['Yanged'].CrearYanged(NuevaId)

CrearYanged

How can I convert it to public?


Make sure that the folder and the script that contains the 
context.manage_addProduct['Yanged'].CrearYanged(NuevaId) code are 
accessible to the user.


Also, the folder where the new 'Yanged' instance is being created must be 
'writeable' by the user.


If it is not working, make sure that 'Unauthorized' is not listed in the 
'Ignored exception types' list in your error_log, so you can track the 
problem down.



Jonathan



___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Re: Declare constructor as public

2007-07-24 Thread Garito

Now the problem is with a manager user too (yesterday this user works ok)
I try to inspect the process to see where it fails but seems to be ok
The error is raised when Zope try to commit the changes

This is the traceback:

Traceback (innermost last):
 Module ZPublisher.Publish, line 121, in publish
 Module Zope2.App.startup, line 240, in commit
 Module transaction._manager, line 96, in commit
 Module transaction._transaction, line 380, in commit
 Module transaction._transaction, line 378, in commit
 Module transaction._transaction, line 433, in _commitResources
 Module ZODB.Connection, line 484, in commit
 Module ZODB.Connection, line 526, in _commit
 Module ZODB.Connection, line 553, in _store_objects
 Module ZODB.serialize, line 407, in serialize
 Module ZODB.serialize, line 416, in _dump
 Module copy_reg, line 69, in _reduce_ex
TypeError: can't pickle instancemethod objects



2007/7/24, Jonathan [EMAIL PROTECTED]:



- Original Message -
From: Garito [EMAIL PROTECTED]
To: zope@zope.org
Sent: Tuesday, July 24, 2007 10:44 AM
Subject: Re: [Zope] Re: Declare constructor as public


 Hi, J Cameron!
 With constructor I mean the function I use to create the object. In this
 case:
 context.manage_addProduct['Yanged'].CrearYanged(NuevaId)

 CrearYanged

 How can I convert it to public?

Make sure that the folder and the script that contains the
context.manage_addProduct['Yanged'].CrearYanged(NuevaId) code are
accessible to the user.

Also, the folder where the new 'Yanged' instance is being created must be
'writeable' by the user.

If it is not working, make sure that 'Unauthorized' is not listed in the
'Ignored exception types' list in your error_log, so you can track the
problem down.


Jonathan







--
Mis Cosas
http://blogs.sistes.net/Garito
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Re: Declare constructor as public

2007-07-24 Thread Jonathan


- Original Message - 
From: Garito [EMAIL PROTECTED]

To: Jonathan [EMAIL PROTECTED]
Cc: zope@zope.org
Sent: Tuesday, July 24, 2007 11:47 AM
Subject: Re: [Zope] Re: Declare constructor as public



Now the problem is with a manager user too (yesterday this user works ok)
I try to inspect the process to see where it fails but seems to be ok
The error is raised when Zope try to commit the changes

This is the traceback:

Traceback (innermost last):
 Module ZPublisher.Publish, line 121, in publish
 Module Zope2.App.startup, line 240, in commit
 Module transaction._manager, line 96, in commit
 Module transaction._transaction, line 380, in commit
 Module transaction._transaction, line 378, in commit
 Module transaction._transaction, line 433, in _commitResources
 Module ZODB.Connection, line 484, in commit
 Module ZODB.Connection, line 526, in _commit
 Module ZODB.Connection, line 553, in _store_objects
 Module ZODB.serialize, line 407, in serialize
 Module ZODB.serialize, line 416, in _dump
 Module copy_reg, line 69, in _reduce_ex
TypeError: can't pickle instancemethod objects


Somehow you are trying to store a method that has been bound to an instance 
of a class.  You should investigate the object that you are trying to store 
and see what it really consists of.


Jonathan 


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Re: Declare constructor as public

2007-07-24 Thread Garito

Hi again!
I detect some clues for the problem:

I use ExUserFolder as acl_user for the website who raises this error

The problem only raises if I'm authenticated as an user of the ExUserFolder
not if I'm authenticated as a root acl_user's user

In both cases the user has manager as roles but the main acl_users works ok
and the XUF one raises the error

Any idea?

2007/7/24, Garito [EMAIL PROTECTED]:


Now the problem is with a manager user too (yesterday this user works ok)
I try to inspect the process to see where it fails but seems to be ok
The error is raised when Zope try to commit the changes

This is the traceback:

Traceback (innermost last):
  Module ZPublisher.Publish, line 121, in publish
  Module Zope2.App.startup, line 240, in commit
  Module transaction._manager, line 96, in commit
  Module transaction._transaction, line 380, in commit

  Module transaction._transaction, line 378, in commit
  Module transaction._transaction, line 433, in _commitResources
  Module ZODB.Connection, line 484, in commit
  Module ZODB.Connection, line 526, in _commit

  Module ZODB.Connection, line 553, in _store_objects
  Module ZODB.serialize, line 407, in serialize
  Module ZODB.serialize, line 416, in _dump
  Module copy_reg, line 69, in _reduce_ex
TypeError: can't pickle instancemethod objects



2007/7/24, Jonathan [EMAIL PROTECTED]:


 - Original Message -
 From: Garito [EMAIL PROTECTED]
 To: zope@zope.org
 Sent: Tuesday, July 24, 2007 10:44 AM
 Subject: Re: [Zope] Re: Declare constructor as public


  Hi, J Cameron!
  With constructor I mean the function I use to create the object. In
 this
  case:
  context.manage_addProduct['Yanged'].CrearYanged(NuevaId)
 
  CrearYanged
 
  How can I convert it to public?

 Make sure that the folder and the script that contains the
 context.manage_addProduct['Yanged'].CrearYanged(NuevaId) code are
 accessible to the user.

 Also, the folder where the new 'Yanged' instance is being created must
 be
 'writeable' by the user.

 If it is not working, make sure that 'Unauthorized' is not listed in the

 'Ignored exception types' list in your error_log, so you can track the
 problem down.


 Jonathan






--
Mis Cosas
http://blogs.sistes.net/Garito





--
Mis Cosas
http://blogs.sistes.net/Garito
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Re: Declare constructor as public

2007-07-24 Thread Garito

Hi, Jonathan!
Please, read my last message with the XUF consideration

Thanks!

2007/7/24, Jonathan [EMAIL PROTECTED]:



- Original Message -
From: Garito [EMAIL PROTECTED]
To: Jonathan [EMAIL PROTECTED]
Cc: zope@zope.org
Sent: Tuesday, July 24, 2007 11:47 AM
Subject: Re: [Zope] Re: Declare constructor as public


 Now the problem is with a manager user too (yesterday this user works
ok)
 I try to inspect the process to see where it fails but seems to be ok
 The error is raised when Zope try to commit the changes

 This is the traceback:

 Traceback (innermost last):
  Module ZPublisher.Publish, line 121, in publish
  Module Zope2.App.startup, line 240, in commit
  Module transaction._manager, line 96, in commit
  Module transaction._transaction, line 380, in commit
  Module transaction._transaction, line 378, in commit
  Module transaction._transaction, line 433, in _commitResources
  Module ZODB.Connection, line 484, in commit
  Module ZODB.Connection, line 526, in _commit
  Module ZODB.Connection, line 553, in _store_objects
  Module ZODB.serialize, line 407, in serialize
  Module ZODB.serialize, line 416, in _dump
  Module copy_reg, line 69, in _reduce_ex
 TypeError: can't pickle instancemethod objects

Somehow you are trying to store a method that has been bound to an
instance
of a class.  You should investigate the object that you are trying to
store
and see what it really consists of.

Jonathan





--
Mis Cosas
http://blogs.sistes.net/Garito
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Re: Declare constructor as public

2007-07-24 Thread Andrew Milton
+---[ Garito ]--
| Hi again!
| I detect some clues for the problem:
| 
| I use ExUserFolder as acl_user for the website who raises this error
| 
| The problem only raises if I'm authenticated as an user of the ExUserFolder 
not
| if I'm authenticated as a root acl_user's user
| 
| In both cases the user has manager as roles but the main acl_users works ok 
and
| the XUF one raises the error
| 
| Any idea?

Are you trying to store something as a property of the user? That's the only
time XUF attempts to pickle anything.

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


Re: [Zope] Re: Declare constructor as public

2007-07-24 Thread Garito

Sorry for the private message, Andrew
It seems like with the XUF user's roles don't work ok or something like this

2007/7/24, Andrew Milton [EMAIL PROTECTED]:


+---[ Garito ]--
| Hi again!
| I detect some clues for the problem:
|
| I use ExUserFolder as acl_user for the website who raises this error
|
| The problem only raises if I'm authenticated as an user of the
ExUserFolder not
| if I'm authenticated as a root acl_user's user
|
| In both cases the user has manager as roles but the main acl_users works
ok and
| the XUF one raises the error
|
| Any idea?

Are you trying to store something as a property of the user? That's the
only
time XUF attempts to pickle anything.

--
Andrew Milton
[EMAIL PROTECTED]





--
Mis Cosas
http://blogs.sistes.net/Garito
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Re: Declare constructor as public

2007-07-24 Thread Garito

No
If I try this the call don't work with users in normal acl_user folder,
isn't it?

The call works ok with users stored in the root acl_user

2007/7/24, Andrew Milton [EMAIL PROTECTED]:


+---[ Garito ]--
| Hi again!
| I detect some clues for the problem:
|
| I use ExUserFolder as acl_user for the website who raises this error
|
| The problem only raises if I'm authenticated as an user of the
ExUserFolder not
| if I'm authenticated as a root acl_user's user
|
| In both cases the user has manager as roles but the main acl_users works
ok and
| the XUF one raises the error
|
| Any idea?

Are you trying to store something as a property of the user? That's the
only
time XUF attempts to pickle anything.

--
Andrew Milton
[EMAIL PROTECTED]





--
Mis Cosas
http://blogs.sistes.net/Garito
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )