Re: [Zope-dev] Exception verbosity in CA

2008-04-16 Thread Christian Theune
On Tue, Apr 15, 2008 at 02:07:58PM +0200, Malthe Borch wrote:
 Some motivation:


 File .../zope/interface/adapter.py, line 482, in queryMultiAdapter
 result = factory(*objects)
 TypeError: __init__() takes exactly 2 arguments (3 given)

 Perhaps the need for introspection tools would not be so immediate if  
 the exceptions were more informative; for instance, in the example  
 above, why not print the repr of the factory having problems.

 Or better, use the ``inspect`` module to show what the factory expects  
 in terms of parameters and list the ``*objects`` passed to it.

+1

-- 
gocept gmbh  co. kg - forsterstrasse 29 - 06112 halle (saale) - germany
www.gocept.com - [EMAIL PROTECTED] - phone +49 345 122 9889 7 -
fax +49 345 122 9889 1 - zope and plone consulting and development
___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] AQ-Parent branch test failues was: Re: Five and browser-oriented components

2008-04-16 Thread Hanno Schlichting

Hi again.

Hanno Schlichting wrote:
I kept my promise and added the simple tests for the first two issues I 
found while doing testing against Plone.


I have meanwhile fixed the first trivial issue (conflicting argument 
called 'instance') and added a simple test for the second one.


Now after a good night of sleep here is the condensed version of the 
problem, for those too lazy to look at the branch and the commits:


All code is in Products.Five.browser. In .tests.aqlegacy.py we define 
two views:


class LegacyTemplate(BrowserView):

template = ViewPageTemplateFile('falcon.pt')

def __call__(self):
return self.template()

class LegacyTemplateTwo(BrowserView):

def __init__(self, context, request):
self.__parent__ = context
self.context = context
self.request = request
self.template = ViewPageTemplateFile('falcon.pt')

def __call__(self):
return self.template()

Both are registered in ZCML as:

browser:page
  for=*
  name=template
  class=.aqlegacy.LegacyTemplate
  permission=zope.Public
  /

browser:page
  for=*
  name=template_two
  class=.aqlegacy.LegacyTemplateTwo
  permission=zope.Public
  /

And in the aqlegacy_ftests.txt we call both of them via:

 view = getMultiAdapter((self.folder, request), name='template')
 view.template
BoundPageTemplateFile of Products.Five.metaclass.LegacyTemplate ...
 print view()
pThe falcon has taken flight/p


 view = getMultiAdapter((self.folder, request), name='template_two')
 view.template
Products.Five.browser.pagetemplatefile.ViewPageTemplateFile ...
 print view()
TypeError: __call__() takes at least 2 arguments (1 given)


Now as you can see the only difference is that one of them uses a class 
variable for assigning the template and the other one is using an 
instance variable.


From what I understand some magic place in between doesn't find the 
template instance variable during ZCML processing as it operates on 
classes only and therefor doesn't turn the template into a 
BoundPageTemplateFile.


From what I can tell the purpose of the BoundPageTemplateFile is to 
inject the view class into the method call of __call__, so you don't 
have to pass it in explicitly for each call. It does so, via some 
interesting code which boils down to:


class BoundPageTemplate(object):
def __init__(self, pt, ob):
object.__setattr__(self, 'im_func', pt)
object.__setattr__(self, 'im_self', ob)

def __call__(self, *args, **kw):
if self.im_self is None:
im_self, args = args[0], args[1:]
else:
im_self = self.im_self
return self.im_func(im_self, *args, **kw)


Using an instance variable called template and calling it later on 
without passing in the view as the first argument doesn't work at all in 
Zope3. In Zope2 it did so far, as the ViewPageTemplateFile would use 
Acquisition to find its view.


I don't have any good idea on how to handle this problem. We can 
probably walk up the stack frame to find the view in most cases, as the 
template is called in almost all cases directly from the view.


But the third test failure, which I haven't written a test for yet, 
breaks even then. Essentially it puts in an adapter in between the view 
and the template where the adapter doesn't have any reference to the 
view anymore, so getting to the view from the template is impossible 
even by walking up the stack frame. This use-case is highly specialized 
(the code is in plone.app.form._named) but currently it works in Zope2.


Ideas from people who know more about this side of Zope are still most 
welcome :)


Hanno

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

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


Re: AW: [Zope-dev] Field for blobs?

2008-04-16 Thread Nikolay Kim
On Tue, 2008-04-15 at 17:37 +0200, Roger Ineichen wrote:

 The other option whould be to split every widget into it's own
 package and use z3c.widget as namespace package.
 
 What do you think?

