Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Suggestion for Request namespace provisioning
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Jonathan Vanasco  
View profile  
 More options Oct 30 2012, 2:17 pm
From: Jonathan Vanasco <jonat...@findmeon.com>
Date: Tue, 30 Oct 2012 11:17:24 -0700 (PDT)
Local: Tues, Oct 30 2012 2:17 pm
Subject: Suggestion for Request namespace provisioning
The past few updates to Pyramid have had a few changes around the
Request object - new attributes, new functionality to add attributes,
etc.

With that, combined with the best-practice of passing the Request
object around during the request lifecycle,   I wanted to suggest
creating a 'project' and 'plugin' namespace under request , so that
(moving forward) as people develop plugins or write app specific
request attributes there is no issue for collision against each other
or future Pyramid releases.

The general idea would be this:
   request.project = reserved for your app ( or
request.projects.project_name ).  do what you want.
   request.plugins = reserved for plugins that need to attach data to
the request object.  ex: request.plugins.sqlalchemy

The main idea is that instead of using 'set_property', you'd use
'set_project_property' or similar.  Not suggesting that we drop the
current scenario, just that
- the request object has a lot of stuff in it now
- i can see the request object's attributes/methods growing as Pyramid
matures
- i fear namespace collision.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Merickel  
View profile  
 More options Oct 30 2012, 3:03 pm
From: Michael Merickel <mmeri...@gmail.com>
Date: Tue, 30 Oct 2012 14:02:53 -0500
Local: Tues, Oct 30 2012 3:02 pm
Subject: Re: Suggestion for Request namespace provisioning

On Tue, Oct 30, 2012 at 1:17 PM, Jonathan Vanasco <jonat...@findmeon.com> wrote:
> With that, combined with the best-practice of passing the Request
> object around during the request lifecycle,   I wanted to suggest
> creating a 'project' and 'plugin' namespace under request , so that
> (moving forward) as people develop plugins or write app specific
> request attributes there is no issue for collision against each other
> or future Pyramid releases.

> - i fear namespace collision.

No doubt this is a concern. Fortunately request properties do fall
under Pyramid's conflict resolution mechanism. A good convention is
already possible by creating an object on request that exposes your
methods.

class RequestExtensions(object):
    def __init__(self, request):
        self.request = request

    @reify
    def some_cached_property(self):
        return 'foo'

    def some_method(self, **kw):
        return 'bar'

config.add_request_method(RequestExtensions, 'myplugin', reify=True)

will allow

request.myplugin.some_api
request.myplugin.some_method()

I'm not sure Pyramid needs any sugar over top of this pattern.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jonathan Vanasco  
View profile  
 More options Oct 30 2012, 4:34 pm
From: Jonathan Vanasco <jonat...@findmeon.com>
Date: Tue, 30 Oct 2012 13:34:56 -0700 (PDT)
Local: Tues, Oct 30 2012 4:34 pm
Subject: Re: Suggestion for Request namespace provisioning
That pattern / functionality is great.  I'm just talking about
proactively saying "this name space is reserved for plugins, this
namespace for projects - you can rest assured that as Pyramid grows
and new functionality is added, you will not be affected as long as
you stay within that container".  Right now, request.foo is a bit of a
lottery -- from my perspective, chances are you won't add anything to
Pyramid over there, but its not an explicit/futureproof property.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Merickel  
View profile  
 More options Oct 30 2012, 4:50 pm
From: Michael Merickel <mmeri...@gmail.com>
Date: Tue, 30 Oct 2012 15:49:19 -0500
Local: Tues, Oct 30 2012 4:49 pm
Subject: Re: Suggestion for Request namespace provisioning

On Tue, Oct 30, 2012 at 3:34 PM, Jonathan Vanasco <jonat...@findmeon.com> wrote:
> That pattern / functionality is great.  I'm just talking about
> proactively saying "this name space is reserved for plugins, this
> namespace for projects - you can rest assured that as Pyramid grows
> and new functionality is added, you will not be affected as long as
> you stay within that container".  Right now, request.foo is a bit of a
> lottery -- from my perspective, chances are you won't add anything to
> Pyramid over there, but its not an explicit/futureproof property.

I think it's cool that Pyramid provides a way to do it, but I don't
think layering that opinion on top belongs in the core.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris McDonough  
View profile  
 More options Oct 30 2012, 5:06 pm
From: Chris McDonough <chr...@plope.com>
Date: Tue, 30 Oct 2012 17:06:10 -0400
Local: Tues, Oct 30 2012 5:06 pm
Subject: Re: Suggestion for Request namespace provisioning
On 10/30/2012 04:49 PM, Michael Merickel wrote:

> On Tue, Oct 30, 2012 at 3:34 PM, Jonathan Vanasco <jonat...@findmeon.com> wrote:
>> That pattern / functionality is great.  I'm just talking about
>> proactively saying "this name space is reserved for plugins, this
>> namespace for projects - you can rest assured that as Pyramid grows
>> and new functionality is added, you will not be affected as long as
>> you stay within that container".  Right now, request.foo is a bit of a
>> lottery -- from my perspective, chances are you won't add anything to
>> Pyramid over there, but its not an explicit/futureproof property.

> I think it's cool that Pyramid provides a way to do it, but I don't
> think layering that opinion on top belongs in the core.

Also, FWIW, even if people add some namespacey thing, those namespacey
things themselves are subject to conflict.  So telling folks to bundle
up everything into a namespace isn't a complete solution either.  The
only true solutions are untenable without ridicule (UUIDs, Java-style
"com.pyramid.myplugin" style namespaces).

I'd rather just let the chips fall where they may here and instruct
folks to create plugins that don't supply unduly generic request
properties.  If they supply one, so be it; the system will let the user
know there's a conflict, and they can work it out with the authors.

Note that this is how Emacs plugins have worked for many years, and
Emacs has a *lot* more plugins than does Pyramid. ;-)  And they don't
even have conflict detection.

- C


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jonathan Vanasco  
View profile  
 More options Nov 5 2012, 4:22 pm
From: Jonathan Vanasco <jonat...@findmeon.com>
Date: Mon, 5 Nov 2012 13:22:04 -0800 (PST)
Local: Mon, Nov 5 2012 4:22 pm
Subject: Re: Suggestion for Request namespace provisioning

these are all good points.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »