Re: [Zope-CMF] getActionObject() deprecated?

2010-04-19 Thread Charlie Clark
Am 19.04.2010, 15:35 Uhr, schrieb yuppie :

> And please don't forget that I plan to replace the unauth redirect code
> completely.

I've been working on a "getLoginURL()" method to be able to handle  
login/logout actions as well as the current behaviour but I don't seem to  
be able to write any usable tests as the methods depend on "getToolByName"  
which works fine for the root object as long as the tools are registered  
but not for the CookieCrumbler itself. I just get an AttibuteError for  
whichever tool: "portal_url", "portal_actions", etc.

Is it wrong to test like this?

Charlie
-- 
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-600-3657
Mobile: +49-178-782-6226
___
Zope-CMF maillist  -  Zope-CMF@zope.org
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


Re: [Zope-CMF] getActionObject() deprecated?

2010-04-19 Thread Charlie Clark
Am 19.04.2010, 15:35 Uhr, schrieb yuppie :

Hiya Yuppie,

> Yes. You don't need that method for newstyle Actions. Just use this if
> you want to get the Action object:
> atool.user.login

hm, direct access by attributes, who'd have thunk it!? ;-)

> But you don't need the Action itself. You need the ActionInfo object.
> Use this to get the login url:
> target = atool.getActionInfo('user/login')['url']

So, it was me being thick...(I plead hayfever). I got confused looking at  
the various layers of ActionProviders, ActionCategories and ActionTools!

> And please don't forget that I plan to replace the unauth redirect code
> completely.

I haven't forgotten that. Login and Logout are definitely better  
definitely done as views as they depend upon working with the Request  
object.

Maybe you could edit the CookieCrumbler interface so I don't waste more  
time on stuff that's being replaced anyway?

Charlie
-- 
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-600-3657
Mobile: +49-178-782-6226
___
Zope-CMF maillist  -  Zope-CMF@zope.org
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


Re: [Zope-CMF] getActionObject() deprecated?

2010-04-19 Thread yuppie
Hi!


Charlie Clark wrote:
> this may just be another case of me being thick but whilst working on
> CookieCrumler I took a look at the best way for getting the "user/login"
> and "user/logout" actions. getActionObject("user/login") would seem to be
> best approach. However, it will not work with any straight actions as none
> of them have a category. As things stand this method will only work with
> Type actions. Is this correct?

Yes. You don't need that method for newstyle Actions. Just use this if 
you want to get the Action object:

atool.user.login

But you don't need the Action itself. You need the ActionInfo object. 
Use this to get the login url:

target = atool.getActionInfo('user/login')['url']

And please don't forget that I plan to replace the unauth redirect code 
completely.


Cheers,

Yuppie


___
Zope-CMF maillist  -  Zope-CMF@zope.org
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


[Zope-CMF] getActionObject() deprecated?

2010-04-19 Thread Charlie Clark
Hi,

this may just be another case of me being thick but whilst working on  
CookieCrumler I took a look at the best way for getting the "user/login"  
and "user/logout" actions. getActionObject("user/login") would seem to be  
best approach. However, it will not work with any straight actions as none  
of them have a category. As things stand this method will only work with  
Type actions. Is this correct?

Charlie
-- 
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-600-3657
Mobile: +49-178-782-6226
___
Zope-CMF maillist  -  Zope-CMF@zope.org
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests