[Zope3-Users] Traverse to nearest site in menu action

2005-03-31 Thread Florian Lindner
Hello,
I implemented to traverser to the nearest site using the code in the posting:

[Zope3-Users] Re: Traversing to nearest site
Von: jÃrgen Kartnaller <[EMAIL PROTECTED]>
An: [EMAIL PROTECTED]
Datum: 17.03.2005 13:53

it works: When I'm calling 
http://horus.local:8080/++skin++centershock/cs/++site++ I see the contents of 
the root folder (my nearest site).

Now I want to use for a menu item:







Resulting in:

  File "/home/florian/Zope3/src/zope/app/publisher/browser/menu.py", line 180, 
in getMenu
return menu.getMenuItems(object, request)
  File "/home/florian/Zope3/src/zope/app/publisher/browser/menu.py", line 55, 
in getMenuItems
if item.available():
  File "/home/florian/Zope3/src/zope/app/publisher/browser/menu.py", line 123, 
in available
if not canAccess(view, '__call__'):
  File "/home/florian/Zope3/src/zope/security/checker.py", line 114, in 
canAccess
checker.check_getattr(obj, name)
ForbiddenAttribute: ('__call__', )


How do I have to call it?

One other question:

How can I make one of my objects able to be contain a site. Using 
zope.app.component.interfaces.IPossibleSite as a marker interface (like 
 
in the  directive) does not make it. There is a link to add a site, 
but I get a system error when trying to add it.
Or directly inherit from zope.app.folder.interfaces.IFolder?

Thanks,

Florian
___
Zope3-users mailing list
[EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Traverse to nearest site in menu action

2005-03-31 Thread Florian Lindner
Am Donnerstag, 31. MÃrz 2005 13:00 schrieb jÃrgen Kartnaller:
> Florian Lindner wrote:
> > Hello,
> > I implemented to traverser to the nearest site using the code in the
> > posting:
> >
> > [Zope3-Users] Re: Traversing to nearest site
> > Von: jÃrgen Kartnaller <[EMAIL PROTECTED]>
> > An: [EMAIL PROTECTED]
> > Datum: 17.03.2005 13:53
> >
> > it works: When I'm calling
> > http://horus.local:8080/++skin++centershock/cs/++site++ I see the
> > contents of the root folder (my nearest site).
> >
> > Now I want to use for a menu item:
> >
> >  > menu="CSnavMenu"
> > for="*"
> > layer="centershock">
> >
> >  > title="home2"
> > action="++site++" />
> >
> > 
> >
> > Resulting in:
> >
> >   File "/home/florian/Zope3/src/zope/app/publisher/browser/menu.py", line
> > 180, in getMenu
> > return menu.getMenuItems(object, request)
> >   File "/home/florian/Zope3/src/zope/app/publisher/browser/menu.py", line
> > 55, in getMenuItems
> > if item.available():
> >   File "/home/florian/Zope3/src/zope/app/publisher/browser/menu.py", line
> > 123, in available
> > if not canAccess(view, '__call__'):
> >   File "/home/florian/Zope3/src/zope/security/checker.py", line 114, in
> > canAccess
> > checker.check_getattr(obj, name)
> > ForbiddenAttribute: ('__call__',  > 0xb6ee2d6c>)
> >
> >
> > How do I have to call it?
>
> I do the same without problems.
> Is your folder configuration correct (ZCML, interface, implementation) ?

I'll double check everything and report back.

Florian
___
Zope3-users mailing list
[EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Traverse to nearest site in menu action

2005-04-01 Thread Florian Lindner
Am Donnerstag, 31. MÃrz 2005 13:58 schrieb Florian Lindner:
> Am Donnerstag, 31. MÃrz 2005 13:00 schrieb jÃrgen Kartnaller:
> > Florian Lindner wrote:
> > > Hello,
> > > I implemented to traverser to the nearest site using the code in the
> > > posting:
> > >
> > > [Zope3-Users] Re: Traversing to nearest site
> > > Von: jÃrgen Kartnaller <[EMAIL PROTECTED]>
> > > An: zope3-users@zope.org
> > > Datum: 17.03.2005 13:53
> > >
> > > it works: When I'm calling
> > > http://horus.local:8080/++skin++centershock/cs/++site++ I see the
> > > contents of the root folder (my nearest site).
> > >
> > > Now I want to use for a menu item:
> > >
> > >  > > menu="CSnavMenu"
> > > for="*"
> > > layer="centershock">
> > >
> > >  > > title="home2"
> > > action="++site++" />
> > >
> > > 
> > >
> > > Resulting in:
> > >
> > >   File "/home/florian/Zope3/src/zope/app/publisher/browser/menu.py",
> > > line 180, in getMenu
> > > return menu.getMenuItems(object, request)
> > >   File "/home/florian/Zope3/src/zope/app/publisher/browser/menu.py",
> > > line 55, in getMenuItems
> > > if item.available():
> > >   File "/home/florian/Zope3/src/zope/app/publisher/browser/menu.py",
> > > line 123, in available
> > > if not canAccess(view, '__call__'):
> > >   File "/home/florian/Zope3/src/zope/security/checker.py", line 114, in
> > > canAccess
> > > checker.check_getattr(obj, name)
> > > ForbiddenAttribute: ('__call__',  > > at 0xb6ee2d6c>)
> > >
> > >
> > > How do I have to call it?
> >
> > I do the same without problems.
> > Is your folder configuration correct (ZCML, interface, implementation) ?

It works now. I needed to add a permission attribute to the menuItem 
subdirective.
But why? I'm logged in as a zope,Manager and therefor I should have rights to 
see the site.

Another problem I have, that when I've clicked on home a few times you have a 
URL like that:

http://horus.local:8080/++skin++centershock/cs/++site++/++site++/++site++/++site++/++site++

Which in IMO is not so great. Any way to normalize this path?

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Traverse to nearest site in menu action

2005-04-03 Thread Florian Lindner
Am Samstag, 2. April 2005 05:38 schrieb jÃrgen Kartnaller:
> Stephan Richter wrote:
> > On Thursday 31 March 2005 09:23, Florian Lindner wrote:
> >>I implemented to traverser to the nearest site using the code in the
> >>posting:
> >>
> >>[Zope3-Users] Re: Traversing to nearest site
> >>Von: jÃrgen Kartnaller <[EMAIL PROTECTED]>
> >>An: zope3-users@zope.org
> >>Datum: 17.03.2005 13:53
> >
> > Why in the world would you want to do that? This seems just awful. What
> > is your use case?
>
> In my case I want to have the possibility to jump back to my base view
> (which is the default view of my site) from wherever I am within my site.
>
> But, if there is an easier way to do this, please let me know.

My use case is exactly the same and I think it is a common problem.

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Traverse to nearest site in menu action

2005-04-03 Thread Florian Lindner
Am Freitag, 1. April 2005 22:37 schrieb Stephan Richter:
> On Friday 01 April 2005 11:34, Florian Lindner wrote:
> > Another problem I have, that when I've clicked on home a few times you
> > have a URL like that:
> >
> > http://horus.local:8080/++skin++centershock/cs/++site++/++site++/++site++
> >/+ +site++/++site++
> >
> > Which in IMO is not so great. Any way to normalize this path?
>
> You probably set your base path incorrectly. Anyways, I still think this is
> a horrible way to do it; I would rather build a view that forwards you to
> the site.

Hello,
I've implemented a view like that:

class toSite(object):
def __call__(self):
from zope.app.zapi import absoluteURL
URL = absoluteURL(getSite(), self.request)
return self.request.response.redirect(URL)

Which for me works perfectly. Any drawbacks of this solution?

Regards,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Traverse to nearest site in menu action

2005-04-03 Thread Florian Lindner
Am Samstag, 2. April 2005 08:37 schrieb Stephan Richter:
> On Saturday 02 April 2005 04:38, jÃrgen Kartnaller wrote:
> > > Why in the world would you want to do that? This seems just awful. What
> > > is your use case?
> >
> > In my case I want to have the possibility to jump back to my base view
> > (which is the default view of my site) from wherever I am within my site.
> >
> > But, if there is an easier way to do this, please let me know.
>
> Then write a wrapper view for all interfaces that internally looks up the
> next site and looks up the default view:
>
> class SiteDefaultView(object):
>
>   def __call__(self):
>   site = getNextSiteSomehow()
>   defaultViewName = getDefaultViewName(site, self.request, site)
>   view = zapi.getMultiAdapter((site, request), Interface,
> name=defaultViewName) return view()

Hello,
your solution:

class toSite(object):
def __call__(self):
from zope.app.zapi import *
site = getSite()
defaultViewName = getDefaultViewName(site, self.request, site)
view = getMultiAdapter((site, self.request), name=defaultViewName)
return view()

get the same results as mine:

class toSite(object):
def __call__(self):
from zope.app.zapi import absoluteURL
URL = absoluteURL(getSite(), self.request)
return self.request.response.redirect(URL)


What are the differences? Which is better? Why?

I think yours is better since it does not involve a redirect. What do you 
think?

Thanks,

Florian

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Traverse to nearest site in menu action

2005-04-03 Thread Florian Lindner
Am Freitag, 1. April 2005 22:36 schrieb Stephan Richter:
> On Thursday 31 March 2005 09:23, Florian Lindner wrote:
> > How can I make one of my objects able to be contain a site. Using
> > zope.app.component.interfaces.IPossibleSite as a marker interface (like
> > 
> > in the  directive) does not make it. There is a link to add a
> > site, but I get a system error when trying to add it.
>
> Can you send the traceback? Though I think you simply forgot the security
> declarations, so that the necessary methods are not publically available.
>
>  attributes="getSiteManager"
> />
>  permission="zope.ManageServices"
> attributes="setSiteManager"
> />
>

My configure.zcml:














I'm logged in as zope.Manager.

The traceback when I hit "Webplatz erstellen" (Make site).


2005-04-03T17:24:33 ERROR SiteError 
http://localhost:8080/cs/addSiteManager.html
Traceback (most recent call last):
  File "/home/florian/Zope3/src/zope/publisher/publish.py", line 138, in 
publish
result = publication.callObject(request, object)
  File "/home/florian/Zope3/src/zope/app/publication/zopepublication.py", line 
155, in callObject
return mapply(ob, request.getPositionalArguments(), request)
  File "/home/florian/Zope3/src/zope/publisher/publish.py", line 113, in 
mapply
return debug_call(object, args)
  File "/home/florian/Zope3/src/zope/publisher/publish.py", line 119, in 
debug_call
return object(*args)
  File "/home/florian/Zope3/src/zope/app/component/browser/__init__.py", line 
178, in addSiteManager
self.context.setSiteManager(sm)
AttributeError: 'Centershock' object has no attribute 'setSiteManager'
127.0.0.1 - zope.manager [3/Apr/2005:17:24:33 -0300] 
"GET /cs/addSiteManager.html HTTP/1.1" 500 311 
"http://localhost:8080/cs/@@contents.html"; "Mozilla/5.0 (compatible; 
Konqueror/3.3; Linux) (KHTML, like Gecko)"


The object I try to add the site to was created after I add the missing 
permission declaration.

> > Or directly inherit from zope.app.folder.interfaces.IFolder?
>
> That would work too, but it might have unwanted side-effects.

Ok, prefer the other way.

Thanks,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Traverse to nearest site in menu action

2005-04-06 Thread Florian Lindner
Am Mittwoch, 6. April 2005 15:33 schrieb Philipp von Weitershausen:
> Florian Lindner wrote:
> > Am Samstag, 2. April 2005 08:37 schrieb Stephan Richter:
> >>On Saturday 02 April 2005 04:38, jÃrgen Kartnaller wrote:
> >>>>Why in the world would you want to do that? This seems just awful. What
> >>>>is your use case?
> >>>
> >>>In my case I want to have the possibility to jump back to my base view
> >>>(which is the default view of my site) from wherever I am within my
> >>> site.
> >>>
> >>>But, if there is an easier way to do this, please let me know.
> >>
> >>Then write a wrapper view for all interfaces that internally looks up the
> >>next site and looks up the default view:
> >>
> >>class SiteDefaultView(object):
> >>
> >>  def __call__(self):
> >>site = getNextSiteSomehow()
> >>defaultViewName = getDefaultViewName(site, self.request, site)
> >>view = zapi.getMultiAdapter((site, request), Interface,
> >>name=defaultViewName) return view()
> >
> > Hello,
> > your solution:
> >
> > class toSite(object):
> > def __call__(self):
> > from zope.app.zapi import *
>
> ugh. Don't do "from xyz import *" imports. Here it's ok maybe because
> the scope of the import is limited to the __call_ method. But still,
> they're highly discouraged.

Sure. I've changed it as soon as I mark this code as stable in my mind. Just 
for quick coding.

> > site = getSite()
> > defaultViewName = getDefaultViewName(site, self.request, site)
> > view = getMultiAdapter((site, self.request),
> > name=defaultViewName) return view()
> >
> > get the same results as mine:
> >
> > class toSite(object):
> > def __call__(self):
> > from zope.app.zapi import absoluteURL
> > URL = absoluteURL(getSite(), self.request)
> > return self.request.response.redirect(URL)
> >
> >
> > What are the differences? Which is better? Why?
> >
> > I think yours is better since it does not involve a redirect. What do you
> > think?
>
> I think your solution is better, Florian. Stephan's solution, while
> correct, makes it look like a site can or maybe even should be accessed
> through http://mysite.com/someobject/@@getSite.html. That's of course
> not true, a site should always be reached at
> http://mysite.com/++etc++site, so IMO it's better to redirect.
>
> (One case where the redirect is definitely better is bookmarks. Imagine
> somebody gets the site through Stephan's solution and bookmarks that
> page. Then, later, 'someobject' is renamed to 'anobject'; now the
> bookmark won't work anymore, even though the site is still there).

Thanks,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] page uses foreign view: context changed

2005-04-06 Thread Florian Lindner
Hello,
I'vw a viewA on a objectA including a macro:



  


A view of objectB uses this macro and inserts it into its own viewB:



My problem is now, that the context of viewA is objectB. But I want it to 
insert some data from objectA. How can I get objectA, the object viewA was 
registered for?

Thanks,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Using IPathAdapter on menuItem

2005-04-27 Thread Florian Lindner
Hello,
I've a a IPathAdapter:

  

(from Stephans HomeFolderManager)

Now I want a menu item that is pointing to that homefolder. How can I do that?

 

Does not work?

Thx,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Using IPathAdapter on menuItem

2005-04-28 Thread Florian Lindner
Am Donnerstag, 28. April 2005 16:43 schrieb Garrett Smith:
> I dont know whether action is evaluated or just passed through. But I
> use the notation:
>
>   foo/++adapter++myadapter/bar
>
> for path adapters. There might be a short-cut syntax, but I don't recall
> what it is.

I've found at that the problem is another one:

Iterating of the keys of the object works:


test


hf returns a object derived from IContainer for the Interface and 
BTreeContainer for the Implementation.

But I want the URL of the object hf returns. Everything I tried with 
absolute_url does not work. Of course I can add a method which returns 
zapi.absoluteURL(self, self.context) to the object but I'm sure there a 
better way. How to get the URL of the object...

Thx,

Florian


> Florian Lindner wrote:
> > Hello,
> > I've a a IPathAdapter:
> >
> >>   for="zope.security.interfaces.IPrincipal"
> >   provides="zope.app.traversing.interfaces.IPathAdapter"
> >   factory=".homefolder.getHomeFolder"
> >   name="hf" />
> >
> > (from Stephans HomeFolderManager)
> >
> > Now I want a menu item that is pointing to that homefolder. How can I
> > do that?
> >
> >  > action="principal/hf"
> > [...]" />
> >
> > Does not work?
> >
> > Thx,
> >
> > Florian
> > ___
> > Zope3-users mailing list
> > Zope3-users@zope.org
> > http://mail.zope.org/mailman/listinfo/zope3-users
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Using IPathAdapter on menuItem

2005-04-28 Thread Florian Lindner
Am Donnerstag, 28. April 2005 21:45 schrieb Garrett Smith:
> I think you want this:
>
>   principal/++adapter++hf/@@absolute_url
>
> Personally, I don't care for the shortcut syntax -- it's not clear
> what's going on (at all). It also doesn't appear to support what you're
> trying to do.

Thanks, works perfect!

Florian


> Florian Lindner wrote:
> > Am Donnerstag, 28. April 2005 16:43 schrieb Garrett Smith:
> >> I dont know whether action is evaluated or just passed through. But
> >> I use the notation:
> >>
> >>   foo/++adapter++myadapter/bar
> >>
> >> for path adapters. There might be a short-cut syntax, but I don't
> >> recall what it is.
> >
> > I've found at that the problem is another one:
> >
> > Iterating of the keys of the object works:
> >
> > 
> > test
> > 
> >
> > hf returns a object derived from IContainer for the Interface and
> > BTreeContainer for the Implementation.
> >
> > But I want the URL of the object hf returns. Everything I tried with
> > absolute_url does not work. Of course I can add a method which returns
> > zapi.absoluteURL(self, self.context) to the object but I'm sure there
> > a better way. How to get the URL of the object...
> >
> > Thx,
> >
> > Florian
> >
> >> Florian Lindner wrote:
> >>> Hello,
> >>> I've a a IPathAdapter:
> >>>
> >>>>>>   for="zope.security.interfaces.IPrincipal"
> >>>   provides="zope.app.traversing.interfaces.IPathAdapter"
> >>>   factory=".homefolder.getHomeFolder"
> >>>   name="hf" />
> >>>
> >>> (from Stephans HomeFolderManager)
> >>>
> >>> Now I want a menu item that is pointing to that homefolder. How can
> >>> I do that?
> >>>
> >>>  >>> action="principal/hf"
> >>>   [...]" />
> >>>
> >>> Does not work?
> >>>
> >>> Thx,
> >>>
> >>> Florian
> >>> ___
> >>> Zope3-users mailing list
> >>> Zope3-users@zope.org
> >>> http://mail.zope.org/mailman/listinfo/zope3-users
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Using IPathAdapter on menuItem

2005-04-30 Thread Florian Lindner
Am Donnerstag, 28. April 2005 21:45 schrieb Garrett Smith:
> I think you want this:
>
>   principal/++adapter++hf/@@absolute_url
>
> Personally, I don't care for the shortcut syntax -- it's not clear
> what's going on (at all). It also doesn't appear to support what you're
> trying to do.

Sorry, I need to come back to you.
The syntax above works perfect in ZPT templates but I can not make it working 
in menuItem action="..." the string I put in the action attribute is simply 
concatenated to the URL and not interpreted.

Thanks,

Florian

>
> Florian Lindner wrote:
> > Am Donnerstag, 28. April 2005 16:43 schrieb Garrett Smith:
> >> I dont know whether action is evaluated or just passed through. But
> >> I use the notation:
> >>
> >>   foo/++adapter++myadapter/bar
> >>
> >> for path adapters. There might be a short-cut syntax, but I don't
> >> recall what it is.
> >
> > I've found at that the problem is another one:
> >
> > Iterating of the keys of the object works:
> >
> > 
> > test
> > 
> >
> > hf returns a object derived from IContainer for the Interface and
> > BTreeContainer for the Implementation.
> >
> > But I want the URL of the object hf returns. Everything I tried with
> > absolute_url does not work. Of course I can add a method which returns
> > zapi.absoluteURL(self, self.context) to the object but I'm sure there
> > a better way. How to get the URL of the object...
> >
> > Thx,
> >
> > Florian
> >
> >> Florian Lindner wrote:
> >>> Hello,
> >>> I've a a IPathAdapter:
> >>>
> >>>>>>   for="zope.security.interfaces.IPrincipal"
> >>>   provides="zope.app.traversing.interfaces.IPathAdapter"
> >>>   factory=".homefolder.getHomeFolder"
> >>>   name="hf" />
> >>>
> >>> (from Stephans HomeFolderManager)
> >>>
> >>> Now I want a menu item that is pointing to that homefolder. How can
> >>> I do that?
> >>>
> >>>  >>> action="principal/hf"
> >>>   [...]" />
> >>>
> >>> Does not work?
> >>>
> >>> Thx,
> >>>
> >>> Florian
> >>> ___
> >>> Zope3-users mailing list
> >>> Zope3-users@zope.org
> >>> http://mail.zope.org/mailman/listinfo/zope3-users
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Using IPathAdapter on menuItem

2005-04-30 Thread Florian Lindner
Hey,
a IMO good solution just came into my mind while taking a nap. I implemented 
the solution in 5 minutes and it workes.
It registered a view:



and the view class:

class toHomeFolder(object):
""" Makes a redirect to the homefolder of the principal. """
def __call__(self):
from zope.app.zapi import absoluteURL, getUtility
from CS.Homefolder.interfaces import ICSHomeFolderManager
hfm = getUtility(ICSHomeFolderManager)
req = self.request
URL = absoluteURL(hfm.getHomeFolder(req.principal.id), req)
req.response.redirect(URL)


Works perfect. :-)

