[Zope-dev] hurry.workflow class based work flows.

2009-06-22 Thread Michael Shaw
Hello,

I have been working with hurry.workflow in a project and had some 
questions about making hurry.workflow work with different work flows.

For this project each class can have a different work flow with it's own 
set of states and transitions. All of the instances of a given class 
share the same work flow.

To create these different work flows I have registered a utility for 
each class. The utility has a factory that creates instances of 
hurry.workflow.workflow.Workflow initialized with the correct set of 
transitions for that type. The utilities are named, to allow more than 
one utility to register for the hurry.interfaces.IWorkflow interface.

With many IWorkflow utilities the WorkflowInfo implementation can not 
find the utility it needs. So I changed the WorkflowInfo behavior by 
having it look for a named utility based on the class name of the 
instance. For example the work flow utility for the class 'Cat' is 
registered with the name "project.workflow.Cat" which I selected the 
pattern "project.workflow.{className}" to try and avoid naming conflicts.

This solution seems to work well for the project I am working on, 
however I am quite new to Zope and this is the first time I've made 
these kinds of modifications.

Does anyone have any thoughts about how this implementation could be 
improved, it doesn't feel like I'm taking the best advantage of the 
component model? If I could come up with a set of patches, would the 
change to a class based work flow be useful to include in hurry.workflow?

Regards,

Michael

-- 

Michael Shaw
Developer
Nunatak Systems Pty Ltd
15 Princes Street
Sandy Bay Tasmania 7005
Australia
P: 61 3 6223 7875
F: 61 3 6226 1887
e: michael.s...@nunatak.com.au
w: www.nunatak.com.au


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


[Zope-dev] repoze.component and repoze.configuration

2009-06-22 Thread Chris McDonough
I have released two new packages to PyPI.  These packages were inspired by 
(design almost entirely stolen from) zope.component and zope.configuration.  I 
don't really expect them to get much use, but writing them was enlightening. 
Maybe they'll be interesting to someone who wants to introduce people to 
zope-style componentry without using interfaces and zope-style configuration 
without schema or XML.

repoze.component


package: http://pypi.python.org/pypi/repoze.component/0.1
docs: http://docs.repoze.org/component/
code: http://svn.repoze.org/repoze.component/trunk/

This package differs from zope.component inasmuch as it disuses the concept of 
interface, instead favoring string markers.

repoze.configuration


package: http://pypi.python.org/pypi/repoze.configuration/0.1
docs: http://docs.repoze.org/configuration/
code: http://svn.repoze.org/repoze.configuration/trunk/

This package differs from zope.configuration inasmuch as it uses YAML instead 
of 
XML, and doesn't use schemas to define directive attributes.

Have fun,

- C

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


Re: [Zope-dev] RFC: ZTK custom publications, zope.app.publication, and zope.traversing

