Re: [Zope3-dev] Wiki permissions and PAU [Zope3-dev] Form framework, adapters and pau

2005-04-13 Thread Dominik Huber
Paolo Invernizzi wrote:
I've a problem with the wiki that I can't resolve... Zope3 trunk current.
I've added a PAU to 
http://eye:8080/++etc++site/default/@@contents.html with a 
PrincipalFolder and some principals.

I've activated the No Challenge if Authenticated and the Zope Realm 
Basic-Auth

I've also granted some principals in http://eye:8080/@@grant.html some 
principal of the folder with the Site Manager role.

While everything is working pretty well, the principal can login, 
administer the site etc,etc I've a problem...

I added a Wiki. While the principal can access single pages, the 
search in http://eye:8080/the_wiki/@@search.html, see the contents in 
http://eye:8080/the_wiki/@@contents.html, if cannot access the Table 
of contents http://eye:8080/the_wiki/@@toc.html (You are not authorized).
That's an artefact of the problem we dicussed currently in [Zope3-dev] 
Form framework, adapters and pau thread.

Only the global authentication is invoked, because  the trusted 
WikiPageHierarchyAdapter does not implement ILocation. Therefore your 
user does not 'exists' during the authentication and that is leading to 
this failure.

Temporary workaround: zwiki\wikipage.py line 73, derive 
WikiPageHierarchyAdapter from Location

from zope.app.location import Location
class WikiPageHierarchyAdapter(Location):
 ...
We' ve planed to fix that problem correctly:
http://mail.zope.org/pipermail/zope3-dev/2005-April/014140.html
Regards,
Dominik Huber
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com


Re: [Zope3-dev] httpdoc problems

2005-04-13 Thread Stephan Richter
On Monday 11 April 2005 11:46, Garrett Smith wrote:
 I'm getting this rather uninformative error message when I try to build
 a doctest using tcpwatch output.

 Traceback (most recent call last):
   File \SCM\zope\Zope3\src\zope\app\testing\dochttp.py, line 224, in ?
     main()
   File \SCM\zope\Zope3\src\zope\app\testing\dochttp.py, line 101, in
 dochttp
     assert (request and response) or not (request or response)
 AssertionError

TCPWatch sometimes does not work well for binary data. Simply remove all the 
request files from the record directory that does not have a matching 
response.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics  Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



Re: [Zope3-dev] Test Failures when running tests with -N 2

2005-04-13 Thread Stephan Richter
On Sunday 10 April 2005 18:57, Tim Peters wrote:
  Right, I know about this. Mmh, in fact, it surprises me now that my
  deprecation module doctests do not complain in the second run. It is
  probably one of the advantages of doc file tests, since their module gets
  regenerated for every test run, so that the deprecation framework does
  not detect the warning duplication.

 That probably accounts for it.  warnings.py does a truly horrid thing
 to detect duplicates:  when a warning is first raised in module M, it
 creates a secret M.__warningregistry__ attribute, to record all
 warnings (text, category, and line number) ever raised in M.  If M
 goes away, so does the record of the warnings it raised.

Another reason to write doc tests. :-)

Regards,
Stephan
-- 
Stephan Richter
CBU Physics  Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



RE: [Zope3-dev] RE: [Zope3-Users] page uses foreignview:contextchanged

2005-04-13 Thread Roger Ineichen


Regards
Roger Ineichen

Projekt01 GmbH
www.projekt01.ch
_
END OF MESSAGE  

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On 
 Behalf Of Florian Lindner
 Sent: Wednesday, April 13, 2005 7:49 AM
 To: [EMAIL PROTECTED]
 Cc: zope3-dev@zope.org
 Subject: Re: [Zope3-dev] RE: [Zope3-Users] page uses 
 foreignview:contextchanged
 
 Am Samstag, 9. April 2005 02:21 schrieb Roger Ineichen:
  Behalf Of Florian Lindner
 
   Sent: Friday, April 08, 2005 8:18 PM
   To: zope3-dev@zope.org; [EMAIL PROTECTED]
   Subject: Re: [Zope3-dev] RE: [Zope3-Users] page uses foreign
   view:contextchanged
  
   Am Mittwoch, 6. April 2005 18:26 schrieb Roger Ineichen:
Hi Florian
   