i think we should split z3c.schema and z3c.widget to separate packages,
so we can have one namespace for all third party fields and widgets


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


[Zope-dev] PluggableAuthService and PrincipalDeleted

2008-04-16 Thread Tarek Ziadé
Hi,

the IPrincipalDeleted event is never notified. As a matter of fact,
this would be useful to be able to trigger some cleanup in various
plugins,
when user data has to be cleaned up.

(FYI the PrincipalCreated event has a nice high level API _doAddUser
that triggers IPrincipalCreated but no high level API for deletion)

PAS also provides an  IUserAdderPlugin interface for plugins that adds users.

For deletion, I would like to do some changes into PAS:

- add a IUserRemoverPlugin interface that adds a removeUser *or*
rename IUserAdderPlugin to IUserManagerPlugin, but the latter would
involve a lot of trouble i think
- make ZODBUserManager implements it
- add a notify(PrincipalDeleted(user_id))   in ZODBUserManager

This would be helpfull to catch the event in various plugins

My final goal is to make sure user properties are cleaned up in
PlonePAS when a user is removed.


Opinions ?


Tarek
-- 
Tarek Ziadé | Association AfPy | www.afpy.org
Blog FR | http://programmation-python.org
Blog EN | http://tarekziade.wordpress.com/
___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] Zope Tests: 5 OK

2008-04-16 Thread Zope Tests Summarizer
Summary of messages to the zope-tests list.
Period Tue Apr 15 11:00:00 2008 UTC to Wed Apr 16 11:00:00 2008 UTC.
There were 5 messages: 5 from Zope Tests.


Tests passed OK
---

Subject: OK : Zope-2.8 Python-2.3.6 : Linux
From: Zope Tests
Date: Tue Apr 15 20:58:06 EDT 2008
URL: http://mail.zope.org/pipermail/zope-tests/2008-April/009410.html

Subject: OK : Zope-2.9 Python-2.4.4 : Linux
From: Zope Tests
Date: Tue Apr 15 20:59:36 EDT 2008
URL: http://mail.zope.org/pipermail/zope-tests/2008-April/009411.html

Subject: OK : Zope-2.10 Python-2.4.4 : Linux
From: Zope Tests
Date: Tue Apr 15 21:01:06 EDT 2008
URL: http://mail.zope.org/pipermail/zope-tests/2008-April/009412.html

Subject: OK : Zope-2.11 Python-2.4.4 : Linux
From: Zope Tests
Date: Tue Apr 15 21:02:36 EDT 2008
URL: http://mail.zope.org/pipermail/zope-tests/2008-April/009413.html

Subject: OK : Zope-trunk Python-2.4.4 : Linux
From: Zope Tests
Date: Tue Apr 15 21:04:06 EDT 2008
URL: http://mail.zope.org/pipermail/zope-tests/2008-April/009414.html

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


[Zope-dev] Re: AW: Field for blobs?

2008-04-16 Thread Christian Zagrodnick

On 2008-04-16 10:01:30 +0200, Nikolay Kim [EMAIL PROTECTED] said:


On Tue, 2008-04-15 at 17:37 +0200, Roger Ineichen wrote:


The other option whould be to split every widget into it's own
package and use z3c.widget as namespace package.

What do you think?


i think we should split z3c.schema and z3c.widget to separate packages,
so we can have one namespace for all third party fields and widgets


actually, when the __init__.py of z3c.schema would be a namespace 
__init__.py one could just add new packages w/o the need to split the 
z3c.schema up. Even though this might be a bit confusing.


--
Christian Zagrodnick

gocept gmbh  co. kg  ·  forsterstrasse 29 · 06112 halle/saale
www.gocept.com · fon. +49 345 12298894 · fax. +49 345 12298891



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

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


[Zope-dev] Re: AQ-Parent branch test failues was: Re: Five and browser-oriented components

2008-04-16 Thread Philipp von Weitershausen

Thanks for looking into this, Hanno! Here's my feedback:

Hanno Schlichting wrote:

Hanno Schlichting wrote:
I kept my promise and added the simple tests for the first two issues 
I found while doing testing against Plone.


I have meanwhile fixed the first trivial issue (conflicting argument 
called 'instance')


I took a look at it. Thanks! It's too bad that we have to duplicate so 
much code from Zope 3 now. Therefore I would suggest that we fix up 
zope.app.pagetemplate properly so that it won't conflict with 
'instance'. Then we can get rid of the duplication in Five. Thanks to 
the individual projects nowadays, it should be trivial to update 
zope.app.pagetemplate.


[...]
Now as you can see the only difference is that one of them uses a class 
variable for assigning the template and the other one is using an 
instance variable.