2009-06-22 Thread Martijn Faassen
Jim Fulton wrote:
[snip[
> I made it possible to override proxying by overriding the proxy  
> method.  At this point, I think zope.app.publication provides a pretty  
> reasonable base class for custom publication implementations, although  
> the module arrangement could be made a bit simpler.

Cool. :)

> I propose the following:
> 
> In phase 1 reduce the scope of zope.traversing:
> 
> - Move path traversal code to zope.tales

I'm very much +1 for anything that moves ZPT-only traversal to places 
where it's less likely to confuse the reader of the code into thinking 
it's URL traversal.

> - Move the URL traversal code used by zope.app.publisher.menu to  
> zope.app.publisher.menu. Refactor it to use the request.publication.   
> Deprecate definition of menu items without permissions.

I'm worried about how this affects dependencies. I wouldn't want, say, 
zope.container, zope.app.pagetemplate and zope.site to start depending 
on zope.app.publisher where now they depend only on zope.traversing 
(which is much more lightweight in the dependency department).

If you can do this without making zope.container depend (indirectly) on 
zope.app.pagetemplate and the like, or, say, zope.site on 
zope.contenttype, then I'm +1.

This means that we shouldn't make zope.traversing depend on 
zope.app.publisher at any stage, as this would completely screw up all 
graphs. The dependency for backwards compatibility should ideally be a 
loose one, not marked in the setup.py dependencies and only required if 
backwards compatibility is needed.

> Thoughts?

Please do watch those dependencies... The z3c.recipe.depgraph buildout 
recipe can help you generate dependency graphs. Please watch the scc 
graphs to see whether you aren't inadvertently creating more cycles.

Regards,

Martijn

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


Re: [Zope-dev] tabs in the source

2009-06-22 Thread Gary Poster

On Jun 22, 2009, at 1:16 PM, Adam GROSZER wrote:

> Hello,
>
> Maybe it's time for an svn commit police squad?
> 22 .py files have tabs... and I grepped only zope.* packages.

FWIW, to state the probably obvious, other projects handle this with  
varying degrees of increased control.

Some require one or more reviews before a commit (Launchpad and others  
support this--github maybe?  I forget).  Others require certain  
quality tests to pass before a branch is merged (I'm familiar with PQM  
or the upcoming Tarmac combined with bzr, but there are many many  
other posibilities, I'm sure).  Others use buildbot for various tests,  
using the social embarrassment vector.  Launchpad developers have  
ongoing experiments in this regard, currently combining all of the  
approaches.  I've found them much better than commit police squads  
both in terms of what they catch and what kind of interaction they  
encourage.

Jono Lange has a nice talk about code review, FWIW, with links to more  
(like Guido's old Mondrian video).  http://mumak.net/stuff/your-code-sucks.html

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


Re: [Zope-dev] tabs in the source

2009-06-22 Thread Benji York
On Mon, Jun 22, 2009 at 1:16 PM, Adam GROSZER wrote:
> Hello,
>
> Maybe it's time for an svn commit police squad?

/me readies the tear gas.
-- 
Benji York
Senior Software Engineer
Zope Corporation
___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] tabs in the source

2009-06-22 Thread Adam GROSZER
Hello,

Maybe it's time for an svn commit police squad?
22 .py files have tabs... and I grepped only zope.* packages.

-- 
Best regards,
 Adam GROSZER  mailto:agros...@gmail.com
--
Quote of the day:
Selfishness is the most basic motivation

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


Re: [Zope-dev] RFC: ZTK custom publications, zope.app.publication, and zope.traversing

2009-06-22 Thread Brian Sutherland
On Mon, Jun 22, 2009 at 09:01:16AM -0400, Jim Fulton wrote:
>>> - Create zope.publication from zope.app.publcatiobn
>>> - use webtest rather than zope.app.testing.
>>
>> What's webtest?
>
> http://pythonpaste.org/webtest/
>
> It's sort of like zope.app.testing.functional or zope.testbrowser but  
> for WSGI apps.  It *just* handles the publishing aspects of testing.   
> Tests can then manage their own application setup.  I think this will  
> make many tests simpler and cleaner as they can set up just enough of an 
> application as they need for their tests.

Ah, very interesting, so far I've been using wsgi-intercept which is
very similar and has been working well for me.

http://code.google.com/p/wsgi-intercept/

Though webtest, re-using the WebOb request does look interesting. 


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


Re: [Zope-dev] RFC: ZTK custom publications, zope.app.publication, and zope.traversing

2009-06-22 Thread Stephan Richter
On Monday 22 June 2009, Jim Fulton wrote:
> 2 examples:
>
> - Use a Python-based proxy that's good enough for supporting access  
> control in trusted code. (It wouldn't protect against devious  
> untrusted code, but most applications don't really need to run  
> untrusted code.)
>
> - Use a better system for managing checkers.
>
> Probably the most important feature is disabling proxy-based  
> protection for applications that don't need an access control model or  
> that use a non-proxy-based approach.

Thanks, that helps me to put a context around the discussion.

Regards,
Stephan
-- 
Entrepreneur and Software Geek
Google me. "Zope Stephan Richter"
___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] RFC: ZTK custom publications, zope.app.publication, and zope.traversing

2009-06-22 Thread Tim Hoffman
Hi Jim

Yeah I meant my ugly hacks getting rid of the 'c' in zope.proxy and
zope.security
aren't going to get supported by anyone, whereas having a supported way of
substituting proxies and security would be great.  All the import
dependancies that existed when I went through the excercise meant ugly hacks
was about all I could come up with.

The refactoring going on at the moment is fantastic.

T

On Mon, Jun 22, 2009 at 9:22 PM, Tres Seaver  wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Jim Fulton wrote:
> > On Jun 22, 2009, at 7:11 AM, Tim Hoffman wrote:
> >
> >> Big +1 from me on this.
> >
> > Cool.
> >
> >> I had to do a whole lot of hacks to get this stuff running on app
> >> engine and basically
> >> had to gut zope.proxy which was ugly
> >
> > How so?
> >
> >> and obviously unsupported.
> >
> > I don't think so.  What makes you think it's unsupported.
>
> I think Tim was referring to his mangled version of zope.proxy (no C
> extensions, to allow running on GAE).
>
>
> Tres.
> - --
> ===
> Tres Seaver  +1 540-429-0999  tsea...@palladion.com
> Palladion Software   "Excellence by Design"http://palladion.com
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.6 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFKP4WJ+gerLs4ltQ4RAi4IAJwM3/1FoX027kHSQKTzNCW0qYewJACdFQ+4
> tRgPtbJCmsMed1HNugqk9os=
> =znBD
> -END PGP SIGNATURE-
>
> ___
> Zope-Dev maillist  -  Zope-Dev@zope.org
> http://mail.zope.org/mailman/listinfo/zope-dev
> **  No cross posts or HTML encoding!  **
> (Related lists -
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope )
>
___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] RFC: ZTK custom publications, zope.app.publication, and zope.traversing

2009-06-22 Thread Jim Fulton

On Jun 22, 2009, at 9:22 AM, Tres Seaver wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Jim Fulton wrote:
>> On Jun 22, 2009, at 7:11 AM, Tim Hoffman wrote:
>>
>>> Big +1 from me on this.
>>
>> Cool.
>>
>>> I had to do a whole lot of hacks to get this stuff running on app
>>> engine and basically
>>> had to gut zope.proxy which was ugly
>>
>> How so?
>>
>>> and obviously unsupported.
>>
>> I don't think so.  What makes you think it's unsupported.
>
> I think Tim was referring to his mangled version of zope.proxy (no C
> extensions, to allow running on GAE).


Ah. Never mind. (/me says with a little old lady's voice) :)

Jim

--
Jim Fulton
Zope Corporation


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


Re: [Zope-dev] RFC: ZTK custom publications, zope.app.publication, and zope.traversing

2009-06-22 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Jim Fulton wrote:
> On Jun 22, 2009, at 7:11 AM, Tim Hoffman wrote:
> 
>> Big +1 from me on this.
> 
> Cool.
> 
>> I had to do a whole lot of hacks to get this stuff running on app  
>> engine and basically
>> had to gut zope.proxy which was ugly
> 
> How so?
> 
>> and obviously unsupported.
> 
> I don't think so.  What makes you think it's unsupported.

I think Tim was referring to his mangled version of zope.proxy (no C
extensions, to allow running on GAE).


Tres.
- --
===
Tres Seaver  +1 540-429-0999  tsea...@palladion.com
Palladion Software   "Excellence by Design"http://palladion.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFKP4WJ+gerLs4ltQ4RAi4IAJwM3/1FoX027kHSQKTzNCW0qYewJACdFQ+4
tRgPtbJCmsMed1HNugqk9os=
=znBD
-END PGP SIGNATURE-

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


Re: [Zope-dev] RFC: ZTK custom publications, zope.app.publication, and zope.traversing

2009-06-22 Thread Jim Fulton

On Jun 22, 2009, at 7:11 AM, Tim Hoffman wrote:

> Big +1 from me on this.

Cool.

>
> I had to do a whole lot of hacks to get this stuff running on app  
> engine and basically
> had to gut zope.proxy which was ugly

How so?

> and obviously unsupported.

I don't think so.  What makes you think it's unsupported.

Jim

--
Jim Fulton
Zope Corporation


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


Re: [Zope-dev] RFC: ZTK custom publications, zope.app.publication, and zope.traversing

2009-06-22 Thread Jim Fulton

On Jun 21, 2009, at 1:32 PM, Tres Seaver wrote:
...
>> Thoughts?
>
> +1.  I would also like to be able to break the current
> zope.app.publication dependencies within Zope2:
>
> - ZPublisher.BaseRequest uses zope.app.publication for the
>   EndRequestEvent class
>
> - Products.Five.compuonent likewise uses it for 'IBeginReqeustEvent',
>   'IEndRequestEvent', and 'BeforeTraverseEvent'
>
> Can we move those events and their interfaces out into a non-zope.app
> package?

+1

>  E.g., the as-yet-notional zope.publication package you mention
> for phase 3?

Maybe. Or maybe zope.publisher.


>  Or zope.traversing?

-1. I want to make zope.traversing be less about publishing.


>
>
>
> There are dependendencies on zope.app.publisher as well:
>
> - Products.Five.browser.adding uses 'getMenu'.
>
> - Products.Five.browser's configure.zcm uses IMenuItemType,
>   MenuAccessView, and IMenuAccessView.
>
> - Products.Five.form.metaconfigure uses menuItemDirective.
>
> - Produts.Five.viewlet.metaconfigure uses viewmeta.
>
> - Products.Five.fivedirectives uses IBasicResourceInformation.
>
> The first two may be the only real uses of the menu framework you
> discuss above.

I wouldn't be surprised if others used it too. (ZC might :)

Jim

--
Jim Fulton
Zope Corporation


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


Re: [Zope-dev] RFC: ZTK custom publications, zope.app.publication, and zope.traversing

2009-06-22 Thread Jim Fulton

On Jun 22, 2009, at 4:08 AM, Brian Sutherland wrote:

> On Sun, Jun 21, 2009 at 11:55:50AM -0400, Jim Fulton wrote:
>> - It aggressively proxies objects using
>> zope.security.checker.ProxyFactory.  Some people don't want
>>   to use proxies and those that do might want to use a different
>> proxy or checker implementation.
>
> Grok's publication sub-class is similar to mine:
>
>http://svn.zope.org/grok/trunk/src/grok/publication.py?view=markup
>
> We I think we both want security proxies around views, but not during
> traversal. I've also heard of people who want proxies around the  
> context
> and view, but not during traversal.

Yup.  I've wanted something like that too.

> It's pretty difficult to do the above securely, or at least I was able
> to open massive security holes while prototyping my publication  
> object;)
> Witness grok's "if IBrowserView.providedBy" dance in the URL above.