Florian

Am Samstag, 30. April 2005 18:09 schrieb Garrett Smith:
> Looking at the code, I don't see an easy way to do what you want to do.
> The menuItem directive doesn't give you any hooks. It would be nice if
> it supported a class attribute where you could specify your own browser
> menu item class (or mixin) like the page directive.
>
> If you're desparate enough, you can always create your own directive to
> register a menu item with an alternative browser menu item class. That
> class would dynamically provide the 'action' attribute as a property
> value, evaluating whatever path expression it got in the ZCML. If you
> want to go down that road, just copy/paste the existing code,
> substituting YourBrowserMenuItem for BrowserMenuItem for the
> registration code in z/a/publisher/browser/menumeta.py (line 165).
>
> Sorry, I know this is a pain, but the alternative would be to submit a
> feature request and wait (probably a long time :)
>
>  -- Garrett
>
> Florian Lindner wrote:
> > Am Donnerstag, 28. April 2005 21:45 schrieb Garrett Smith:
> >> I think you want this:
> >>
> >>   principal/++adapter++hf/@@absolute_url
> >>
> >> Personally, I don't care for the shortcut syntax -- it's not clear
> >> what's going on (at all). It also doesn't appear to support what
> >> you're trying to do.
> >
> > Sorry, I need to come back to you.
> > The syntax above works perfect in ZPT templates but I can not make it
> > working in menuItem action="..." the string I put in the action
> > attribute is simply concatenated to the URL and not interpreted.
> >
> > Thanks,
> >
> > Florian
> >
> >> Florian Lindner wrote:
> >>> Am Donnerstag, 28. April 2005 16:43 schrieb Garrett Smith:
> >>>> I dont know whether action is evaluated or just passed through.
> >>>> But I use the notation:
> >>>>
> >>>>   foo/++adapter++myadapter/bar
> >>>>
> >>>> for path adapters. There might be a short-cut syntax, but I don't
> >>>> recall what it is.
> >>>
> >>> I've found at that the problem is another one:
> >>>
> >>> Iterating of the keys of the object works:
> >>>
> >>> 
> >>>     test
> >>> 
> >>>
> >>> hf returns a object derived from IContainer for the Interface and
> >>> BTreeContainer for the Implementation.
> >>>
> >>> But I want the URL of the object hf returns. Everything I tried with
> >>> absolute_url does not work. Of course I can add a method which
> >>> returns zapi.absoluteURL(self, self.context) to the object but I'm
> >>> sure there a better way. How to get the URL of the object...
> >>>
> >>> Thx,
> >>>
> >>> Florian
> >>>
> >>>> Florian Lindner wrote:
> >>>>> Hello,
> >>>>> I've a a IPathAdapter:
> >>>>>
> >>>>>>>>>>   for="zope.security.interfaces.IPrincipal"
> >>>>>   provides="zope.app.traversing.interfaces.IPathAdapter"
> >>>>>   factory=".homefolder.getHomeFolder"
> >>>>>   name="hf" />
> >>>>>
> >>>>> (from Stephans HomeFolderManager)
> >>>>>
> >>>>> Now I want a menu item that is pointing to that homefolder. How
> >>>>> can I do that?
> >>>>>
> >>>>>  >>>>> action="principal/hf"
> >>>>> [...]" />
> >>>>>
> >>>>> Does not work?
> >>>>>
> >>>>> Thx,
> >>>>>
> >>>>> Florian
> >>>>> ___
> >>>>> Zope3-users mailing list
> >>>>> Zope3-users@zope.org
> >>>>> http://mail.zope.org/mailman/listinfo/zope3-users
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Using metadata for description

2005-05-02 Thread Florian Lindner

Hello,
I want to allow the user to give items a short description, like for a link:

Name: Zope
URL: http://zope.org
Description: Homepage of Zope, a web application server

Is it wise to use the metadata description field for that purpose or should I just add a TextLine attribute to the interface.
If it's good to use metadata: How can I directly use metadata from ZPTs?

Thx,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Using metadata for description

2005-05-05 Thread Florian Lindner
Am Mittwoch, 4. Mai 2005 08:40 schrieb Philipp von Weitershausen:
> Florian Lindner wrote:
> > Hello,
> >
> > I want to allow the user to give items a short description, like for a
> > link:
> >
> > Name: Zope
> > URL: http://zope.org
> > Description: Homepage of Zope, a web application server
> >
> > Is it wise to use the metadata description field for that purpose or
> > should I just add a TextLine attribute to the interface.
>
> If this "description" has little or nothing to do with the actual item,
> but is only there for categorizing it or similar, I'd use the DublinCore
> 'description' field.

Mmmhh, not easy to tell...  ;-)
How would you solve the case above? The user just uses it to describe it, The 
application itself makes no use of it.


Florian

>
> > If it's good to use metadata: How can I directly use metadata from ZPTs?
>
> Through the 'zope' TALES namespace, e.g. obj/zope:description. Not all
> DublinCore metadata is available through that, though. See
> zope.tales.interfaces.ITALESFunctionNamespace for a list of available
> names.
>
> Philipp
>
> ___
> Zope3-users mailing list
> Zope3-users@zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Using metadata for description

2005-05-06 Thread Florian Lindner
Am Donnerstag, 5. Mai 2005 18:51 schrieb Derrick Hudson:
> On Thu, May 05, 2005 at 04:38:00PM +0200, Florian Lindner wrote:
> | Am Mittwoch, 4. Mai 2005 08:40 schrieb Philipp von Weitershausen:
> | > Florian Lindner wrote:
> | > > Hello,
> | > >
> | > > I want to allow the user to give items a short description, like for
> | > > a link:
> | > >
> | > > Name: Zope
> | > > URL: http://zope.org
> | > > Description: Homepage of Zope, a web application server
> | > >
> | > > Is it wise to use the metadata description field for that purpose or
> | > > should I just add a TextLine attribute to the interface.
> | >
> | > If this "description" has little or nothing to do with the actual item,
> | > but is only there for categorizing it or similar, I'd use the
> | > DublinCore 'description' field.
> |
> | Mmmhh, not easy to tell...  ;-)
> | How would you solve the case above? The user just uses it to describe it,
> | The application itself makes no use of it.
>
> I would lean towards Dublin Core for that.  It isn't actually part of
> the data, if the application doesn't use it.  It's more like an
> extension, which is what adapters are for.

Ok, I've done it as metadata now.

How can I automatically create a addform that allows the user to enter the 
metadate zope:description and the __name__. Using addform->fields has not 
worked.

Thanks,
Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Using metadata and __name__ in addform

2005-05-10 Thread Florian Lindner
Hello,
how can I automatically create a addform that allows the user to enter the 
metadate zope:description and the __name__. Using addform->fields has not 
worked.

Thanks,
Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Using metadata and __name__ in addform

2005-05-11 Thread Florian Lindner
Am Dienstag, 10. Mai 2005 23:34 schrieb Fred Drake:
> On 5/10/05, Florian Lindner <[EMAIL PROTECTED]> wrote:
> > how can I automatically create a addform that allows the user to enter
> > the metadate zope:description and the __name__. Using addform->fields has
> > not worked.
>
> There are a couple of ways.
>
> 1.  Use a custom class and template.  This isn't so hard, but makes it
> harder to change the schema at a later time (since the form has to be
> changed).
>
> 2.  Add a field to the schema that provide the specific metadata field
> you want, and create a specialized Dublin Core adapter.  Then the
> field from the schema is just another field, and you don't have to use
> a custom class and template.
>
> Luckily for you, I just made the later easier on the Zope 3 trunk last
> night.  :-)  See src/zope/app/dublincore/partial.txt for more
> information on how to do this.

Hey!

  A   Zope3/trunk/src/zope/app/dublincore/tests/partial.txt

is this document somehow available via the ++apidoc++ tool? I haven't found 
it. If it is not there, why not include in the "Textesammlung" (Collection of 
textes)?

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Using metadata and __name__ in addform

2005-05-11 Thread Florian Lindner
Am Dienstag, 10. Mai 2005 23:34 schrieb Fred Drake:
> On 5/10/05, Florian Lindner <[EMAIL PROTECTED]> wrote:
> > how can I automatically create a addform that allows the user to enter
> > the metadate zope:description and the __name__. Using addform->fields has
> > not worked.
>
> There are a couple of ways.
>
> 1.  Use a custom class and template.  This isn't so hard, but makes it
> harder to change the schema at a later time (since the form has to be
> changed).
>
> 2.  Add a field to the schema that provide the specific metadata field
> you want, and create a specialized Dublin Core adapter.  Then the
> field from the schema is just another field, and you don't have to use
> a custom class and template.
>
> Luckily for you, I just made the later easier on the Zope 3 trunk last
> night.  :-)  See src/zope/app/dublincore/partial.txt for more
> information on how to do this.

Hello,
one more question:

factory = annotatableadapter.partialAnnotatableAdapterFactory(["title"])


I'm not sure where to place this call (in the interface, in the 
implementation, in which function, ...) and what to do with the factory 
variable. Is there a real example for that? Besides the tests in partial.txt.

Thanks,

Florian

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Using metadata and __name__ in addform

