[Zope-dev] zope.globalrequest?
Tres Seaver
tseaver at palladion.com
Sun Jan 18 11:38:10 EST 2009
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Laurence Rowe wrote:
> Roger Ineichen wrote:
>
>> just a sample;
>> In my point of view an application like a wiki or forum etc.
>> should get developed as a python application without to require
>> a global request because it's just a (MVC) model part. There should
>> never be a request involved. If such a wiki needs a "last modified user"
>> argument. This should not get set by a global request lookup.
>> Or at least not the model should use such a global request by itself.
>> If you need to set such a "last user modified" argument the view/controller
>> should be responsible for doing so. I'm pretty sure if we have a global
>> request available we will see very quick that developer start to use
>> the global request in the model part.
>>
>> Note, mixin model, view and controller responisibilities into one
>> component/object make it allmost impossible to replace or reuse
>> parts of it.
>
> The most convincing reason for me to persevere with the current pattern
> of views is that it offers the possibility of adaption on the request.
> This is something that repoze.bfg is exploring and I think could be
> helpful, for instance registering separate views on POSTRequest from
> GETRequest.
BFG has always looked up views by adaptation of context and request,
using the ZCA: there isn't anything we are "exploring" about that,
although Chris moved the method-name-based factories from an external
package into the core recently, making it easier to use the RESTy
request types.
> I don't see anything wrong in allowing a utility access to the request
> without explicitly including it in its method signature. If they choose
> to use it from a model, it's their foot and they are free to shoot it if
> they wish.
If a utliity *must* have access to the request, then it should either be
a view (and get it for free) or get it passed to it from a view as an
argument. That is how the ZCA is suppoed to be used, separating the
concerns between request-dependant and request-independent code.
I don't actually know how this package fits in with either Z2 or Z3: Z2
apps are always able to acquire the request, while Z3 apps use the
"separation of concerns" pattern I just outlined. I've never wanted a
'get_request' method in "production" code: I would consider the need
for it a sign that something in the application is factored wrongly.
Tres.
- --
===================================================================
Tres Seaver +1 540-429-0999 tseaver at 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
iD8DBQFJc1ry+gerLs4ltQ4RAqtyAKCSkm/O+3pNv/d7xIwXZjWl0N+LjwCcDKqh
pIIBN2SqbQGMJcGrlFa87+g=
=Ak9N
-----END PGP SIGNATURE-----
More information about the Zope-Dev
mailing list