It's actually pretty easy. All you have to do is make the traversal  
adapters public. There aren't very many of them.

>> Maybe in phase 3:
>>
>> - Create zope.publication from zope.app.publcatiobn
>> - use webtest rather than zope.app.testing.
>
> What's webtest?

http://pythonpaste.org/webtest/

It's sort of like zope.app.testing.functional or zope.testbrowser but  
for WSGI apps.  It *just* handles the publishing aspects of testing.   
Tests can then manage their own application setup.  I think this will  
make many tests simpler and cleaner as they can set up just enough of  
an application as they need for their tests.

Jim

--
Jim Fulton
Zope Corporation


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


[Zope-dev] Zope Tests: 7 OK, 1 Failed

2009-06-22 Thread Zope Tests Summarizer
Summary of messages to the zope-tests list.
Period Sun Jun 21 12:00:00 2009 UTC to Mon Jun 22 12:00:00 2009 UTC.
There were 8 messages: 8 from Zope Tests.


Test failures
-

Subject: FAILED (failures=1) : Zope-2.11 Python-2.4.6 : Linux
From: Zope Tests
Date: Sun Jun 21 21:02:17 EDT 2009
URL: http://mail.zope.org/pipermail/zope-tests/2009-June/012004.html


Tests passed OK
---

Subject: OK : Zope-2.10 Python-2.4.6 : Linux
From: Zope Tests
Date: Sun Jun 21 21:00:13 EDT 2009
URL: http://mail.zope.org/pipermail/zope-tests/2009-June/012003.html

Subject: OK : Zope-trunk Python-2.4.6 : Linux
From: Zope Tests
Date: Sun Jun 21 21:04:18 EDT 2009
URL: http://mail.zope.org/pipermail/zope-tests/2009-June/012005.html

Subject: OK : Zope-trunk Python-2.5.4 : Linux
From: Zope Tests
Date: Sun Jun 21 21:06:21 EDT 2009
URL: http://mail.zope.org/pipermail/zope-tests/2009-June/012006.html

Subject: OK : Zope-trunk Python-2.6.1 : Linux
From: Zope Tests
Date: Sun Jun 21 21:08:23 EDT 2009
URL: http://mail.zope.org/pipermail/zope-tests/2009-June/012007.html

Subject: OK : Zope-trunk-alltests Python-2.4.6 : Linux
From: Zope Tests
Date: Sun Jun 21 21:10:23 EDT 2009
URL: http://mail.zope.org/pipermail/zope-tests/2009-June/012008.html

Subject: OK : Zope-trunk-alltests Python-2.5.4 : Linux
From: Zope Tests
Date: Sun Jun 21 21:12:23 EDT 2009
URL: http://mail.zope.org/pipermail/zope-tests/2009-June/012009.html

Subject: OK : Zope-trunk-alltests Python-2.6.1 : Linux
From: Zope Tests
Date: Sun Jun 21 21:14:24 EDT 2009
URL: http://mail.zope.org/pipermail/zope-tests/2009-June/012010.html

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


Re: [Zope-dev] RFC: ZTK custom publications, zope.app.publication, and zope.traversing

2009-06-22 Thread Tim Hoffman
HI