2005-05-12 Thread Florian Lindner
Am Donnerstag, 12. Mai 2005 15:52 schrieb Fred Drake:
> On 5/11/05, Florian Lindner <[EMAIL PROTECTED]> wrote:
> > factory = annotatableadapter.partialAnnotatableAdapterFactory(["title"])
> >
> > I'm not sure where to place this call (in the interface, in the
> > implementation, in which function, ...) and what to do with the factory
> > variable. Is there a real example for that? Besides the tests in
> > partial.txt.
>
> Here, "factory" is a new IZopeDublinCore factory.  It should be
> registered as the adapter for the relevant content type via ZCML:
>
>  for=".impl.MyContentClass"
> provides="zope.app.dublincore.interfaces.IZopeDublinCore"
> factory="impl.factory"
> />
>
> Does this help?

Yeah, I think I got the point...

Pretty much to write. What do you think about the idea to create a new field 
type (something like Text, TextLine, Choice) named DCTitle for example which 
is derived from TextLine but always mirrors the DC Title metadata. So I could 
define a field in a scheme like that:


name = DCTitle(
title = u"My DC title field",
description = u"This mirrors the DC title field",
required = True   # or False
)

What do you think about that?

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Using metadata and __name__ in addform

2005-05-16 Thread Florian Lindner
Am Dienstag, 10. Mai 2005 23:34 schrieb Fred Drake:
> On 5/10/05, Florian Lindner <[EMAIL PROTECTED]> wrote:
> > how can I automatically create a addform that allows the user to enter
> > the metadate zope:description and the __name__. Using addform->fields has
> > not worked.
>
> There are a couple of ways.
>
> 1.  Use a custom class and template.  This isn't so hard, but makes it
> harder to change the schema at a later time (since the form has to be
> changed).
>
> 2.  Add a field to the schema that provide the specific metadata field
> you want, and create a specialized Dublin Core adapter.  Then the
> field from the schema is just another field, and you don't have to use
> a custom class and template.
>
> Luckily for you, I just made the later easier on the Zope 3 trunk last
> night.  :-)  See src/zope/app/dublincore/partial.txt for more
> information on how to do this.

Hi!
You also have an idea for a way to let the user not ony set metadata but also 
the __name__ attribute?

Thx,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Using metadata and __name__ in addform

2005-05-16 Thread Florian Lindner
Am Donnerstag, 12. Mai 2005 15:52 schrieb Fred Drake:
> On 5/11/05, Florian Lindner <[EMAIL PROTECTED]> wrote:
> > factory = annotatableadapter.partialAnnotatableAdapterFactory(["title"])
> >
> > I'm not sure where to place this call (in the interface, in the
> > implementation, in which function, ...) and what to do with the factory
> > variable. Is there a real example for that? Besides the tests in
> > partial.txt.
>
> Here, "factory" is a new IZopeDublinCore factory.  It should be
> registered as the adapter for the relevant content type via ZCML:
>
>  for=".impl.MyContentClass"
> provides="zope.app.dublincore.interfaces.IZopeDublinCore"
> factory="impl.factory"
> />
>
> Does this help?

Hello,
I've implemented it now, but I get the following error when I try to change or 
add a new ILink.
I'm logged in as zope.Manager.

My configure.zcml:



My link.py:

[...]
from zope.app.dublincore import annotatableadapter

factory = annotatableadapter.partialAnnotatableAdapterFactory(["description"])

the description field is defined in the interface:

description = TextLine (
title = u"Description",
description = u"Description which mirrors the DC metadata.",
required = False)

What is wrong there?

Thanks,

Florian


2005-05-16T17:26:57 ERROR SiteError 
http://localhost:8080/cs/home/zope.manager/+/AddCSLink.html%3D
Traceback (most recent call last):
  File "/home/florian/Zope3/src/zope/publisher/publish.py", line 138, in 
publish
result = publication.callObject(request, object)
  File "/home/florian/Zope3/src/zope/app/publication/zopepublication.py", line 
164, in callObject
return mapply(ob, request.getPositionalArguments(), request)
  File "/home/florian/Zope3/src/zope/publisher/publish.py", line 113, in 
mapply
return debug_call(object, args)
  File "/home/florian/Zope3/src/zope/publisher/publish.py", line 119, in 
debug_call
return object(*args)
  File "/home/florian/Zope3/src/zope/app/pagetemplate/simpleviewclass.py", 
line 44, in __call__
return self.index(*args, **kw)
  File 
"/home/florian/Zope3/src/zope/app/pagetemplate/viewpagetemplatefile.py", line 
83, in __call__
return self.im_func(im_self, *args, **kw)
  File 
"/home/florian/Zope3/src/zope/app/pagetemplate/viewpagetemplatefile.py", line 
51, in __call__
sourceAnnotations=getattr(debug_flags, 'sourceAnnotations', 0),
  File "/home/florian/Zope3/src/zope/pagetemplate/pagetemplate.py", line 117, 
in pt_render
strictinsert=0, sourceAnnotations=sourceAnnotations)()
  File "/home/florian/Zope3/src/zope/tal/talinterpreter.py", line 234, in 
__call__
self.interpret(self.program)
  File "/home/florian/Zope3/src/zope/tal/talinterpreter.py", line 309, in 
interpret
handlers[opcode](self, args)
  File "/home/florian/Zope3/src/zope/tal/talinterpreter.py", line 806, in 
do_useMacro
self.interpret(macro)
  File "/home/florian/Zope3/src/zope/tal/talinterpreter.py", line 309, in 
interpret
handlers[opcode](self, args)
  File "/home/florian/Zope3/src/zope/tal/talinterpreter.py", line 497, in 
do_optTag_tal
self.do_optTag(stuff)
  File "/home/florian/Zope3/src/zope/tal/talinterpreter.py", line 482, in 
do_optTag
return self.no_tag(start, program)
  File "/home/florian/Zope3/src/zope/tal/talinterpreter.py", line 477, in 
no_tag
self.interpret(program)
  File "/home/florian/Zope3/src/zope/tal/talinterpreter.py", line 309, in 
interpret
handlers[opcode](self, args)
  File "/home/florian/Zope3/src/zope/tal/talinterpreter.py", line 776, in 
do_defineMacro
self.interpret(macro)
  File "/home/florian/Zope3/src/zope/tal/talinterpreter.py", line 309, in 
interpret
handlers[opcode](self, args)
  File "/home/florian/Zope3/src/zope/tal/talinterpreter.py", line 878, in 
do_defineSlot
self.interpret(block)
  File "/home/florian/Zope3/src/zope/tal/talinterpreter.py", line 309, in 
interpret
handlers[opcode](self, args)
  File "/home/florian/Zope3/src/zope/tal/talinterpreter.py", line 868, in 
do_defineSlot
self.interpret(slot)
  File "/home/florian/Zope3/src/zope/tal/talinterpreter.py", line 309, in 
interpret
handlers[opcode](self, args)
  File "/home/florian/Zope3/src/zope/tal/talinterpreter.py", line 776, in 
do_defineMacro
self.interpret(macro)
  File "/home/florian/Zope3/src/zope/tal/talinterpreter.py", line 309, in 
interpret
handlers[opcode](self, args)
  File "/home/florian/Zope3/src/zope/tal/talinterpreter.py", line 776, in 
do_defineMacro
self.interpret(macro)
  File "/ho

[Zope3-Users] Question/Problem with UserPreferences

2005-06-09 Thread Florian Lindner
Hello,
I try to use the User Preference API.

I've defined a Interface:

class IUserSettings(Interface):
email = TextLine(
title = u"E-mail Address")

and registered it in my configure.zcml:



First question: What happens if two configure.zcml files register a preference 
group with the same name?

When I go to http://localhost:8080/++preferences++ I see a page which - amoung 
others - displays my preferencce group. 
http://localhost:8080/++preferences++/UserSettings displays only my group.

I try to use the value of email in a ZPT:

  E-Mail: 

or

  E-Mail: 

both give this traceback:

PTRuntimeError: ['Compilation failed', 'zope.tal.taldefs.TALError: Invalid 
variable name "email" in expression \'++preferences++UserSettings/email\', at 
line 6, column 15']

What is wrong there?

Thanks,

Florian

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Question/Problem with UserPreferences

2005-06-10 Thread Florian Lindner
Am Freitag, 10. Juni 2005 14:06 schrieb Stephan Richter:
> On Thursday 09 June 2005 12:44, Florian Lindner wrote:
> > I try to use the value of email in a ZPT:
> >
> >       E-Mail: 
> >
> > or
> >
> >       E-Mail: 
> >
> > both give this traceback:
> >
> > PTRuntimeError: ['Compilation failed', 'zope.tal.taldefs.TALError:
> > Invalid variable name "email" in expression
> > \'++preferences++UserSettings/email\', at line 6, column 15']
> >
> > What is wrong there?
>
> This is not a preferences error, but a pagetemplate one. I have no clue
> what could have gone wrong here. Can you try a different name? Maybe
> something like `email1`? I suspect a clash of variable names.

I've tried email1 and emailX as variable names. Both produce exactly the same 
error.
I got no idea what is wrong there...

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Question/Problem with UserPreferences

2005-06-10 Thread Florian Lindner
Am Freitag, 10. Juni 2005 20:34 schrieb Stephan Richter:
> On Friday 10 June 2005 14:13, Florian Lindner wrote:
> > > This is not a preferences error, but a pagetemplate one. I have no clue
> > > what could have gone wrong here. Can you try a different name? Maybe
> > > something like `email1`? I suspect a clash of variable names.
> >
> > I've tried email1 and emailX as variable names. Both produce exactly the
> > same error.
> > I got no idea what is wrong there...
>
> Can you attach the entire PT script?

Of course.

Attached is usersettings.pt which contains the line that produces the eror and 
template.pt which provides the page standard_macro.

Florian

  

  
  User Settings
  E-Mail: 



  

  
  
  
  

  



Navigation: 

[ navItem ]


Items to add: 

[ addItem ]


  User: 



  template.pt
  
This is the content.
  



  
  
  

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Question/Problem with UserPreferences

2005-06-10 Thread Florian Lindner
Am Freitag, 10. Juni 2005 20:59 schrieb Stephan Richter:
> On Friday 10 June 2005 14:44, Florian Lindner wrote:
> > > Can you attach the entire PT script?
> >
> > Of course.
> >
> > Attached is usersettings.pt which contains the line that produces the
> > eror and template.pt which provides the page standard_macro.
>
> try: "context/++preferences++/UserSettings/email"
> instead of: "++preferences++/UserSettings/email"
>
> I think this will work, since this is how I do it in API Doc as well.

Oh, yeah, that works!

Thanks,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Updating preferences from ZPT

2005-06-14 Thread Florian Lindner
Hello,
I want to update user preferences from a ZPT. The user should hit "Update" and 
get redirected to the same page with the updates values.

I've tried a form







This was pasted from the site the preferences package autogenerates. It works 
so far, but changing fields have no effect.

Do I need to use a view class?

Which attribute do I use to update the preferences? What is the best way to 
redirect or directly output the template the view class is associated with?

Thanks,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Updating preferences from ZPT

2005-06-18 Thread Florian Lindner
Am Dienstag, 14. Juni 2005 22:29 schrieb Florian Lindner:
> What is the best way to redirect or directly output the template the view 
class is associated with?

Ok, I redo my question. Just this part.

How can I just ouput the template from a view class:

class view:
def __call__(self):
return template

How to do that?

Thanks,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Output the template of a view class

2005-06-21 Thread Florian Lindner
Hello,
sine I suspect my last email to have drowned on the list, I try to ask again.

How can I ouput the template from the associated view class?

class view:
def __call__(self):
return template

How to do that?

Thanks,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Output the template of a view class

2005-06-21 Thread Florian Lindner
Am Dienstag, 21. Juni 2005 18:41 schrieb Jim Fulton:
> Florian Lindner wrote:
> > Hello,
> > sine I suspect my last email to have drowned on the list, I try to ask
> > again.
> >
> > How can I ouput the template from the associated view class?
> >
> > class view:
> > def __call__(self):
> > return template
> >
> > How to do that?
>
> Assuming that the template was defines via ViewPageTemplateFile, then:

It is defined with ZCML:



>return self.template()

  File 
"/home/florian/Desktop/zope/lib/python/CS/centershock/browser/skin/views.py", 
line 24, in __call__
return self.template()
AttributeError: 'SimpleViewClass from /home/florian/Desktop/zope/li' object 
has no attribute 'template'

I wonder why the last path is truncated... However, it does not work.

Thanks,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Output the template of a view class

2005-06-22 Thread Florian Lindner
Am Mittwoch, 22. Juni 2005 08:34 schrieb Sven Schomaker:
> Hi Florian,
>
> AFAIK there is actually no need to manually return
> the pagetemplate if you've registered your page via
> zcml, since the page directive creates a new
> SimpleViewClass with your class definition and
> template as a mix-in.

A __call__ without any return cause the template to output nothing.

>
> Nevertheless the SimpleViewClass created exposes the
> template provided by the zcml as an attribute
> called 'index' and returns it in the __call__ method
> itself.
>
> Look at the code in zope.app.pagetemplate.simpleviewclass
> to see how it works.
>
> So if your willing to return the template yourself, just
> define the __call__ method in your view class like this:
>
> def __call__(self):
> return self.index()


This works!

Thanks,

Florian

>
> This should do the trick (Tried it myself to assure
> not being mistaken, but if so please don't let me die
> untaught!). But you definetly should not have to do it,
> since it's supposed to work right out of the box.
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Syncing two attributes

2005-06-24 Thread Florian Lindner
Hello,
I've one attribute A which is exposed via the Interface. Another internal 
attribute B should be in sync with it. So everytime A changes I want a 
function to be called. 

I think (solving another error stands before testing it) with __setattr__:

def __setattr__(self, name, value):
if name == "expirationTime":
self.expTimeDelta = datetime.timedelta(minutes = value)

self.__dict__[name] = value

But I really don't like that way? Is there elegant, more zope-like solution? 
Or is this the way to do it?

Thanks,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Getting all principals from PAU

2005-06-28 Thread Florian Lindner
Hello,
I want to list all principals from all sources that support listing there 
principals (or at least agnostic to the source) from a PAU.

I've party accomplished it with:

pau = getUtility(IAuthentication)
   
for queriables in list(pau.getQueriables()):
for user in queriables[1].items():
print user


prints:

(u'1', )
(u'flo', )

But I suspect this code to be highly dependend of the principal folder.

What is the best and most generic way to do that?

Thanks,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Inline code in ZPT

2005-07-06 Thread Florian Lindner
Am Mittwoch, 6. Juli 2005 21:47 schrieb Nicolas Legault:
> Two questions:
>
> 1:
> Is it possible to have Inline code in a page template that is created on
> the host file system, not throught the ZMI ? I got an error that inline
> code is not activated, where do I activate it ?
>
> 2:
> Is it a bug or this code is now not supported in Zope 3.1 ZPT ?
>
>   01 
>   02   
>   03 global x
>   04 x = "Hello World!"
>   05   
>   06   
>   07 
> this code is from
> http://www.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/Zope3GUI

I don't know if it is still possible.
>
> If it's not supported anymore, is there a way to return values from the
> python script and use them in the zpt ?

You can always define a view class and use the return value of a function:



In your file pyfile:

class viewclass:
def foo(self):
return "bar"

and now you can use a TAL expression like that:



is being replaced with:

bar


Hope that helps,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Re: [Zope3-dev] (no subject)

2005-07-09 Thread Florian Lindner
Am Samstag, 9. Juli 2005 02:20 schrieb aaron wang:
> hi all,
> I am a newcomer to python & zope, I read some materials, and want to know
> wheather I could start on zope3 without experience on zope2. I want start
> on my learning by  constructing a small website, but I don't have right
> book/tutorial for reference.
>
> Thanks your reply in advance

Hi Aaron,
there are currently two books around. Stephans Zope3 book is more a reference 
guide. It is available both online and printed. The online version can be 
found at 
http://www.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/Zope3Book. 
But at the moment the printed version is much more recent that the online 
version.

Philipps book is more aimed toward beginners and available only printed. The 
homepage is http://worldcookery.com/.

A good starting point for all kinds of Zope3 documentation is 
http://www.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/Documentation.

BTW: This is the list for people developing Zope3, not for people developing 
_with_ Zope3.  ;-) zope3-users@zope.org would be more appropriate  for your 
question. (http://www.zope.org/Resources/MailingLists). I'm alos posting a 
follow up there.

Hope that helps,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Problems with PartialAnnotationsAdapter

2005-07-25 Thread Florian Lindner
Hello,
without change of my codebase my objects which use the partial annotations 
adapter are not working anymore. I use it like that:

contentitem.py:

from zope.app.dublincore import annotatableadapter

factory = annotatableadapter.partialAnnotatableAdapterFactory(["title", 
"description"])


configure.zcml:



As soon as I try to get DC metadata (for example in a content view of the 
container) I get this traceback:


  File "/home/florian/Zope3/src/zope/app/container/browser/contents.py", line 
96, in listContentInfo
return self._normalListContentsInfo()
  File "/home/florian/Zope3/src/zope/app/container/browser/contents.py", line 
122, in _normalListContentsInfo
info = map(self._extractContentInfo, self.context.items())
  File "/home/florian/Zope3/src/zope/app/container/browser/contents.py", line 
169, in _extractContentInfo
info['retitleable'] = canWrite(dc, 'title')
  File "/home/florian/Zope3/src/zope/security/checker.py", line 96, in 
canWrite
checker.check_setattr(obj, name)
ForbiddenAttribute: ('title', 
)


I'm logged in a zope.Manager, the adapter is trusted and has public access.

What is wrong with my permissions?

Thanks,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Problems with PartialAnnotationsAdapter

2005-07-26 Thread Florian Lindner
Am Montag, 25. Juli 2005 15:47 schrieb Fred Drake:
> You need to make the title attribute of the new adapter writable.  Use
> something like:
>
>   
>              permission="zope.View"
>         interface="zope.app.dublincore.interfaces.IZopeDublinCore"
>         />
>              permission="zope.ManageContent"
>         set_attributes="created modified title"
>         />
>   

Mmmhh, I'm wondering why it used to work about 2 weeks ago... Why are these 
class declarations necessary? Everything is file-based code, so AFAIK there 
should not be a problem with permissions.


Anyways, I am not able to make it work with that. It's still the same 
traceback:

  File "/home/florian/Zope3/src/zope/app/container/browser/contents.py", line 
169, in _extractContentInfo
info['retitleable'] = canWrite(dc, 'title')
  File "/home/florian/Zope3/src/zope/security/checker.py", line 96, in 
canWrite
checker.check_setattr(obj, name)

I've also tried to change the zope.ManageContent to zope.Public, but does 
change nothing.


Thanks,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Using attributes in a nameChooser

2005-08-05 Thread Florian Lindner
Hello,
in a Containers chooseName function I want to use a attribute of the created 
object:

def chooseName(self, name, object):
return object.name


  File 
"/home/florian/Desktop/zope/lib/python/CS/ContentFolder/contentfolder.py", 
line 15, in chooseName
return object.name
AttributeError: 'Link' object has no attribute 'name'


Even though apidoc says there is a attribute name.

Or is it impossible to access the attributes at this time of the creation 
process?

Thanks,

Florian

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Using attributes in a nameChooser

2005-08-05 Thread Florian Lindner
Am Freitag, 5. August 2005 15:49 schrieb Ruslan Spivak:
> В Птн, 05/08/2005 в 12:25 +0200, Florian Lindner пишет:
> > Hello,
> > in a Containers chooseName function I want to use a attribute of the
> > created object:
> >
> > def chooseName(self, name, object):
> > return object.name
> >
> >
> >   File
> > "/home/florian/Desktop/zope/lib/python/CS/ContentFolder/contentfolder.py"
> >, line 15, in chooseName
> > return object.name
> > AttributeError: 'Link' object has no attribute 'name'
>
> You should define atributes from schema you want to access with
> set_before_add in your addform directive.

This works perfect.

Can this set_before_add behevoir be somehow defined global for the object or 
even better be imposed by the container? So that it does not need to be 
declared by every addform.

Thanks,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Using attributes in a nameChooser

2005-08-06 Thread Florian Lindner
Am Freitag, 5. August 2005 21:21 schrieb Ruslan Spivak:
> Florian Lindner <[EMAIL PROTECTED]> writes:
>
> [...]
>
> > Can this set_before_add behevoir be somehow defined global for the object
> > or even better be imposed by the container? So that it does not need to
> > be declared by every addform.
>
> Not sure.

Ok.

Let me explain why I want to do that. I still have the problem that I want to 
enable to user to enter the __name__ of the object on creation (in the 
addform).
Now it's working more or less. In the chooseName function I read out name 
attribute and return this name. One problem of this method is that I can not 
really return an validation error of the name field if the name is already 
taken. AFAIK I can't develop a custom schema field that validates it before, 
because fields do not have access to their objects.

What do you think is the best solution of the problem above? Simply that the 
user could choose a name of the object.

Thanks,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Still problems with partialAnnotationsAdapter

2005-08-19 Thread Florian Lindner
Hello,
I'm still having problems with the partialAnnotationsAdapter.
Refer to my posting:

Subject: [Zope3-Users] Problems with PartialAnnotationsAdapter
From: Florian Lindner <[EMAIL PROTECTED]>
To: zope3-users@zope.org
Date: 25.07.2005 15:14

or

http://www.zope.org/Collectors/Zope3-dev/438

I've created a minimalistic (2,7 KB unzipped size) content type that 
demonstrates the problem.
It is uploaded at http://xgm.de/partial.tar.gz.

I would really appreciate it, if someone might have a look at it. I've tested 
with the newest SVN version (from 2 hours ago) and I've also created a new 
plain instance for it. The described error still persists.

Another thing that puzzles me, is that altough I've defined a schema field 
"description" the addform is empty.
As soon as I've entered a object id and clicked "Add" the error comes up. I've 
the item was added to the root folder I'm unable to get into the ZMI without 
deleting the files in instance/var. (which is not a problem for me)

Thanks!

Florian

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Using building blocks for forms

2005-09-02 Thread Florian Lindner
Hello,
probably now one knows what I mean with this subject but it was the best that 
came into my mind. ;-)

I'm using a customized addform (by setting the template and view attributes). 
My template looks exactly like the auto-generated addform but adds another 
input field and compute the values of that in the view class.

It would be nice if I can reuse parts of the auto generated form. For example 
the error reporting of the fields. Is that possible? Or do I need to redo 
everything when using a template?

Thanks,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Function for validation

2005-09-04 Thread Florian Lindner
Hello,
I use a view class for a addform. IIRC there is a defined name for a function 
in the view class that is called form zope in order to validate the input. I 
thought its name were validate. But in my viewclass

class AddForm(object):
def validate():
import pdb
pdb.set_trace()

Is never called.

What is its name?

Thanks,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Calling createAndAdd with different object id

2005-09-10 Thread Florian Lindner
Hello,
I want to override the createAndAdd method mothed in a view class. Since I 
don't want to do all the work I want to derive my class from the AddView 
class from /home/florian/Zope3/src/zope/app/form/browser/add.py. The only 
thing I do in my class is to change the name (object id) of the object to be 
created. In the arguments of the createAndAdd method I have not found any 
information about the id. How can I alter the name?

Thanks,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Calling createAndAdd with different object id

2005-09-11 Thread Florian Lindner
Am Samstag, 10. September 2005 18:53 schrieb Adam Groszer:
> Hello Florian,
>
> I suggest you download the examples for Philipp's book from
> http://worldcookery.com/files/examples-1.0.tgz
> Have a look at \examples-1.0\14containers\folder.py.

A INameChooser adapter would really be perfect for me. But I need access to 
the form data of the add form. And AFAIK I don't have this using the 
NameChooser. You now a way to get the form data in the NameChooser?

Thanks,

Florian

>
> Saturday, September 10, 2005, 5:05:26 PM, you wrote:
> > Hello,
> > I want to override the createAndAdd method mothed in a view class. Since
> > I don't want to do all the work I want to derive my class from the
> > AddView class from /home/florian/Zope3/src/zope/app/form/browser/add.py.
> > The only thing I do in my class is to change the name (object id) of the
> > object to be created. In the arguments of the createAndAdd method I have
> > not found any information about the id. How can I alter the name?
> >
> > Thanks,
> >
> > Florian
> > ___
> > Zope3-users mailing list
> > Zope3-users@zope.org
> > http://mail.zope.org/mailman/listinfo/zope3-users
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Calling createAndAdd with different object id

2005-09-11 Thread Florian Lindner
Am Sonntag, 11. September 2005 03:52 schrieb Alen Stanisic:
> I don't think you would do it in AddView.  You need to implement an
> adapter for your container providing
> zope.app.container.interfaces.INameChooser where chooseName() method
> will return name for you objects.

A INameChooser adapter would really be perfect for me. But I need access to 
the form data of the add form. And AFAIK I don't have this using the 
NameChooser. You now a way to get the form data in the NameChooser?

Thanks,

Florian


> Alen
>
> On Sat, 2005-09-10 at 17:05 +0200, Florian Lindner wrote:
> > Hello,
> > I want to override the createAndAdd method mothed in a view class. Since
> > I don't want to do all the work I want to derive my class from the
> > AddView class from /home/florian/Zope3/src/zope/app/form/browser/add.py.
> > The only thing I do in my class is to change the name (object id) of the
> > object to be created. In the arguments of the createAndAdd method I have
> > not found any information about the id. How can I alter the name?
> >
> > Thanks,
> >
> > Florian
> > ___
> > Zope3-users mailing list
> > Zope3-users@zope.org
> > http://mail.zope.org/mailman/listinfo/zope3-users
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Object Name field on addforms

2005-09-11 Thread Florian Lindner
Hello
the auto generated add forms sometimes dispaly a field for the Object Name.

add.pt

 
     Object Name  
  

This is depended if the container implements IContainerNamesContainer:

app.py


def nameAllowed(self):
"""Return whether names can be input by the user."""
return not IContainerNamesContainer.providedBy(self.context)