ViewPageTemplateFile etc. are only meant to be used as class attributes, 
never as instance attributes. This statement is also true for the 
current, acquisition-based one from Five. In my opinion, the fact that 
it accidentally worked as an instance variable isn't a very strong 
argument for continuing to support it. To me, this is a prime example of 
misusing a Five component which now leads to problems when we go pure Zope3.


From what I understand some magic place in between doesn't find the 
template instance variable during ZCML processing as it operates on 
classes only and therefor doesn't turn the template into a 
BoundPageTemplateFile.


It doesn't happen during ZCML processing. It's a simple class 
descriptor, so the magic happens in ViewPageTemplateFile's __get__ which 
is invoked each time you do view.template (the '.' invokes __get__). I 
recommend reading about new-style class descriptors and properties.


Using an instance variable called template and calling it later on 
without passing in the view as the first argument doesn't work at all in 
Zope3. In Zope2 it did so far, as the ViewPageTemplateFile would use 
Acquisition to find its view.


Right. This led to all sorts of weird and icky problems, so thank God 
it's gone now.



I don't have any good idea on how to handle this problem.


Do we really have to support instance-level templates? I would still 
argue that if anybody's using ViewPageTemplateFile like this, they're 
using it wrong. I personally have no intent on supporting this.


If we really have to support it, then there's a simple solution: don't 
use ViewPageTemplateFile for instance-level attributes, use a variant 
that we provide instead. We could introduce this variant in both 
pre-AQ-parent and post-AQ-parent Zope versions to ease compatibility.


We can 
probably walk up the stack frame to find the view in most cases, as the 
template is called in almost all cases directly from the view.


-1. Walking up stack frames for guessing stuff like this will usually 
destroy you.


But the third test failure, which I haven't written a test for yet, 
breaks even then. Essentially it puts in an adapter in between the view 
and the template where the adapter doesn't have any reference to the 
view anymore, so getting to the view from the template is impossible 
even by walking up the stack frame. This use-case is highly specialized 
(the code is in plone.app.form._named) but currently it works in Zope2.


You're probably referring to the NamedTemplate thing that zope.formlib 
has (and plone.app.form reimplements the stuff for Zope 2). In 
zope.formlib, the same __get__ technique that ViewPageTemplateFile uses 
is used to get a hold of the view instance when you do view.template. 
plone.app.form's replacement for this technique is to use acquisition to 
get at the view. This obviously has to go since acquisition is no longer 
supported for views. In fact, if I'm not mistaken, this bit of 
plone.app.form can entirely be ripped out.


Given that plone.app.form does monkey patches (which I'm unwilling to 
support in any means, the original authors made potential 
incompatibilities their problem when they introduced them), I'm almost 
certain that there will never be one version of plone.app.form that will 
work with both the pre-AQ-parent and the post-AQ-parent Zope. You could 
still try, of course. At the very least, you could make a try/except 
clause. Either way, as I said, I'm not offering my help for this package 
since it contains monkey patches.

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

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


Re: [Zope-dev] Re: AQ-Parent branch test failues was: Re: Five and browser-oriented components

2008-04-16 Thread Wichert Akkerman
Previously Philipp von Weitershausen wrote:
 ViewPageTemplateFile etc. are only meant to be used as class attributes, 
 never as instance attributes. This statement is also true for the 
 current, acquisition-based one from Five.

Is that documented anywhere? I can't seem to find any interface or
docstring that documents that.

 In my opinion, the fact that it accidentally worked as an instance
 variable isn't a very strong argument for continuing to support it. To
 me, this is a prime example of misusing a Five component which now
 leads to problems when we go pure Zope3.

I'ld agree if there was a docstring or interface that made that
explicit. I've updated the relevant code in plone.app.portlets though
since the change is harmless.

Wichert.

-- 
Wichert Akkerman [EMAIL PROTECTED]It is simple to make things.
http://www.wiggy.net/   It is hard to make things simple.
___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] Annoying: Download error: unknown url type: svn -- Some packages may not be found!

2008-04-16 Thread David Pratt
Which package is emitting the Download error: unknown url type: svn -- 
Some packages may not be found! Its quite annoying and I have been 
seeing it crop up in a few builds. Anyone else seeing this. Many thanks.


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

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


[Zope-dev] Re: AQ-Parent branch test failues was: Re: Five and browser-oriented components

2008-04-16 Thread Philipp von Weitershausen

Wichert Akkerman wrote:

Previously Philipp von Weitershausen wrote:
ViewPageTemplateFile etc. are only meant to be used as class attributes, 
never as instance attributes. This statement is also true for the 
current, acquisition-based one from Five.