Behalf Of Florian Lindner
   
 Sent: Wednesday, April 06, 2005 11:10 PM
 To: zope3-dev@zope.org; [EMAIL PROTECTED]
 Subject: Re: [Zope3-dev] RE: [Zope3-Users] page uses foreign
 view: contextchanged

 Am Mittwoch, 6. April 2005 17:01 schrieb Roger Ineichen:
  Hi Florian
 
  Behalf Of Florian Lindner
 
   Sent: Wednesday, April 06, 2005 10:22 PM
   To: zope3-users@zope.org
   Subject: [Zope3-Users] page uses foreign view: 
 context changed
  
   Hello,
   I'vw a viewA on a objectA including a macro:
  
  
   metal:block define-macro=info
 span tal:replace=context/__name__ /
   /metal:block
  
   A view of objectB uses this macro and inserts it into its

 own viewB:
  I can't follow. What do you try to say?
  What is A view of objectB and its own viewB?

 A object uses a macro which is defined in a view of
  
   another object.
  
 In this macros I want to access the data from the object
  
   the view was
  
 originaly registered for.
   
Ok, I was thinking about that you mean somthing like this.
This isn't possible. Or let's say you mix up some parts.
   
The macro which you suggest is just a page template. 
 This template
you are useing in a view. If this macro is also used in
  
   another view,
  
it has in this usecase nothing to do with the other 
 view. There is
no relation, if you register a page template as a macro 
 and a second
time as a view, between the macro and the view.
   
Perhaps I don't understand this correctly. Can you post the ZCML
directive, then I see what you mean?
  
   Ok, I've understand the problem.
  
   What I want:
  
   A folderish object f has a view. This should display
   information from the
   children of f. The children provide this information as a
   snippet of HTML
   code which could be inserted directly in f's view.
  
   f
  
   |- a
   |- b
   |- c
   |- d
  
   The view of f should iterate through [a,b,c,d] and get the
   snippet from every
   object. The snippets should be in the same order like the
   objects in the
   folder. Only direct children should be called.
  
   The problem I see with pagelets that the order is undefinied
   and that all
   children (recursivly) and not only direct children are called.
  
   Or is the best way to implement a own MacroCollector for that?
 
  No pagelets are not the concept for collecting information
  from objects others then the context.
 
  If you like to use parts of the pagelet concept, you can use
  pagedata adapters. But I whould use a simply view on the folder
  for this.
 
  Write a view 'childView' for childs and a view 'folderView' for
  folder f with a method getHTML like:
 
 
  def __init__(self, context, request):
self.context = context
self.request = request
 
  def getHTML(self):
 
htmlcode = 
 
# get the childs of folder 'f'
childs = self.context.values()
 
for item in childs:
 
  # get the 'childView' for each item
  view = zapi.getMultiAdapter((self.context, item), 
 name='childView')
 
  # call the view, this returns the html code of the view
  htmlcode += view()
 
# return all html code where get collected
return htmlcode
 
  The view 'childView' is a page template where contains the html.
 
 
  The result of getHTML can be used in the folder view like:
 
  tal:block content=structure context/getHTML /
 
  I think this is the easiest way. You can also implement some
  permission checks before you access the childs. If you use
  different permissions on childs.
 
 Hi Roger,
 
 thanks, that works for so fine.
 I've replaced your getMultiAdapter call by 
   view = getView(item, childInfo, self.request)
 I think that's a little bit nicer.
 
 One more question: How can I use only a specific macro of the view?

try this:

def __init__(self, context, request):
  self.context = context
  self.request = request

def getMacro(self):

  macrocode = 
  # get the childs of folder 'f'
  childs = self.context.values()

  for item in childs:

# get the 'childView' for each item
view = zapi.getMultiAdapter((self.context, item), name='childView')

# call the view, this 

Re: [Zope3-dev] Re: HTTP 405: Method Not Allowed

2005-04-13 Thread Stephan Richter
On Thursday 07 April 2005 16:06, Philipp von Weitershausen wrote:
    class MethodNotAllowed(Exception):
        implements(IMethodNotAllowed)
 
        def __init__(self, object, request):
            self.allow = [name for name, adapter
                          in zapi.getAdapters((object, request), Interface)
                          if hasattr(adapter, name)]
 
        def __str__(self):
            return 'Allow: %s' % self.allow
 
 
    class MethodNotAllowedView:
 
        def __init__(self, error, request):
            self.error = error
            self.request = request
 
        def __call__(self):
            self.request.response.setHeader('Allow', ',
  '.join(self.error.allow)) self.request.response.setStatus(405)
            return 'Method Not Allowed'

 This looks good. I'm +1 on this.

+1 I think this is a first good step. We have to think about the special cases 
a bit harder.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics  Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



Re: [Zope3-dev] bug in workflow/stateful/instance.py ?

2005-04-13 Thread Stephan Richter
On Saturday 02 April 2005 10:51, Markus Leist wrote:
  If you can provide a test, I check it in. The test is always what takes
  time. :-):-)

 hope, it's ok in  this kind?

Fixed in revision 29960.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics  Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com