As the discussion from Christoph shows, some WebHelpers need access to
framework-specific services: url_for, session, query parameters, etc.
This is incompatible with providing a pure framework-neutral set of
helpers.  Yet not including these functions at all would make
WebHelpers poorer.  So, there are a few choices:

A) Define these helpers as Pylons-specific.

B) Define WebHelpers Pylons-specific and fold it into the mythical
PylonsExtras package.

C) Fold WebHelpers into PylonsExtras but also try to keep as many
helpers framework-neutral as possible.

D) Put Pylons-specific helpers under webhelpers.pylons.

E) Define a framework-service API, which Pylons and other frameworks
could implement.  This could be done as:

    1) A set of functions under webhelpers.pylons

    2) A set of functions in Pylons, which it would export to WebHelpers.

    3) An object encapsulating (1) or (2).  The framework would
register a callback with methods for url_for, get_session_var,
put_session_var, get_query_param.  (I think that's all that's
necessary.)  Non-Routes frameworks can fake url_for with enough
compatibility for the helpers.

    4) Put all (framework-specific?) helpers in an abstract class, and
let the frameworks define subclasses.

    5) Use the WSGI environ as data for the API.  Then, if the
framework gives WebHelpers a little assistance regarding which key
url_for, a compatible session API, and the query params are under, the
helpers could do their business.

It seems like E3 is the most feasable.  Since the helpers are
independent functions and objects, the callback would have to be a
global (module-level) object.  This means Pylons would have to supply
a StackedObjectProxy?  So somewhere Pylons would need a function to
create such an object, and the user would call it in environment.py or
middleware.py.  Would a WebHelpersMiddleware help with this somehow?

Does anybody have any other ideas about this?

-- 
Mike Orr <[EMAIL PROTECTED]>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-devel" group.
To post to this group, send email to pylons-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-devel?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to