I have a Container (implementing IContainer, Interface (via Interface 
inheritance) and via ZCML IAttributeAnnotatable and IContentContainer.

On the auto-generated addform in my layer the Object Name is not shown. Why?

Thanks,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Object Name field on addforms

2005-09-11 Thread Florian Lindner
Am Sonntag, 11. September 2005 15:04 schrieb Florian Lindner:
> Hello
> the auto generated add forms sometimes dispaly a field for the Object Name.
>

add.pt in src/zope/app/form/browser

>
>  
>  Object Name  
> tal:attributes="value context/contentName" />
>
> This is depended if the container implements IContainerNamesContainer:
>

correct: adding.py in zope/app/container/browser

>
>
> def nameAllowed(self):
> """Return whether names can be input by the user."""
> return not IContainerNamesContainer.providedBy(self.context)
>
> I have a Container (implementing IContainer, Interface (via Interface
> inheritance) and via ZCML IAttributeAnnotatable and IContentContainer.
>
> On the auto-generated addform in my layer the Object Name is not shown.
> Why?
>
> Thanks,
>
> Florian
> ___
> Zope3-users mailing list
> Zope3-users@zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Object Name field on addforms

2005-09-11 Thread Florian Lindner
Am Sonntag, 11. September 2005 15:04 schrieb Florian Lindner:
> Hello
> the auto generated add forms sometimes dispaly a field for the Object Name.
>
> add.pt
>
>  
>  Object Name  
> tal:attributes="value context/contentName" />
>
> This is depended if the container implements IContainerNamesContainer:
>
> app.py
>
>
> def nameAllowed(self):
> """Return whether names can be input by the user."""
> return not IContainerNamesContainer.providedBy(self.context)
>
> I have a Container (implementing IContainer, Interface (via Interface
> inheritance) and via ZCML IAttributeAnnotatable and IContentContainer.
>
> On the auto-generated addform in my layer the Object Name is not shown.
> Why?

Another addition:

The field is displayed when the addform is called with 
folder/+/AddCSLink.html.
When folder/AddCSLink.html is is not displayed.
What is the difference between these two?

Unfortunatly when you use the addform directive to register a menu item the 
action is folder/AddCSLink.html. Can this be changed?

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Object Name field on addforms

2005-09-12 Thread Florian Lindner
Am Sonntag, 11. September 2005 20:22 schrieb Stephan Richter:
> On Sunday 11 September 2005 09:04, Florian Lindner wrote:
> > I have a Container (implementing IContainer, Interface (via Interface
> > inheritance) and via ZCML IAttributeAnnotatable and IContentContainer.
> >
> > On the auto-generated addform in my layer the Object Name is not shown.
> > Why?
>
> Because your container does not implement IContainerNamesContainer.

If I make my container implementing IContainerNamesContainer the form field in 
never displayed (doesn't matter if I use the folder/+/addview or 
folder/addview URL).

I understand the code that the form field in only shown when the container 
does NOT implement IContainerNamesContainer. Is that not right?


def nameAllowed(self):
return not IContainerNamesContainer.providedBy(self.context)






Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Object Name field on addforms

2005-09-12 Thread Florian Lindner
Am Sonntag, 11. September 2005 20:25 schrieb Stephan Richter:
> On Sunday 11 September 2005 10:07, Florian Lindner wrote:
> > The field is displayed when the addform is called with
> > folder/+/AddCSLink.html.
>
> In this case AddCSLink.html is a view for IAdding.
>
> > When folder/AddCSLink.html is is not displayed.
>
> Here AddCSLink.html is a view of IContainer.
>
> > What is the difference between these two?
>
> I am surprised both would work. Only the first one should.

Both forms are displayed. But when I tried to actually add the object the 
latter way (which is not supposed to work) generates a system error:

  File "/home/florian/Zope3/src/zope/app/form/browser/add.py", line 134, in 
add
return self.context.add(content)
ForbiddenAttribute: ('add', )

The first one works.

> > Unfortunatly when you use the addform directive to register a menu item
> > the action is folder/AddCSLink.html. Can this be changed?
>
> Don't use the menu/title attributes of form:addform. Use the
> browser:addMenuItem directive instead.

Ok. But why does the addform directive registers a menu item with a action 
which is not even supposed to work? Isn't that considered a bug?

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Object Name field on addforms

2005-09-12 Thread Florian Lindner
Am Montag, 12. September 2005 15:07 schrieb Stephan Richter:
> On Monday 12 September 2005 09:02, Florian Lindner wrote:
> > > Because your container does not implement IContainerNamesContainer.
> >
> > If I make my container implementing IContainerNamesContainer the form
> > field in never displayed (doesn't matter if I use the folder/+/addview or
> > folder/addview URL).
> >
> > I understand the code that the form field in only shown when the
> > container does NOT implement IContainerNamesContainer. Is that not right?
>
> Oops, my bad; you are right. BTW, are you using the default template?

Not really, but only a slight modification:


  
  
  http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
  

  Testtitle
   
  
  
   
  

  



navigation stuff



  template.pt
  
This is the content.
  



  
  
  



Since the add.pt uses the body slot it should not affect the result, should 
it?

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Fields are not inherited

2005-09-12 Thread Florian Lindner
Hello,
I have a interface:

class IContentItem(Interface):
"""The ContentItem object works as a base class for all other content 
objects."""

def __setitem__(name, object):
"""Add a IContentItem object."""

title = TextLine(
 title = u"Name",
 description = u"Name that will be part of the URL",
 required = True)  

description = TextLine (
  title = u"Description",
  description = u"Description of the object.",
  required = False)


This interface should not represent a content item, it should just work as a 
common base for all other content objects.
It does not have a class which implements it.

I've registered it with:



I've also tried adding type="zope.app.content.interfaces.IContentType".

When I look at the apidoc of this Interface no attributes/fields are shown.

Another interface is derived from that one:

class ILink(IContentItem):
"""This interface stores information about a URL."""

def __setitem__(name, object):
"""Adds a ILink object."""

URL = URI (
title = u"URL",
description = u"The URL.",
required = True)

In the apidoc of this interface only the URL field is shown. None of the 
inherited fields.
This content object is registered as usual:

http://namespaces.zope.org/zope";>











Why are the fields of ContentItem not inherited?

Thanks,


Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Fields are not inherited

2005-09-12 Thread Florian Lindner
Am Montag, 12. September 2005 19:47 schrieb Stephan Richter:
> On Monday 12 September 2005 13:30, Florian Lindner wrote:
> > class IContentItem(Interface):
> >     """The ContentItem object works as a base class for all other content
> > objects."""
> >
> >     def __setitem__(name, object):
> >         """Add a IContentItem object."""
> >        
> >         title = TextLine(
> >                      title = u"Name",
> >                      description = u"Name that will be part of the URL",
> >                      required = True)                  
> >                    
> >         description = TextLine (
> >                       title = u"Description",
> >                       description = u"Description of the object.",
> >                       required = False)
>
> You got the indentation wrong.

Oh no... Sorry, for this stupid mistake and thanks for telling me...

:-/

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Object Name field on addforms

2005-09-13 Thread Florian Lindner
Am Montag, 12. September 2005 15:09 schrieb Stephan Richter:
> On Monday 12 September 2005 09:05, Florian Lindner wrote:
> > > Don't use the menu/title attributes of form:addform. Use the
> > > browser:addMenuItem directive instead.
> >
> > Ok. But why does the addform directive registers a menu item with a
> > action which is not even supposed to work? Isn't that considered a bug?
>
> Yes, it should. :-\

I've a wierd error now.
I've changed my configure.zcml accordingly:





But this gives a configuration error upon startup:

  File "/home/florian/Zope3/src/zope/app/publisher/browser/menumeta.py", line 
214, in _checkViewFor
raise ConfigurationError(
zope.configuration.config.ConfigurationExecutionError: 
zope.configuration.exceptions.ConfigurationError: view name AddCSLink.html 
not found
  in:
  File 
"/home/florian/Desktop/zope/lib/python/CS/Link/browser/skin/configure.zcml", 
line 20.4-27.6
  


I really don't understand why the view is not found...

Thanks,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] addview name not form

2005-09-17 Thread Florian Lindner
Hello,
I've a wierd error.

I've a configure.zcml with:





But this gives a configuration error upon startup:

  File "/home/florian/Zope3/src/zope/app/publisher/browser/menumeta.py", line 
214, in _checkViewFor
raise ConfigurationError(
zope.configuration.config.ConfigurationExecutionError: 
zope.configuration.exceptions.ConfigurationError: view name AddCSLink.html 
not found
  in:
  File 
"/home/florian/Desktop/zope/lib/python/CS/Link/browser/skin/configure.zcml", 
line 20.4-27.6
  


I really don't understand why the view is not found...

Thanks,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] addview name not form

2005-09-27 Thread Florian Lindner
Am Samstag, 17. September 2005 15:10 schrieb Florian Lindner:
> Hello,
> I've a wierd error.
>
> I've a configure.zcml with:
>
>  schema="CS.Link.interfaces.ILink"
> name="AddCSLink.html"
> content_factory="CS.Link.link.Link"
> permission="CS.Add"
> layer="centershock"
> />
>
>  title="Link"
> class="CS.Link.link.Link"
> view="AddCSLink.html"
> permission="CS.Add"
> for="CS.ContentFolder.interfaces.IContentFolder"
> menu="CSaddMenu"
> />
>
> But this gives a configuration error upon startup:
>
>   File "/home/florian/Zope3/src/zope/app/publisher/browser/menumeta.py",
> line 214, in _checkViewFor
> raise ConfigurationError(
> zope.configuration.config.ConfigurationExecutionError:
> zope.configuration.exceptions.ConfigurationError: view name AddCSLink.html
> not found
>   in:
>   File
> "/home/florian/Desktop/zope/lib/python/CS/Link/browser/skin/configure.zcml"
>, line 20.4-27.6
>  title="Link"
>   class="CS.Link.link.Link"
>   view="AddCSLink.html"
>   permission="CS.Add"
>   for="CS.ContentFolder.interfaces.IContentFolder"
>   menu="CSaddMenu"
>   />
>
>
> I really don't understand why the view is not found...

I still have this problem. Is it just to easy so that noone answers me or does 
really nobody knows some help?

I'm really stuck with that. If somebody knows something, _please_ answer!

Thanks,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] addview name not form

2005-09-27 Thread Florian Lindner
Am Dienstag, 27. September 2005 15:34 schrieb Julien Anguenot:
> Florian Lindner wrote:
> > Am Samstag, 17. September 2005 15:10 schrieb Florian Lindner:
> >>Hello,
> >>I've a wierd error.
> >>
> >>I've a configure.zcml with:
> >>
> >> >>schema="CS.Link.interfaces.ILink"
> >>name="AddCSLink.html"
> >>content_factory="CS.Link.link.Link"
> >>permission="CS.Add"
> >>layer="centershock"
> >>/>
> >>
> >> >>title="Link"
> >>class="CS.Link.link.Link"
> >>view="AddCSLink.html"
> >>permission="CS.Add"
> >>for="CS.ContentFolder.interfaces.IContentFolder"
> >>menu="CSaddMenu"
> >>/>
> >>
> >>But this gives a configuration error upon startup:
> >>
> >>  File "/home/florian/Zope3/src/zope/app/publisher/browser/menumeta.py",
> >>line 214, in _checkViewFor
> >>raise ConfigurationError(
> >>zope.configuration.config.ConfigurationExecutionError:
> >>zope.configuration.exceptions.ConfigurationError: view name
> >> AddCSLink.html not found
> >>  in:
> >>  File
> >>"/home/florian/Desktop/zope/lib/python/CS/Link/browser/skin/configure.zcm
> >>l" , line 20.4-27.6
> >>   >>  title="Link"
> >>  class="CS.Link.link.Link"
> >>  view="AddCSLink.html"
> >>  permission="CS.Add"
> >>  for="CS.ContentFolder.interfaces.IContentFolder"
> >>  menu="CSaddMenu"
> >>  />
> >>
> >>
> >>I really don't understand why the view is not found...
> >
> > I still have this problem. Is it just to easy so that noone answers me or
> > does really nobody knows some help?
> >
> > I'm really stuck with that. If somebody knows something, _please_ answer!
>
> Hi Florian,
>
> It means the view name "AddCSLink.html" is not registred for the
> CS.ContentFolder.interfaces.IContentFolder *and* the default layer.
>
> It used to work before the #307 collector issue fix.
>
> See :
> http://svn.zope.org/Zope3/trunk/src/zope/app/publisher/browser/menumeta.py?
>rev=37584&view=auto
>
> _checkViewFor() 

The arguments in _checkViewFor are:

for_ = 
layer = 
view_name = AddCSLink.html


> and addMenuItem() 

What information you want from addMenuItem?

> Maybe a more verbose error is needed saying on which interfaces the
> multi-adaper lookup failed ?

It works when I take the for attribute out of the addMenuItem directive. 
However I want to have this addform displayed in the menu when I have a view 
on IContentFolder.  Without the for attribute it is not shown.
The addform works perfectly from contentfolderobject/+/AddCSLink.html. I just 
want to have a addMenuItem in the CSaddMenu that is shown on all views on 
IContentFolder. All that should be placed in the centersock layer.

I hope I could express what I mean...  ;-)

Thanks for your help!

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] addview name not form

2005-09-27 Thread Florian Lindner
Am Dienstag, 27. September 2005 17:14 schrieb Julien Anguenot:
> Florian Lindner wrote:
> > Am Dienstag, 27. September 2005 15:34 schrieb Julien Anguenot:
> >>Florian Lindner wrote:
> >>>Am Samstag, 17. September 2005 15:10 schrieb Florian Lindner:
> >>>>Hello,
> >>>>I've a wierd error.
> >>>>
> >>>>I've a configure.zcml with:
> >>>>

[...]

> >>>>
> >>>>But this gives a configuration error upon startup:
> >>>>
> >>>> File "/home/florian/Zope3/src/zope/app/publisher/browser/menumeta.py",
> >>>>line 214, in _checkViewFor
> >>>>   raise ConfigurationError(
> >>>>zope.configuration.config.ConfigurationExecutionError:
> >>>>zope.configuration.exceptions.ConfigurationError: view name
> >>>>AddCSLink.html not found
> >>>> in:
> >>>> File
> >>>>"/home/florian/Desktop/zope/lib/python/CS/Link/browser/skin/configure.z
> >>>>cm l" , line 20.4-27.6
> >>>>  >>>> title="Link"
> >>>> class="CS.Link.link.Link"
> >>>> view="AddCSLink.html"
> >>>> permission="CS.Add"
> >>>> for="CS.ContentFolder.interfaces.IContentFolder"
> >>>> menu="CSaddMenu"
> >>>> />
> >>>>
> >>>>
> >>>>I really don't understand why the view is not found...
> >>>
> >>>I still have this problem. Is it just to easy so that noone answers me
> >>> or does really nobody knows some help?
> >>>
> >>>I'm really stuck with that. If somebody knows something, _please_
> >>> answer!
> >>
> >>Hi Florian,
> >>
> >>It means the view name "AddCSLink.html" is not registred for the
> >>CS.ContentFolder.interfaces.IContentFolder *and* the default layer.
> >>
> >>It used to work before the #307 collector issue fix.
> >>
> >>See :
> >>http://svn.zope.org/Zope3/trunk/src/zope/app/publisher/browser/menumeta.p
> >>y? rev=37584&view=auto
> >>
> >>_checkViewFor()
> >
> > The arguments in _checkViewFor are:
> >
> > for_ = 
> > layer =  > zope.publisher.interfaces.browser.IDefaultBrowserLayer>
> > view_name = AddCSLink.html
> >
> >>and addMenuItem()
> >
> > What information you want from addMenuItem?
> >
> >>Maybe a more verbose error is needed saying on which interfaces the
> >>multi-adaper lookup failed ?
> >
> > It works when I take the for attribute out of the addMenuItem directive.
> > However I want to have this addform displayed in the menu when I have a
> > view on IContentFolder.  Without the for attribute it is not shown.
> > The addform works perfectly from contentfolderobject/+/AddCSLink.html. I
> > just want to have a addMenuItem in the CSaddMenu that is shown on all
> > views on IContentFolder. All that should be placed in the centersock
> > layer.
> >
> > I hope I could express what I mean...  ;-)
>
> Try to add a layer="centershock" within your addMenuItem directive such
> as :
>
>  title="Link"
>class="CS.Link.link.Link"
>view="AddCSLink.html"
>permission="CS.Add"
>for="CS.ContentFolder.interfaces.IContentFolder"
>menu="CSaddMenu"
>layer="centershock"
>/>

ZopeXMLConfigurationError: File 
"/home/florian/Desktop/zope/lib/python/CS/Link/browser/skin/configure.zcml", 
line 20.4-28.7
ConfigurationError: ('Unrecognized parameters:', 'layer')

It is also not listed in apidoc.

The method to create the menu item directly in the addform directive works but 
is somehow buggy. See the tread: "Object Name field on addforms" started from 
me at 11.09.2005 15:04.

Any other ideas?

Thanks,

Florian

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] addview name not form

2005-09-29 Thread Florian Lindner
Hi,
no one any more ideas?  *desperated* I can't really believ that this error has 
not occured to anyone else, since IMO it is very a standard situation...

Would it help if I create a small package which demonstrates the error?

Thx,

Florian

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] addview name not form

2005-09-29 Thread Florian Lindner
Ok, here we go. The package is located at http://xgm.de/addform.tar.gz. Simple 
register it (a cs-configure.zcml is provided) and start Zope (SVN version), 
you'll see the error.

To check the intended behavior:

0) Start Zope successfully (first important step!)
1) Create a ContentFolder named cs.
2) Go to http://horus:8080/++skin++centershock/cs/
3) The menu on the left should show a entry "Link" under "Items to add"
4) This entry should link to /++skin++centershock/cs/+/%40%40AddCSLink.html, 
NOT to the URL but withount the /+/ (what the Folder link does at the 
moment), since this method is broken somehow.


Thanks for you help,

Florian



Am Donnerstag, 29. September 2005 14:45 schrieb Julien Anguenot:
> Yup please. I could investigate much more easily.
>
>   J.
>
> Florian Lindner wrote
>
> > Hi,
> > no one any more ideas?  *desperated* I can't really believ that this
> > error has not occured to anyone else, since IMO it is very a standard
> > situation...
> >
> > Would it help if I create a small package which demonstrates the error?
> >
> > Thx,
> >
> > Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] addview name not form

2005-09-29 Thread Florian Lindner
Am Donnerstag, 29. September 2005 20:25 schrieb Julien Anguenot:
> First have a look at this :
>
> http://www.zope.org/Collectors/Zope3-dev/391
>
> The addMenuItem directive should look this way in order to work :
>
>  title="Link"
> class="CS.Link.link.Link"
> view="AddCSLink.html"
> permission="zope.Public"
> menu="CSaddMenu"
>  />
>
> without 'for="CS.ContentFolder.interfaces.IContentFolder"' (check the
> collector entry)

But then the menu entry does not show up in views on IContentFolder. And I 
need it showing up there.
>
> The addMenuItem doesn't support the layer attribute. I'm going to add
> this to the addMenuItem directive interface.

When do you think you will be done?

Thx,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] addview name not form

2005-09-29 Thread Florian Lindner
Am Donnerstag, 29. September 2005 20:25 schrieb Julien Anguenot:
> First have a look at this :
>
> http://www.zope.org/Collectors/Zope3-dev/391