Big +1 from me on this.
I had to do a whole lot of hacks to get this stuff running on app engine and
basically
had to gut zope.proxy which was ugly and obviously unsupported.
After getting this running which was a big task I decided to go with
repoze.bfg which
just didn't have the security proxies at all because I wouldn't have to
support my wierd gutted
fork of zope.proxy and zope.security. (under gae I am not running any
untrusted code)

Having a standard way to turn this stuff would be great,

Rgds

Tim


On Mon, Jun 22, 2009 at 5:36 PM, Jim Fulton  wrote:

>
> On Jun 21, 2009, at 9:40 PM, Stephan Richter wrote:
>
> > On Sunday 21 June 2009, Jim Fulton wrote:
> >> Thoughts?
> >
> > +1. Sounds really good!
> >
> > BTW, I would love to hear about a practical example for overriding
> > proxy()
> > other than turning off security altogether.
>
>
> 2 examples:
>
> - Use a Python-based proxy that's good enough for supporting access
> control in trusted code. (It wouldn't protect against devious
> untrusted code, but most applications don't really need to run
> untrusted code.)
>
> - Use a better system for managing checkers.
>
> Probably the most important feature is disabling proxy-based
> protection for applications that don't need an access control model or
> that use a non-proxy-based approach.
>
> Jim
>
> --
> Jim Fulton
> Zope Corporation
>
>
> ___
> Zope-Dev maillist  -  Zope-Dev@zope.org
> http://mail.zope.org/mailman/listinfo/zope-dev
> **  No cross posts or HTML encoding!  **
> (Related lists -
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope )
>
___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] REQUEST vs. request

2009-06-22 Thread Patrick Gerken
Hi, thank you for all that answers, this was really helpful!

On Mon, Jun 22, 2009 at 12:18, Hanno Schlichting  wrote:

> On Tue, Jun 16, 2009 at 10:35 PM, Patrick Gerken
> wrote:
> > A testcase in my code fails, and after a lot of digging, I am finding
> that
> > the reason are wrong results from the catalog. The catalog returns bad
> > results because he caches the results in the request.
> > My test consists of a number of steps, for multiple times I do a
> > getMultiAdapter, always with fresh TestRequests. Still it seems, that the
> > catalog always use some other, rotten REQUEST.
>
> Looking at this again, you are missing an important point about the
> test framework you use.
>
> In all of ZopeTestCase (CMFTestCase, PloneTestCase) you get a
> convenience request object set up for you, reachable as app.REQUEST.
> This mirrors the way you usually get access to the request object in
> Zope2 via Acquisition down to the application root. It's meant to
> emulate a very minimal request object.
>
> Now in normal operation, you would get one request object per HTTP
> request. This also works in the functional variants of the test case
> classes.
>
> In the non-functional test classes you only ever get one request
> object set up, as there's no object publishing or HTTP request
> handling being done. If you or any code you call changes any settings
> on that request object and you want to test things dependent on this
> you have two options:  Either create a fresh request yourself (using
> Testing.makerequest) in your tests or use a functional test case
> instead.


I did excactly that. Since it was a caching issue in code out of my reach, I
had problems with.
Sadly, creating a new request and saving it on self.app.REQUEST was not
enough.

The code in question acquires the method that caches something on the
REQUEST from a getSite() call.
It seems like getSite() returns a copy of the site, and that has its own
copy of the request too.

>>> self.app.REQUEST == getSite().REQUEST
True

>>> self.app = makerequest(self.app)
>>> self.app.REQUEST == getSite().REQUEST
False

The copy getSite() returns is deleted in an EndRequest Event handler...

I did not use zc.testbrowser for testing, because I did test XMLRPC Methods,
and it seemed easier to just use getMultiAdapter and test the view directly.

I solved my issues but it is a bit inconvenient nowadays...

Best regards and thank you!

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


Re: [Zope-dev] REQUEST vs. request

2009-06-22 Thread Hanno Schlichting
On Tue, Jun 16, 2009 at 10:35 PM, Patrick Gerken wrote:
> A testcase in my code fails, and after a lot of digging, I am finding that
> the reason are wrong results from the catalog. The catalog returns bad
> results because he caches the results in the request.
> My test consists of a number of steps, for multiple times I do a
> getMultiAdapter, always with fresh TestRequests. Still it seems, that the
> catalog always use some other, rotten REQUEST.

Looking at this again, you are missing an important point about the
test framework you use.