Is that documented anywhere? I can't seem to find any interface or
docstring that documents that.


I suppose not, because ViewPageTemplateFile (or ZopeTwoPageTemplateFile, 
as it used to be called) was and still is poorly documented. Initially, 
it was only used internally by the ZCML directives until people started 
 writing the view template explicitly into the view class, much like in 
Zope 3.


So no, there isn't documentation about the Five bit. But there *is* 
documentation about the Zope 3 bit (my book, for instance), so my 
argument is mostly based on the principle of correspondence between Five 
and Zope 3.



In my opinion, the fact that it accidentally worked as an instance
variable isn't a very strong argument for continuing to support it. To
me, this is a prime example of misusing a Five component which now
leads to problems when we go pure Zope3.


I'ld agree if there was a docstring or interface that made that
explicit. I've updated the relevant code in plone.app.portlets though
since the change is harmless.


Cool, that's great. If this is just a matter of a docstring, I'm sure 
that can be arranged :)

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

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


[Zope-dev] Splitting up zope.app.container

2008-04-16 Thread Malthe Borch
The ``constraints`` module in zope.app.container seem to be usable 
outside a ZODB-application---ditto most of the interfaces.


If we want to support a nozodb-environment, it would be nice to not have 
to pull in ZODB just to get these frameworky definitions.


Is it package overkill to move these out to, say, zope.container?

\malthe

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

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


AW: [Zope-dev] Annoying: Download error: unknown url type: svn -- Some packages may not be found!

2008-04-16 Thread Roger Ineichen
Hi David
 
 Betreff: [Zope-dev] Annoying: Download error: unknown url 
 type: svn -- Some packages may not be found!
 
 Which package is emitting the Download error: unknown url 
 type: svn -- Some packages may not be found! Its quite 
 annoying and I have been seeing it crop up in a few builds. 
 Anyone else seeing this. Many thanks.

I see this too. Try the buildout debug option, probably this
will you give a better output.

Regards
Roger Ineichen
_
END OF MESSAGE

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

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


Re: AW: [Zope-dev] Annoying: Download error: unknown url type: svn -- Some packages may not be found!

2008-04-16 Thread David Pratt
Hi Roger. I turned on debug and increased verbosity. z3c.template and 
z3c.form seem to be the culprits. Getting 4 of these warnings on 
z3c.template and 1 with z3c.form between the getting ... and picked ... 
notices. Not quite sure why they are emitting the warnings. Can't find 
the error in buildout so must be in setuptools somewhere. I would expect 
to see an svn address in setup.py or something based on what message is 
saying - nothing like this that I can see.


This was reported on the zope users list without a response a little 
while back as well:


http://www.mail-archive.com/[EMAIL PROTECTED]/msg06448.html

Regards,
David

Roger Ineichen wrote:

Hi David
 
Betreff: [Zope-dev] Annoying: Download error: unknown url 
type: svn -- Some packages may not be found!


Which package is emitting the Download error: unknown url 
type: svn -- Some packages may not be found! Its quite 
annoying and I have been seeing it crop up in a few builds. 
Anyone else seeing this. Many thanks.


I see this too. Try the buildout debug option, probably this
will you give a better output.

Regards
Roger Ineichen
_
END OF MESSAGE


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

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




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

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


Re: AW: [Zope-dev] Annoying: Download error: unknown url type: svn -- Some packages may not be found!

2008-04-16 Thread Jim Fulton


On Apr 16, 2008, at 1:49 PM, Roger Ineichen wrote:

Hi David


Betreff: [Zope-dev] Annoying: Download error: unknown url
type: svn -- Some packages may not be found!


I'm against using subversion URLs in buildouts.

Be that as it may


Which package is emitting the Download error: unknown url
type: svn -- Some packages may not be found! Its quite
annoying and I have been seeing it crop up in a few builds.
Anyone else seeing this. Many thanks.


Unfortunately, setuptools and urllib2 are often not very helpful with  
the exceptions that raise.  By the time buildout gets an exception,  
the useful information is often not available.



I see this too. Try the buildout debug option, probably this
will you give a better output.


Yup. You'll actually get a traceback and you can get into pdb and see  
what URL is being fetched.


You can also try using the -v option to see what package is being  
loaded when the error occurs.


I encourage you to report miss-raised  exceptions to the responsible  
party. For example, I expect that you'll find that the URL is knows to  
setuptools and that you can submit a setuptools bug to include the URL  
in the exception. (Of course, if buildout can generate a more helpful  
error, I'd be happy to fix it.)


Jim

--
Jim Fulton
Zope Corporation


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

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