Sorry, didn't read that thoroughly. What do you suggest at the moment do get 
the desired behavior?


>
> The addMenuItem directive should look this way in order to work :
>
>  title="Link"
> class="CS.Link.link.Link"
> view="AddCSLink.html"
> permission="zope.Public"
> menu="CSaddMenu"
>  />
>
> without 'for="CS.ContentFolder.interfaces.IContentFolder"' (check the
> collector entry)
>
> The addMenuItem doesn't support the layer attribute. I'm going to add
> this to the addMenuItem directive interface.
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] addview name not form

2005-09-30 Thread Florian Lindner
Am Freitag, 30. September 2005 18:55 schrieb Julien Anguenot:
> Florian Lindner wrote:
> > Am Donnerstag, 29. September 2005 20:25 schrieb Julien Anguenot:
> >>First have a look at this :
> >>
> >>http://www.zope.org/Collectors/Zope3-dev/391
> >>
> >>The addMenuItem directive should look this way in order to work :
> >>
> >> >>title="Link"
> >>class="CS.Link.link.Link"
> >>view="AddCSLink.html"
> >>permission="zope.Public"
> >>menu="CSaddMenu"
> >> />
> >>
> >>without 'for="CS.ContentFolder.interfaces.IContentFolder"' (check the
> >>collector entry)
> >
> > But then the menu entry does not show up in views on IContentFolder. And
> > I need it showing up there.
> >
> >>The addMenuItem doesn't support the layer attribute. I'm going to add
> >>this to the addMenuItem directive interface.
> >
> > When do you think you will be done?
>
> Just checked it in the trunk.
>
> You may want to try out. Changeset [38705]

I'll do so. But not tonight. Need to get ready to have some fun and party. 
Tomorrow and Sunday I will in Munich and take over my new appartment there. 
So I'll be able to check it out at Sunday evening or Monday. Did the change 
made the example I uploaded work?

Thanks for that,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] addview name not form

2005-09-30 Thread Florian Lindner
Am Freitag, 30. September 2005 18:55 schrieb Julien Anguenot:
> Florian Lindner wrote:
> > Am Donnerstag, 29. September 2005 20:25 schrieb Julien Anguenot:
> >>First have a look at this :
> >>
> >>http://www.zope.org/Collectors/Zope3-dev/391
> >>
> >>The addMenuItem directive should look this way in order to work :
> >>
> >> >>title="Link"
> >>class="CS.Link.link.Link"
> >>view="AddCSLink.html"
> >>permission="zope.Public"
> >>menu="CSaddMenu"
> >> />
> >>
> >>without 'for="CS.ContentFolder.interfaces.IContentFolder"' (check the
> >>collector entry)
> >
> > But then the menu entry does not show up in views on IContentFolder. And
> > I need it showing up there.
> >
> >>The addMenuItem doesn't support the layer attribute. I'm going to add
> >>this to the addMenuItem directive interface.
> >
> > When do you think you will be done?
>
> Just checked it in the trunk.
>
> You may want to try out. Changeset [38705]

After the update from python 2.3 to 2.4.2, deleting my SVN checkout, 
rechecking out and compiling, recreating a clean instance, I get upon 
startup:

  File "/home/florian/Zope3/src/zope/app/component/registration.py", line 27, 
in ?
from zope.app.component.interfaces import registration as interfaces
  File "/home/florian/Zope3/src/zope/app/component/interfaces/__init__.py", 
line 22, in ?
from zope.app.container.constraints import ContainerTypesConstraint
zope.configuration.xmlconfig.ZopeXMLConfigurationError: File 
"/home/florian/Desktop/zope/etc/site.zcml", line 3.2-3.50
ZopeXMLConfigurationError: File 
"/home/florian/Desktop/zope/etc/package-includes/securitypolicy-meta.zcml", 
line 1.0-1.62
ZopeXMLConfigurationError: File 
"/home/florian/Zope3/src/zope/app/securitypolicy/meta.zcml", line 4.2-7.51
SyntaxError: invalid syntax (constraints.py, line 240)


Regards,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] addview name not form

2005-09-30 Thread Florian Lindner
Am Freitag, 30. September 2005 20:08 schrieb Jim Fulton:
> Florian Lindner wrote:
> > Am Freitag, 30. September 2005 18:55 schrieb Julien Anguenot:
> >>Florian Lindner wrote:
> >>>Am Donnerstag, 29. September 2005 20:25 schrieb Julien Anguenot:
> >>>>First have a look at this :
> >>>>
> >>>>http://www.zope.org/Collectors/Zope3-dev/391
> >>>>
> >>>>The addMenuItem directive should look this way in order to work :
> >>>>
> >>>>>>>>   title="Link"
> >>>>   class="CS.Link.link.Link"
> >>>>   view="AddCSLink.html"
> >>>>   permission="zope.Public"
> >>>>   menu="CSaddMenu"
> >>>>/>
> >>>>
> >>>>without 'for="CS.ContentFolder.interfaces.IContentFolder"' (check the
> >>>>collector entry)
> >>>
> >>>But then the menu entry does not show up in views on IContentFolder. And
> >>>I need it showing up there.
> >>>
> >>>>The addMenuItem doesn't support the layer attribute. I'm going to add
> >>>>this to the addMenuItem directive interface.
> >>>
> >>>When do you think you will be done?
> >>
> >>Just checked it in the trunk.
> >>
> >>You may want to try out. Changeset [38705]
> >
> > After the update from python 2.3 to 2.4.2, deleting my SVN checkout,
> > rechecking out and compiling, recreating a clean instance, I get upon
> > startup:
> >
> >   File "/home/florian/Zope3/src/zope/app/component/registration.py", line
> > 27, in ?
> > from zope.app.component.interfaces import registration as interfaces
> >   File
> > "/home/florian/Zope3/src/zope/app/component/interfaces/__init__.py", line
> > 22, in ?
> > from zope.app.container.constraints import ContainerTypesConstraint
> > zope.configuration.xmlconfig.ZopeXMLConfigurationError: File
> > "/home/florian/Desktop/zope/etc/site.zcml", line 3.2-3.50
> > ZopeXMLConfigurationError: File
> > "/home/florian/Desktop/zope/etc/package-includes/securitypolicy-meta.zcml
> >", line 1.0-1.62
> > ZopeXMLConfigurationError: File
> > "/home/florian/Zope3/src/zope/app/securitypolicy/meta.zcml", line
> > 4.2-7.51 SyntaxError: invalid syntax (constraints.py, line 240)
>
> You are still using Python 2.3.

Sure?

[EMAIL PROTECTED] ~ $ python -V
Python 2.4.2

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] addview name not form

2005-10-03 Thread Florian Lindner
Am Freitag, 30. September 2005 20:17 schrieb Julien Anguenot:
> Florian Lindner wrote:
> > Am Donnerstag, 29. September 2005 20:25 schrieb Julien Anguenot:
> >>First have a look at this :
> >>
> >>http://www.zope.org/Collectors/Zope3-dev/391
> >
> > Sorry, didn't read that thoroughly. What do you suggest at the moment do
> > get the desired behavior?
>
> Your ContentFolder should implement IAdding and then your example should
> work I guess.

I've modified my content class directive for the addfolder:



  
  
  
  
  
  



And my addMenuItem:




it's still:

zope.configuration.exceptions.ConfigurationError: view name AddCSLink.html not 
found


I did I get something wrong?

Thanks,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Object Name field on addforms

2005-10-05 Thread Florian Lindner
Am Sonntag, 11. September 2005 20:25 schrieb Stephan Richter:
> On Sunday 11 September 2005 10:07, Florian Lindner wrote:
> > The field is displayed when the addform is called with
> > folder/+/AddCSLink.html.
>
> In this case AddCSLink.html is a view for IAdding.
>
> > When folder/AddCSLink.html is is not displayed.
>
> Here AddCSLink.html is a view of IContainer.
>
> > What is the difference between these two?
>
> I am surprised both would work. Only the first one should.
>
> > Unfortunatly when you use the addform directive to register a menu item
> > the action is folder/AddCSLink.html. Can this be changed?
>
> Don't use the menu/title attributes of form:addform. Use the
> browser:addMenuItem directive instead.

I've managed to register it now with a serperate addMenuItem directive. But 
the URL of the menu item is still folder/AddCSLink.html and not 
folder/+/AddCSLink.html and it's still the same error like I was registering 
it within the addform directive.

Thanks,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] addview name not form

2005-10-06 Thread Florian Lindner
Am Montag, 3. Oktober 2005 14:01 schrieb Florian Lindner:
> Am Freitag, 30. September 2005 20:17 schrieb Julien Anguenot:
> > Florian Lindner wrote:
> > > Am Donnerstag, 29. September 2005 20:25 schrieb Julien Anguenot:
> > >>First have a look at this :
> > >>
> > >>http://www.zope.org/Collectors/Zope3-dev/391
> > >
> > > Sorry, didn't read that thoroughly. What do you suggest at the moment
> > > do get the desired behavior?
> >
> > Your ContentFolder should implement IAdding and then your example should
> > work I guess.
>
> I've modified my content class directive for the addfolder:
>
>interface=".interfaces.IContentFolder"
>   type="zope.app.content.interfaces.IContentType" />
> 
>interface="zope.app.annotation.interfaces.IAttributeAnnotatable" />
>interface="zope.app.container.interfaces.IContentContainer" />
>interface="zope.app.container.interfaces.IAdding" />
>   
>   
>   
> 
>
>
> And my addMenuItem:
>
>  title="Link"
> class="CS.Link.link.Link"
> view="AddCSLink.html"
> permission="CS.Add"
> menu="CSaddMenu"
> layer="centershock"
> for="CS.ContentFolder.interfaces.IContentFolder"
>  />
>
>
> it's still:
>
> zope.configuration.exceptions.ConfigurationError: view name AddCSLink.html
> not found

Does it work with your code? (the code I uploaded)

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] addview name not form

2005-10-10 Thread Florian Lindner
Am Montag, 10. Oktober 2005 19:33 schrieb Julien Anguenot:
> Florian Lindner wrote:
> > Am Montag, 3. Oktober 2005 14:01 schrieb Florian Lindner:
> >>Am Freitag, 30. September 2005 20:17 schrieb Julien Anguenot:
> >>>Florian Lindner wrote:
> >>>>Am Donnerstag, 29. September 2005 20:25 schrieb Julien Anguenot:
> >>>>>First have a look at this :
> >>>>>
> >>>>>http://www.zope.org/Collectors/Zope3-dev/391
> >>>>
> >>>>Sorry, didn't read that thoroughly. What do you suggest at the moment
> >>>>do get the desired behavior?
> >>>
> >>>Your ContentFolder should implement IAdding and then your example should
> >>>work I guess.
> >>
> >>I've modified my content class directive for the addfolder:
> >>
> >> >>  interface=".interfaces.IContentFolder"
> >>  type="zope.app.content.interfaces.IContentType" />
> >>
> >>   >>interface="zope.app.annotation.interfaces.IAttributeAnnotatable" />
> >>   >>interface="zope.app.container.interfaces.IContentContainer" />
> >>   >>interface="zope.app.container.interfaces.IAdding" />
> >>  
> >>  
> >>   >> /> 
> >>
> >>
> >>And my addMenuItem:
> >>
> >> >>title="Link"
> >>class="CS.Link.link.Link"
> >>view="AddCSLink.html"
> >>permission="CS.Add"
> >>menu="CSaddMenu"
> >>layer="centershock"
> >>for="CS.ContentFolder.interfaces.IContentFolder"
> >> />
> >>
> >>
> >>it's still:
> >>
> >>zope.configuration.exceptions.ConfigurationError: view name
> >> AddCSLink.html not found
> >
> > Does it work with your code? (the code I uploaded)
>
> Yes, if you specify the the addMenuItem directive :
>
>  title="Link"
> class="CS.Link.link.Link"
> view="AddCSLink.html"
> permission="zope.Public"
> menu="CSaddMenu"
> layer="centershock"
>  />
>
> 1) specify a layer on the addMenuItem directive.
> 2) remove the for attribute for now until your ContentFolder class
> implements IAdding.

case 1) That makes my CSaddMenu not to show "Link" when it's displayed on 
IContentFolder.

case 2) If I add the for="CS.ContentFolder.interfaces.IContentFolder" 
attribute to both the addMenuItem and addform directives I have the problem 
that the generated link on the addform contentfolder/AddCSLink.html and not 
contentfolder/+/AddCSLink.html and therefore (the form without +) does not 
work.

case 3) If I add  to my content directive 
for IContentFolder it changes nothing.

case 4) If after adding the marker interface IAdding for the ContentFolder, I 
remove the for attribute from both addform and addMenuItem the result is the 
same like case 2.

Sorry, I am still not able to make it work. :-(

Thanks for you help!

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Where is the apidoc?

2005-10-23 Thread Florian Lindner
Hello,
sounds stupid, but I can't find the apidoc in a recent SVN version. 
http://horus:8080/++apidoc++ returns a 404.

Thx,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] PAU and Session Credentials

2005-11-20 Thread Florian Lindner
Hello,
I've created and registered a PluggableAuthentication in my site. I've added 
two plugins: PrincipalFolder and SessionCredentialsPlugin and registered 
both. I've configured the PAU to use these plugins. In the principal folder 
I've created a Principal. I've also created a loginForm.html that looks like 
that:



  
  

  



If I try to call a page which reguired a specific permission the loginForm 
comes up. But when I enter the login and password of the Principal in the 
Principal Folder or a the manager principal defined on creation of the 
instance I just get redirected to the login page again. This now was the 
behavior before a played around with the PAU a bit now it has changed to a 
system error:

TraversalError: (Principal(u'pre1'), 'getLogin')

The error log information of the user:

User:  unauthenticated, pre1, CS.User,

pre is the prefix of my principal folder (BTW: what is the sense of this 
prefix), 1 is the object id of my test principal, CS.User the role of the 
principal.

I've been stepping in the session credentials plugin code and I see that the 
login and password date is extracted correctly.

Somehow I'm still confused how everything is supposed to work... 

Thanks,

Florian

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] PAU and Session Credentials

2005-11-24 Thread Florian Lindner
Am Sonntag, 20. November 2005 22:57 schrieb Florian Lindner:
> Hello,
> I've created and registered a PluggableAuthentication in my site. I've
> added two plugins: PrincipalFolder and SessionCredentialsPlugin and
> registered both. I've configured the PAU to use these plugins. In the
> principal folder I've created a Principal. I've also created a
> loginForm.html that looks like that:
>
[...]

No one got a idea how to make the principal folder working?

Thanks,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] PAU and Session Credentials

2005-11-27 Thread Florian Lindner
Am Freitag, 25. November 2005 00:06 schrieb Christian Lück:
> Hi Florian,
>
> Florian Lindner wrote:
> > If I try to call a page which reguired a specific permission the
> > loginForm comes up. But when I enter the login and password of the
> > Principal in the Principal Folder or a the manager principal defined on
> > creation of the instance I just get redirected to the login page again.
>
> I guess that you still have to grant permissions or a role to the
> principal. If you want to grant it globally you should login as admin
> and get to the rootfolder ("[top]"). There is a "Grant" item the ZMI
> menu. On the @@grant.html view you have to choose the right source path,
> probably
> /++etc++site/default/YourPluggableAuthentication/YourPrincipalFolder
> Yust press buttons, ZMI does the rest... :-)

I've done that:


Selected
Nothing
PrincipalFolder
Source path
/cs/++etc++site/default/PluggableAuthentication/PrincipalFolder



> > behavior before a played around with the PAU a bit now it has changed to
> > a system error:
> >
> > TraversalError: (Principal(u'pre1'), 'getLogin')
>
> Maybe it's the same error I once reported on the dev list:
> http://mail.zope.org/pipermail/zope3-dev/2005-October/016163.html
> I've not yet filed a report -- sorry to much to do at work last month.

I don't know if it is the same... I'm still stuck with this SystemError...


Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] unauthenticated principal

2005-11-27 Thread Florian Lindner
Hello,
my error log has a entry to a unauthenticated principal:

unauthenticated, pre1, CS.User, beschreibung

but why is there a username (pre1) being print? What does the unauthenticated 
means in that context?

Thanks,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Stephan & Philipp: New versions of your books?

2005-12-11 Thread Florian Lindner
Hello,
I think both your books are, due to the fast pace of Zope3 development 
outdated in large sections.
Are there any plans for new version of these books? Or any new Zope3 books 
upcoming?

Thanks,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Get classes implementing Interface

2005-12-26 Thread Florian Lindner
Hello,
how can I get all classes that implement a specific interface?
What interface do I need to search for, when I want all objects that can be 
added and work as container? IContainer seem to be implemented by a lot more 
objects...

Thanks,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Get classes implementing Interface

2005-12-28 Thread Florian Lindner
Am Mittwoch, 28. Dezember 2005 14:48 schrieb Jim Fulton:
> Florian Lindner wrote:
> > Hello,
> > how can I get all classes that implement a specific interface?
> > What interface do I need to search for, when I want all objects that can
> > be added and work as container? IContainer seem to be implemented by a
> > lot more objects...
>
> There isn't an api for that.

And there is no workaround that comes? How would you do that?

Thanks,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Get classes implementing Interface

2005-12-30 Thread Florian Lindner
Am Freitag, 30. Dezember 2005 10:20 schrieb Philipp von Weitershausen:
> Florian Lindner wrote:
> > Am Mittwoch, 28. Dezember 2005 14:48 schrieb Jim Fulton:
> >>Florian Lindner wrote:
> >>>Hello,
> >>>how can I get all classes that implement a specific interface?
> >>>What interface do I need to search for, when I want all objects that can
> >>>be added and work as container? IContainer seem to be implemented by a
> >>>lot more objects...
> >>
> >>There isn't an api for that.
> >
> > And there is no workaround that comes? How would you do that?
>
> What's your use case?

Hi,
my first use case is that I want to enhance the HomefolderManager to make it 
possible to select something else than a Folder to be created automatically. 
Right now I have forked a version of the HomefolderManager and just changed 
in the code. But I would like to have a more generic solution and I'll also 
commit it back to the trunk.
For that I want all classes implementing IContainer (and IContentType ?) and 
let the user select on in the configuration dialog of the HomefolderManager.
More use caess probably show up in my project later, but nothing fixed at this 
time.

Thanks,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Get classes implementing Interface

2005-12-30 Thread Florian Lindner
Am Freitag, 30. Dezember 2005 17:45 schrieb Jim Fulton:
> Philipp von Weitershausen wrote:
> > Florian Lindner wrote:
> >>my first use case is that I want to enhance the HomefolderManager to make
> >> it possible to select something else than a Folder to be created
> >> automatically. Right now I have forked a version of the
> >> HomefolderManager and just changed in the code. But I would like to have
> >> a more generic solution and I'll also commit it back to the trunk.
> >>For that I want all classes implementing IContainer (and IContentType ?)
> >> and let the user select on in the configuration dialog of the
> >> HomefolderManager. More use caess probably show up in my project later,
> >> but nothing fixed at this time.
> >
> > So what you want is to create objects. Classes are just an
> > implementation detail to creating objects :). Factories create objects,
> > whether they're from a class is immaterial.
> >
> > So, what you want is not a list of classes but a list of factories that
> > can create IContainers. This is possible by using
> > zapi.getUtilitiesFor(IFactory) and then checking each factory's
> > getInterfaces() method whether IContainer is a part of the returned
> > result. I would probably base an implementation of all on the
> > UtilityVocabulary.
>
> I'll also note that the use case is also directly addressed through
> containment constraints.  You can say that a container
> should only contain objects of some given types and you will get
> just those types in the add list.

But the HomeFolderManager is not a container itself it's just a utility that 
creates container upon requests. And I want to make choosable which container 
to create. Or do I misunderstand you?

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Get classes implementing Interface

2005-12-31 Thread Florian Lindner
Am Freitag, 30. Dezember 2005 20:57 schrieb Jeff Shell:
> On 12/30/05, Florian Lindner <[EMAIL PROTECTED]> wrote:
> > Am Freitag, 30. Dezember 2005 17:45 schrieb Jim Fulton:
> > > Philipp von Weitershausen wrote:
> > > > So, what you want is not a list of classes but a list of factories
> > > > that can create IContainers. This is possible by using
> > > > zapi.getUtilitiesFor(IFactory) and then checking each factory's
> > > > getInterfaces() method whether IContainer is a part of the returned
> > > > result. I would probably base an implementation of all on the
> > > > UtilityVocabulary.
> > >
> > > I'll also note that the use case is also directly addressed through
> > > containment constraints.  You can say that a container
> > > should only contain objects of some given types and you will get
> > > just those types in the add list.
> >
> > But the HomeFolderManager is not a container itself it's just a utility
> > that creates container upon requests. And I want to make choosable which
> > container to create. Or do I misunderstand you?
>
> Well first (and I apologize if this has been mentioned before),
> 'containers' are a more abstract notion while 'folders' are more
> concrete. A message or document that allows comments might be a
> container, but it's not something that you'd see in the ZMI or any
> content management type interface as a folder. You'd see it as an
> article.
>
> Something that's "Folderish" (to drag up an old term) will probably
> have a folder icon, will probably (but not necessarily) will have
> sub-folders, will have a view to manage its contents, and so on.

[...]

Basically the HomeFolderManager (HFM) only creates an 1:1 relation between a 
principal and an object. It can also auto-create these objects if the 
relation is being read for the first time. In this case the object to be 
created is hardcoded to be a zope.app.folder.Folder. The HFM does not care 
what is being done with the objects it just returns them.
In my project I've another folderish object that I want to have created, 
therefore I forked the HFM and modified the code to create the object I want.
Of course, the common use case would be to create a folderish object, but any 
other kind of objects would make sense to. A principal could have a home page 
(just one site) which is not folderish neither a IContainer which could the 
HFM return. Or a project which can contain comments, which is not folderis 
either but is an IContainer implemention.
I think that the HFM should allow creation of ANY objects, regardless of being 
folderish or IContainer implemenations. Of course, the name HomeFOLDERManager 
would not make sense anymore in this case.

What do you think?

Florian

I've included zope-dev in the recipients.

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Get classes implementing Interface

2005-12-31 Thread Florian Lindner
Does anyone got this mail? I've not received a copy from the mailinglists 
neither it shows up in the archives...

Am Freitag, 30. Dezember 2005 20:57 schrieb Jeff Shell:
> On 12/30/05, Florian Lindner <[EMAIL PROTECTED]> wrote:
> > Am Freitag, 30. Dezember 2005 17:45 schrieb Jim Fulton:
> > > Philipp von Weitershausen wrote:
> > > > So, what you want is not a list of classes but a list of factories
> > > > that can create IContainers. This is possible by using
> > > > zapi.getUtilitiesFor(IFactory) and then checking each factory's
> > > > getInterfaces() method whether IContainer is a part of the returned
> > > > result. I would probably base an implementation of all on the
> > > > UtilityVocabulary.
> > >
> > > I'll also note that the use case is also directly addressed through
> > > containment constraints.  You can say that a container
> > > should only contain objects of some given types and you will get
> > > just those types in the add list.
> >
> > But the HomeFolderManager is not a container itself it's just a utility
> > that creates container upon requests. And I want to make choosable which
> > container to create. Or do I misunderstand you?
>
> Well first (and I apologize if this has been mentioned before),
> 'containers' are a more abstract notion while 'folders' are more
> concrete. A message or document that allows comments might be a
> container, but it's not something that you'd see in the ZMI or any
> content management type interface as a folder. You'd see it as an
> article.
>
> Something that's "Folderish" (to drag up an old term) will probably
> have a folder icon, will probably (but not necessarily) will have
> sub-folders, will have a view to manage its contents, and so on.

[...]

Basically the HomeFolderManager (HFM) only creates an 1:1 relation between a 
principal and an object. It can also auto-create these objects if the 
relation is being read for the first time. In this case the object to be 
created is hardcoded to be a zope.app.folder.Folder. The HFM does not care 
what is being done with the objects it just returns them.
In my project I've another folderish object that I want to have created, 
therefore I forked the HFM and modified the code to create the object I want.
Of course, the common use case would be to create a folderish object, but any 
other kind of objects would make sense to. A principal could have a home page 
(just one site) which is not folderish neither a IContainer which could the 
HFM return. Or a project which can contain comments, which is not folderis 
either but is an IContainer implemention.
I think that the HFM should allow creation of ANY objects, regardless of being 
folderish or IContainer implemenations. Of course, the name HomeFOLDERManager 
would not make sense anymore in this case.

What do you think?

Florian

I've included zope-dev in the recipients.

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] PAU and Session Credentials

2006-01-04 Thread Florian Lindner
Am Dienstag, 3. Januar 2006 16:02 schrieb Stephan Richter:
> On Sunday 20 November 2005 16:57, Florian Lindner wrote:
> > TraversalError: (Principal(u'pre1'), 'getLogin')
> >
> > The error log information of the user:
> >
> > User:  unauthenticated, pre1, CS.User,

The log entry came from the RootErrorReportingUtility.

> Ah, there is your problem. IPrincipal does not promise to implement
> "getLogin". In fact, the login name is commonly well-protected for security
> reasons.

I assume that self.request.principal.id comes to be the same like a call to 
getLogin. Since I don't even use getLogin.

What would be your way to work around that?

>
> > pre is the prefix of my principal folder (BTW: what is the sense of this
> > prefix), 1 is the object id of my test principal, CS.User the role of the
> > principal.
>
> Because if you have several different principal folders they might
> duplicate principal names (local ids). The prefix helps to distinguish
> between the various principal folders.

Ok, I see.

Thanks,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-dev] Re: [Zope3-Users] Re: Get classes implementing Interface

2006-01-04 Thread Florian Lindner
Am Samstag, 31. Dezember 2005 14:48 schrieb Florian Lindner:
> Am Freitag, 30. Dezember 2005 20:57 schrieb Jeff Shell:
> > On 12/30/05, Florian Lindner <[EMAIL PROTECTED]> wrote:
> > > Am Freitag, 30. Dezember 2005 17:45 schrieb Jim Fulton:
> > > > Philipp von Weitershausen wrote:
> > > > > So, what you want is not a list of classes but a list of factories
> > > > > that can create IContainers. This is possible by using
> > > > > zapi.getUtilitiesFor(IFactory) and then checking each factory's
> > > > > getInterfaces() method whether IContainer is a part of the returned
> > > > > result. I would probably base an implementation of all on the
> > > > > UtilityVocabulary.
> > > >
> > > > I'll also note that the use case is also directly addressed through
> > > > containment constraints.  You can say that a container
> > > > should only contain objects of some given types and you will get
> > > > just those types in the add list.
> > >
> > > But the HomeFolderManager is not a container itself it's just a utility
> > > that creates container upon requests. And I want to make choosable
> > > which container to create. Or do I misunderstand you?
> >
> > Well first (and I apologize if this has been mentioned before),
> > 'containers' are a more abstract notion while 'folders' are more
> > concrete. A message or document that allows comments might be a
> > container, but it's not something that you'd see in the ZMI or any
> > content management type interface as a folder. You'd see it as an
> > article.
> >
> > Something that's "Folderish" (to drag up an old term) will probably
> > have a folder icon, will probably (but not necessarily) will have
> > sub-folders, will have a view to manage its contents, and so on.
>
> [...]
>
> Basically the HomeFolderManager (HFM) only creates an 1:1 relation between
> a principal and an object. It can also auto-create these objects if the
> relation is being read for the first time. In this case the object to be
> created is hardcoded to be a zope.app.folder.Folder. The HFM does not care
> what is being done with the objects it just returns them.
> In my project I've another folderish object that I want to have created,
> therefore I forked the HFM and modified the code to create the object I
> want. Of course, the common use case would be to create a folderish object,
> but any other kind of objects would make sense to. A principal could have a
> home page (just one site) which is not folderish neither a IContainer which
> could the HFM return. Or a project which can contain comments, which is not
> folderis either but is an IContainer implemention.
> I think that the HFM should allow creation of ANY objects, regardless of
> being folderish or IContainer implemenations. Of course, the name
> HomeFOLDERManager would not make sense anymore in this case.
>
> What do you think?
>
> Florian

No thoughts / opinions of anyone?

Can I make the changes to the HomeFolderManager (list box of all classes 
implementing IContainer to select which class to create) and commit?

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Get classes implementing Interface

2006-01-08 Thread Florian Lindner
Am Freitag, 30. Dezember 2005 13:30 schrieb Philipp von Weitershausen:
> Florian Lindner wrote:
> > my first use case is that I want to enhance the HomefolderManager to make
> > it possible to select something else than a Folder to be created
> > automatically. Right now I have forked a version of the HomefolderManager
> > and just changed in the code. But I would like to have a more generic
> > solution and I'll also commit it back to the trunk.
> > For that I want all classes implementing IContainer (and IContentType ?)
> > and let the user select on in the configuration dialog of the
> > HomefolderManager. More use caess probably show up in my project later,
> > but nothing fixed at this time.
>
> So what you want is to create objects. Classes are just an
> implementation detail to creating objects :). Factories create objects,
> whether they're from a class is immaterial.
>
> So, what you want is not a list of classes but a list of factories that
> can create IContainers. This is possible by using
> zapi.getUtilitiesFor(IFactory) and then checking each factory's
> getInterfaces() method whether IContainer is a part of the returned
> result. I would probably base an implementation of all on the
> UtilityVocabulary.

Hi,
I do it this way now:

utils =  getUtilitiesFor(IFactory)
self.objects = {}
for i in utils:
if IContainer in i[1].getInterfaces():

the UtilityVocabulary gives the same result as getUtilitiesFor.
But that does not list all classes, for example there is no class of the 
normal Folder.

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Convert from string to class

2006-01-17 Thread Florian Lindner
Hello,
I've a string like "zope.app.folder.Folder" and I want to get the class 
zope.app.folder.Folder from this string. How can I do that?
It's probably more a python problem that Zope... but I hope you excuse.


Thanks,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Still trying to figure out PAU

2006-02-02 Thread Florian Lindner
Hello,
I'm still desperately trying to figure out the PluggableAuthentication.