In all of ZopeTestCase (CMFTestCase, PloneTestCase) you get a
convenience request object set up for you, reachable as app.REQUEST.
This mirrors the way you usually get access to the request object in
Zope2 via Acquisition down to the application root. It's meant to
emulate a very minimal request object.

Now in normal operation, you would get one request object per HTTP
request. This also works in the functional variants of the test case
classes.

In the non-functional test classes you only ever get one request
object set up, as there's no object publishing or HTTP request
handling being done. If you or any code you call changes any settings
on that request object and you want to test things dependent on this
you have two options:  Either create a fresh request yourself (using
Testing.makerequest) in your tests or use a functional test case
instead.

Especially in Plone where quite a bit of information is cached on the
request object, you can run into this situation.

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


Re: [Zope-dev] RFC: ZTK custom publications, zope.app.publication, and zope.traversing

2009-06-22 Thread Jim Fulton

On Jun 21, 2009, at 9:40 PM, Stephan Richter wrote:

> On Sunday 21 June 2009, Jim Fulton wrote:
>> Thoughts?
>
> +1. Sounds really good!
>
> BTW, I would love to hear about a practical example for overriding  
> proxy()
> other than turning off security altogether.


2 examples:

- Use a Python-based proxy that's good enough for supporting access  
control in trusted code. (It wouldn't protect against devious  
untrusted code, but most applications don't really need to run  
untrusted code.)

- Use a better system for managing checkers.

Probably the most important feature is disabling proxy-based  
protection for applications that don't need an access control model or  
that use a non-proxy-based approach.

Jim

--
Jim Fulton
Zope Corporation


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


Re: [Zope-dev] [Checkins] SVN: zope.traversing/trunk/src/zope/traversing/ Moved the publicationtraverse module from zope.app.publication and added tests.

2009-06-22 Thread Jim Fulton

On Jun 21, 2009, at 3:38 PM, Laurence Rowe wrote:

> Jim Fulton wrote:
>> I don't agree. The semantics are different. For example, you often
>> want to traverse to things in a template that you don't want to  
>> expose
>> via URL.  We currently (or last time I checked) expose ++resource+
>> +name in URLs and this is a bug.
>
> What use is a resource without being URL accessible? It's used fairly
> often in Plone products to expose static css / js / images.


The way to access a resource in a URL is /@@/name, as Hanno  
mentioned.  The ++resource++name form is intended for use in ZPT  
paths.  It can be used anywhere in a path, which defeats effective  
caching of resources.

Jim


--
Jim Fulton
Zope Corporation


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


Re: [Zope-dev] REQUEST vs. request

2009-06-22 Thread Reinout van Rees
On 2009-06-16, Patrick Gerken  wrote:
>
> A testcase in my code fails, and after a lot of digging, I am finding that
> the reason are wrong results from the catalog. The catalog returns bad
> results because he caches the results in the request.
> My test consists of a number of steps, for multiple times I do a
> getMultiAdapter, always with fresh TestRequests. Still it seems, that the
> catalog always use some other, rotten REQUEST.

I've had the same problem in some test.  If I remember correctly it had to do
with the path index.  What I did in the end in my doctest was to delete the
REQUEST attribute that the index used for caching.  It looks a bit weird to
have a delete_interfering_request_to_fix_test() all the time, but it worked.


Reinout  

-- 
Reinout van Rees - rein...@vanrees.org - http://reinout.vanrees.org
Software developer at http://www.thehealthagency.com
"Military engineers build missiles. Civil engineers build targets

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


Re: [Zope-dev] RFC: ZTK custom publications, zope.app.publication, and zope.traversing

2009-06-22 Thread Brian Sutherland
On Sun, Jun 21, 2009 at 11:55:50AM -0400, Jim Fulton wrote:
> - It aggressively proxies objects using  
> zope.security.checker.ProxyFactory.  Some people don't want
>to use proxies and those that do might want to use a different  
> proxy or checker implementation.

Grok's publication sub-class is similar to mine:

http://svn.zope.org/grok/trunk/src/grok/publication.py?view=markup

We I think we both want security proxies around views, but not during
traversal. I've also heard of people who want proxies around the context
and view, but not during traversal.

It's pretty difficult to do the above securely, or at least I was able
to open massive security holes while prototyping my publication object;)
Witness grok's "if IBrowserView.providedBy" dance in the URL above. 

> Maybe in phase 3:
> 
> - Create zope.publication from zope.app.publcatiobn
> - use webtest rather than zope.app.testing.

What's webtest?

> Thoughts?

Sounds good!

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

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