I perform the following steps:

1) Create an instance of my folderish, possible site (named A), content 
object.

2) I create a site in it.

3) I add a PAU in the default software space

4) I add a SessionCredentialsPlugin and a PrincipalFolder as plugins.

5) I create a internal principal with "Title" = "zope.Manager" (tried also 
other ones). name = abc

6) In the SessionCredentialsPlugin I leave to "loginForm.html". I've a 
loginForm.html view in my A-object)

7) I register all components (SessionCreadentiasPlugin, PrincipalFolder and 
PAU)

8) Now I access a view obect A-object that requires certain permissions that 
which the role of abc have.

9) I get redirected to the loginForm.html I've defined.

10) I provide the user credentials of testuser.

11) I've set a breakpoint in 
zope/app/authentication/principalfolder.py(274)authenticateCredentials()

The credentials are extracted correctly:

(Pdb) credentials
{'login': u'abc', 'password': u'123'}

The password check also validates: it executes that line:

284 return PrincipalInfo(self.prefix + id, internal.login, internal.title,
285  internal.description)

But now the authenticateCredentials function is called a second time with 
empty credentials which of course makes it return None.


12) I'm redirected to the loginForm.html again, though the loginForm.html form 
header is like http://URL from cameform"

13) The ErrorReportingUtility show two unauthorized execeptions.

The first one with User: unauthenticated, zope.anybody, Unauthenticated User,

The second one with User: unauthenticated, cs1, CS.User,
(cs is my prefix, CS.User one of the roles I tried)

Whis is ok IMO, since the first call is made without authorization. By why 
does if fail at the second time.

Hope somebody can englight me...

Thanks,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Still trying to figure out PAU

2006-02-03 Thread Florian Lindner
Am Freitag, 3. Februar 2006 04:07 schrieb Gary Poster:
> On Feb 2, 2006, at 4:41 PM, Florian Lindner wrote:
> > Hello,
> > I'm still desperately trying to figure out the
> > PluggableAuthentication.
>
> Since no one has replied, I'll try my "30-second remediation"
> technique again. ;-)  That means I didn't really follow exactly what
> you are doing, and I'm just trying for low-hanging fruit to help
> you. :-)

:-)

> > I perform the following steps:
> >
> > 1) Create an instance of my folderish, possible site (named A),
> > content
> > object.
> >
> > 2) I create a site in it.
> >
> > 3) I add a PAU in the default software space
> >
> > 4) I add a SessionCredentialsPlugin and a PrincipalFolder as plugins.
> >
> > 5) I create a internal principal with "Title" =
> > "zope.Manager" (tried also
> > other ones). name = abc
> >
> > 6) In the SessionCredentialsPlugin I leave to "loginForm.html". I've a
> > loginForm.html view in my A-object)
> >
> > 7) I register all components (SessionCreadentiasPlugin,
> > PrincipalFolder and
> > PAU)
>
> So that means that http://127.0.0.1:8080/++etc++site/default/test.pau/
> @@configure.html (or similar) has one credentials plugin in the right
> column ("Session Credentials (a utility)") and one authenticator
> plugin in the right column ("PrincipalFolder (a utility)" or
> something like that).  Right?
>
> If not, make it so.  :-)

It was already like that, forgot to mention it.

> If that doesn't work, try making the right column of the Credentials
> Plugins field be "No Challenge if Authenticated (a utility)" first
> and then "Session Credentials (a utility)" second.  That's probably
> what you want anyway.

Changed it a bit.

I'm not redirected to the loginForm.html but a "Not authorized" page. Anything 
else is the same. I wonder why I'm not authorized, because in the 
authenticateCredentials() function the internal.title returns:

(Pdb) internal.title
u'zope.Manager'

Which should be authorized for anything.

Hope you can hang the fruits a few centimeter lower...  ,-)

Thanks!

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Still trying to figure out PAU

2006-02-04 Thread Florian Lindner
Am Freitag, 3. Februar 2006 17:11 schrieb Rupert Redington:
> Florian Lindner wrote:
> > Am Freitag, 3. Februar 2006 04:07 schrieb Gary Poster:
> >> On Feb 2, 2006, at 4:41 PM, Florian Lindner wrote:
> >>> Hello,
> >>> I'm still desperately trying to figure out the
> >>> PluggableAuthentication.
> >>
> >> Since no one has replied, I'll try my "30-second remediation"
> >> technique again. ;-)  That means I didn't really follow exactly what
> >> you are doing, and I'm just trying for low-hanging fruit to help
> >> you. :-)
> >>
> > :-)
> > :
> >>> I perform the following steps:
> >>>
> >>> 1) Create an instance of my folderish, possible site (named A),
> >>> content
> >>> object.
> >>>
> >>> 2) I create a site in it.
> >>>
> >>> 3) I add a PAU in the default software space
> >>>
> >>> 4) I add a SessionCredentialsPlugin and a PrincipalFolder as plugins.
> >>>
> >>> 5) I create a internal principal with "Title" =
> >>> "zope.Manager" (tried also
> >>> other ones). name = abc
> >>>
> >>> 6) In the SessionCredentialsPlugin I leave to "loginForm.html". I've a
> >>> loginForm.html view in my A-object)
> >>>
> >>> 7) I register all components (SessionCreadentiasPlugin,
> >>> PrincipalFolder and
> >>> PAU)
> >>
> >> So that means that http://127.0.0.1:8080/++etc++site/default/test.pau/
> >> @@configure.html (or similar) has one credentials plugin in the right
> >> column ("Session Credentials (a utility)") and one authenticator
> >> plugin in the right column ("PrincipalFolder (a utility)" or
> >> something like that).  Right?
> >>
> >> If not, make it so.  :-)
> >
> > It was already like that, forgot to mention it.
> >
> >> If that doesn't work, try making the right column of the Credentials
> >> Plugins field be "No Challenge if Authenticated (a utility)" first
> >> and then "Session Credentials (a utility)" second.  That's probably
> >> what you want anyway.
> >
> > Changed it a bit.
> >
> > I'm not redirected to the loginForm.html but a "Not authorized" page.
> > Anything else is the same. I wonder why I'm not authorized, because in
> > the authenticateCredentials() function the internal.title returns:
> >
> > (Pdb) internal.title
> > u'zope.Manager'
> >
> > Which should be authorized for anything.
> >
> > Hope you can hang the fruits a few centimeter lower...  ,-)
>
> If this fruit is low enough for me I'll be very surprised, and you've
> probably done this already, but:
>
> Does the Principal you've added to your PAU authentication plugin have a
> grant on the site/folder you're trying to access?

I've given the principal the title (which is AFAIK the same as role) 
zope.Manager, which IMO does not need further grants.

Another way I've tried: I've created a principal with title CS.User.
In my configure.zcml I have: 





The ressource I try to access has security declarations:




Or do I need further grants or anything? Or do I misunderstand the title 
attribute of the principal.

Thanks,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Still trying to figure out PAU

2006-02-04 Thread Florian Lindner
Am Samstag, 4. Februar 2006 18:59 schrieb Gary Poster:
> On Feb 4, 2006, at 7:32 AM, Florian Lindner wrote:
> > Or do I need further grants or anything? Or do I misunderstand the
> > title
> > attribute of the principal.
>
> A principal's title is just used for display (see
> zope.security.interfaces, for instance, or look in apidoc at
> IPrincipal).  Role is different.  This might be the right place to look.

O thanks, you made my day!

Now it works so far I'm already looking for the next problem.

Thanks!

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Best way to add a Principal to PAU

2006-02-05 Thread Florian Lindner
Hello,
I've managed to add a principal to a principal folder inside a PAU:

  pau = getUtility(IAuthentication)
  pfolder = pau.keys()[0]
  principal = InternalPrincipal("def", "pwd123","a title", "a description")
  pfolder["def"] = principal

but I doubt that the most elegant way. How can I achieve do it more or less 
agnostic form the principal source (or a least from the name and ordinal 
postion inside PAU)?

Thanks,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Get classes implementing Interface

2006-02-06 Thread Florian Lindner
Am Montag, 6. Februar 2006 12:19 schrieb Stephan Richter:
> On Sunday 08 January 2006 10:01, Florian Lindner wrote:
> > I do it this way now:
> >
> >             utils =  getUtilitiesFor(IFactory)
> >             self.objects = {}
> >             for i in utils:
> >                 if IContainer in i[1].getInterfaces():
> >
> > the UtilityVocabulary gives the same result as getUtilitiesFor.
> > But that does not list all classes, for example there is no class of the
> > normal Folder.
>
> This is bad and I think a bug. Could you report it as an issue or even
> investigate it further and make a suggestion?


I'm not sure if I described it correctly. I've the following code:


def __call__(self):
from zope.app.zapi import *
from zope.component.interfaces import IFactory
from zope.app.container.interfaces import IContainer
utils =  getUtilitiesFor(IFactory)
for i in utils:
if "zope.app.content.Folder" == i[0]:
import pdb; pdb.set_trace()



at the breakpoint:

(Pdb) i
(u'zope.app.content.Folder', >)

(Pdb) i[1].getInterfaces()


(Pdb) IContainer in i[1].getInterfaces()
False


Should the latter return True? If yes and therefore it is a bug I'll try to 
investigate if further and/or report an issue.


Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Best way to add a Principal to PAU

2006-02-06 Thread Florian Lindner
Am Sonntag, 5. Februar 2006 22:37 schrieb Stephan Richter:
> On Sunday 05 February 2006 12:34, Florian Lindner wrote:
> > I've managed to add a principal to a principal folder inside a PAU:
> >
> >   pau = getUtility(IAuthentication)
> >   pfolder = pau.keys()[0]
> >   principal = InternalPrincipal("def", "pwd123","a title", "a
> > description") pfolder["def"] = principal
> >
> > but I doubt that the most elegant way. How can I achieve do it more or
> > less agnostic form the principal source (or a least from the name and
> > ordinal postion inside PAU)?
>
> Basically, your application should know the location of the Authentication
> Utility and the name of the principal folder. Also note that the principal
> class is principal folder specific.

Ok, so the way above is the way to go?

Why is the principal class folder specific?

BTW: Why does z.a.authentication.principalfolder.InternalPrincipal does not 
implement z.security.interfaces.IPrincipal? Or let 
z.a.authentication.principalfolder.IInternalPrincipal derive from IPrincipal?

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Trying to use browser:form -> 404

2006-02-09 Thread Florian Lindner
Hello,
I try to create a form build from a schema with browser:form:





interfaces.registrationForm looks like that:

from zope.interface import Interface
from zope.schema import TextLine, Password
class registrationForm(Interface):
login = TextLine(title=u"Username")


views.registrationForm:

class registrationForm(object):
def __init__(self):
import pdb; pdb.set_trace()
def getData(self):
import pdb; pdb.set_trace()
def setData(self):
import pdb; pdb.set_trace()

but when I try to call the URL: 
http://horus:8080/++skin++centershock/registrationForm.html I just get 404.

Why that? Anybody knows?

Thanks,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Trying to use browser:form -> 404

2006-02-10 Thread Florian Lindner
Am Freitag, 10. Februar 2006 11:37 schrieb Lennart Regebro:
> On 2/10/06, Florian Lindner <[EMAIL PROTECTED]> wrote:
> > It does not implement registrationForm. But I thought that
> > interfaces.registrationForm is only for providing the schema to build the
> > form, because of the for="*" it should displayable from all objects. Or
> > not?
>
> Right, but when you try to display a page that uses a schema for an
> object that does not implement that schema, it tries to look up an
> adapter between the object and the schema. And if that fails, the page
> will not be displayed. I suspect that may be the reason. Try to not
> define the schema and see if the page shows up.

I don't think that you're right...

Anyway, I tried it:
The schema is required, I can't leave it undefined. I've changed it to:

schema="CS.centershock.interfaces.ICentershock"

And called ++skin++centershock/cs/registerForm.html. cs is an object that does 
implement ICentershock. I've also tried to set for on the same value as 
schema or omitting it. Everything gave the same result: 404.

Any more ideas?

Thanks,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Trying to use browser:form -> 404

2006-02-10 Thread Florian Lindner
Am Donnerstag, 9. Februar 2006 22:45 schrieb Bernd Dorn:
> On 09.02.2006, at 19:27, Florian Lindner wrote:
> > Hello,
> > I try to create a form build from a schema with browser:form:
> >
> >  > name="registrationForm.html"
> > schema=".interfaces.registrationForm"
> > class=".views.registrationForm"
> > permission="zope.Public"
> > layer="centershock"
> > for="*"/>
> >
> >
> >
> > interfaces.registrationForm looks like that:
> >
> > from zope.interface import Interface
> > from zope.schema import TextLine, Password
> > class registrationForm(Interface):
> > login = TextLine(title=u"Username")
> >
> >
> > views.registrationForm:
> >
> > class registrationForm(object):
> > def __init__(self):
> > import pdb; pdb.set_trace()
> > def getData(self):
> > import pdb; pdb.set_trace()
> > def setData(self):
> > import pdb; pdb.set_trace()
> >
> > but when I try to call the URL:
> > http://horus:8080/++skin++centershock/registrationForm.html I just
> > get 404.
>
> maybe http://horus:8080/++skin++Centershock/registrationForm.html
>
> skin names are CamelCase per convention and layers lowercase

Not in my convention  ;-)

The skin is applied correctly, the 404 error page is rendered with my skin.

Regards,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Trying to use browser:form -> 404

2006-02-10 Thread Florian Lindner
Am Freitag, 10. Februar 2006 14:05 schrieb Garanin Michael:
> Do you register the 'centershock'skin?
> Write this part of zcml-code, please.

Yes, there are a number of page directives that use the centershock skin and 
are working correctly.

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Trying to use browser:form -> 404

2006-02-10 Thread Florian Lindner
Am Freitag, 10. Februar 2006 14:53 schrieb Lennart Regebro:
> On 2/10/06, Florian Lindner <[EMAIL PROTECTED]> wrote:
> > > Right, but when you try to display a page that uses a schema for an
> > > object that does not implement that schema, it tries to look up an
> > > adapter between the object and the schema. And if that fails, the page
> > > will not be displayed. I suspect that may be the reason. Try to not
> > > define the schema and see if the page shows up.
> >
> > I don't think that you're right...
>
> I think I am. :-)
>
> > Anyway, I tried it:
> > The schema is required, I can't leave it undefined. I've changed it to:
>
> Right, of course, it's a form...
> If you try browser:page instead of browser:form, does it work then?

Other pages in the same configure.zcml like:



or




are working. Just changing form to page gives an Unrecognized parameters error 
of course.

Regards,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Trying to use browser:form -> 404

2006-02-10 Thread Florian Lindner
Am Freitag, 10. Februar 2006 15:18 schrieb Garanin Michael:
> I simulate this for Buddy from buddydemo (see attached) ==> it is normal
> work for Buddy-object!
>
> I think you make mistakes:
> 1) __init__ for 'view' always get 3-parameters (self, context, request)

I've removed __init__ from the view class, like you did.

> 2) getData must return dictionary.

getData was never called (otherwise I would jumped into pdb).

Anyway, I've changed it accordingly and still no success.

Any more ideas?

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


  1   2   3   >