Re: URL mappings to views

2011-11-17 Thread Michael Merickel
Were the resources in the Pyramid documentation unhelpful? There is a tutorial in the documentation as well. http://docs.pylonsproject.org/projects/pyramid/en/1.2-branch/narr/urldispatch.html http://docs.pylonsproject.org/projects/pyramid/en/1.2-branch/tutorials/wiki2/index.html -- Michael --

Re: URL mappings to views

2011-11-17 Thread Michael Merickel
Well mapping URLs to views is what Pyramid does best, and provides several ways to do it. There is traversal, and url dispatch. There are also a couple ways to add views. What I suggest you do is follow the tutorial for building the wiki2 via url dispatch as it is intended to show some of the best

Re: beaker configuration

2011-11-19 Thread Michael Merickel
I just pushed out 0.6.1, please let me know if that solves your 1.6 issues. -- Michael -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send

Re: cleaning up after a request, always?

2011-11-21 Thread Michael Merickel
The biggest argument I have for transaction management is a product of how views interact with the Pyramid rendering system. Templates are rendered *after* you have returned from your view unless you explicitly call render() or render_to_response(). If you call commit() in your view, that data is

Re: Serving Images Dynamically

2011-11-21 Thread Michael Merickel
John, he's using Pylons. -- Michael -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to

Re: What is wrong with Pyramid? Open Letter to Community

2011-11-22 Thread Michael Merickel
Along with that, the cookbook has links to several third-party projects implemented in Pyramid. For example shootout is a full-blown application in Pyramid for using SQLAlchemy, URL Dispatch and auth. A lot of the tutorials and examples that I think will benefit the community the most will not

Re: How can I map a dash/hyphen in a route 'action' under pyramid ?

2011-11-22 Thread Michael Merickel
The other option of course is to specify the name of the action. @action(name='sign-up', renderer=...) def sign_up(self): ... On Tue, Nov 22, 2011 at 11:41 PM, Chris McDonough chr...@plope.com wrote: On Wed, 2011-11-23 at 00:36 -0500, Chris McDonough wrote: On Tue, 2011-11-22 at 21:28

Re: What happens to the Pylons documentation ?

2011-11-24 Thread Michael Merickel
All of the documentation was recently moved to readthedocs.org and this is likely an artifact of that move. On Thu, Nov 24, 2011 at 2:51 AM, denny dope evilempi...@gmail.com wrote: About three days hanging documentation where half of the Ukrainian and half in English, what is it? What's going

Re: What happens to the Pylons documentation ?

2011-11-24 Thread Michael Merickel
it, because we often have to work with it. Somebody provide a URL, please. 2011/11/24 Michael Merickel mmeri...@gmail.com All of the documentation was recently moved to readthedocs.org and this is likely an artifact of that move. On Thu, Nov 24, 2011 at 2:51 AM

Re: Multiple Renderings of a Single View

2011-11-25 Thread Michael Merickel
Yep, you can even do this with the same route. For example if you have the report route that should return json if the url is '/report?fmt=json', the predicate can change the renderer. config.add_route('report', '/report') @view_config(route_name='report', renderer='report.mako')

Re: Best (or better practice)

2011-11-29 Thread Michael Merickel
The request object is already available in the template so you don't need to pass it in at all. Personally I'd say the only reason to pass things in explicitly from the view dict would be if you wanted to do some pre-processing on any of the object fields. For something like a user object that's

Re: Best (or better practice)

2011-11-29 Thread Michael Merickel
able to simplify things. This is yet another g. I don't understand the purpose of the BeforeRender subscriber if the template can already get the user object from the request object. Mark On Nov 29, 2011, at 10:46 AM, Michael Merickel wrote: The request object is already available

Re: pyramid.config - what is _ainfo ?

2011-11-29 Thread Michael Merickel
planning on doing that you'd need to trace the undocumented apis. On Tue, Nov 29, 2011 at 8:09 PM, Michael Merickel mmeri...@gmail.comwrote: Configurator._ainfo is basically a stack that tracks the call stack of actions. An action is something decorated with the @action_method decorator

Re: config.add_wsgi_app?

2011-12-05 Thread Michael Merickel
Does this help? Basically you can add a view that is actually a wsgi application. http://docs.pylonsproject.org/projects/pyramid/en/1.2-branch/api/wsgi.html On Mon, Dec 5, 2011 at 6:57 AM, Michael Kerrin michael.ker...@gmail.comwrote: Hi, I am starting to use Pyramid for a project and I want

Re: config.add_wsgi_app?

2011-12-05 Thread Michael Merickel
, Michael On 5 December 2011 16:30, Michael Merickel mmeri...@gmail.com wrote: Does this help? Basically you can add a view that is actually a wsgi application. http://docs.pylonsproject.org/projects/pyramid/en/1.2-branch/api/wsgi.html On Mon, Dec 5, 2011 at 6:57 AM, Michael Kerrin

Re: Docs fail to mention bin/activate

2011-12-06 Thread Michael Merickel
The Pyramid docs intentionally don't do this so that in the documentation it is explicit every time the python command is invoked that it is coming from the virtualenv. If a user skipped the activate in the tutorial they'd see that we're using python all over the place and not understanding that

Re: Pyramid 1.2.4 released

2011-12-06 Thread Michael Merickel
Maybe just easy_install -U pyramid or pip install -U pyramid instead of going through setup.py develop. On Tue, Dec 6, 2011 at 6:10 AM, rihad ri...@mail.ru wrote: How can I upgrade to 1.2.4? I've tried this: (pyramidtut)[rihad@sol ~/pyramidtut/tutorial]$ python setup.py develop -U but...

Re: Docs fail to mention bin/activate

2011-12-06 Thread Michael Merickel
...@mail.ru wrote: On Dec 6, 9:10 pm, Michael Merickel mmeri...@gmail.com wrote: The Pyramid docs intentionally don't do this so that in the documentation it is explicit every time the python command is invoked that it is coming from the virtualenv. The thing is, python setup.py is all over

Re: Conflicting configuration actions

2011-12-07 Thread Michael Merickel
You are settings the session factory 3 times. The two calls that actually conflict are: config = Configurator(settings = settings, session_factory = session_factory) and config.set_session_factory(session_factory) However, note that config.include('pyramid_beaker') also sets the session

Re: Best way for passing variable between callables

2011-12-07 Thread Michael Merickel
Well if it's a view callable then it the most reasonable thing to do is probably modify the request object to a state that view_b is expecting. If you really need to special case something so that view_b knows it's not serving a real request then it should probably be refactored into a separate

Re: Conflicting configuration actions

2011-12-08 Thread Michael Merickel
, session_factory = session_factory) config.include('pyramid_beaker') But can I use beaker now? (As you will have guessed by now, I am a newbe on pyramid.) On 7 dec, 22:13, Michael Merickel mmeri...@gmail.com wrote: You are settings the session factory 3 times. The two calls that actually

Re: how to add query parameters to the current url in view code?

2011-12-08 Thread Michael Merickel
request.route_url() has a _query argument that is documented. request.route_url('countries_list', _query={'sort': 'foo', 'dir': 'asc'}) # - http://127.0.0.1:6543/countries/list?sort=foodir=asc

Re: Pyramid 1.3a1 released

2011-12-10 Thread Michael Merickel
Right this isn't an attempt to recreate Paste within Pyramid. Pyramid provides other recommended ways of scripting via bootstrap. I'd suggest loiokng into those before looking for a paste.replacement. On Dec 10, 2011 7:48 PM, jerry jerryji1...@gmail.com wrote: Thanks bunch for the early

Re: Model validation

2011-12-13 Thread Michael Merickel
On Tue, Dec 13, 2011 at 2:29 PM, rihad ri...@mail.ru wrote: I totally agree. But this comes at a cost: you have to be nearly just as proficient and experienced as its authors to appreciate its full power. Actually it just means you have to read the documentation to use it. You can't just sit

Re: Events system

2011-12-14 Thread Michael Merickel
Pyramid's event system is simply the ZCA registry. You can add subscribers to data types/interfaces, and you can notify those subscribers via the registry. class MyEvent(object): pass @subscribe(MyEvent) def do_something(event): # do stuff with the event e = MyEvent()

Re: Events system

2011-12-14 Thread Michael Merickel
The point of any event system is that the subscribers are decoupled from the publishers. In your example it seems you're mangling the concept of an event to mean publish and it's heavily coupled to the do_something listener. Anyway the point is that Pyramid has a pub/sub system within it that

Re: how to use several Bases with config.include and a shared DBSession

2011-12-16 Thread Michael Merickel
In SQLAlchemy the metadata is the central object that binds tables together and describes their relationships. It is not possible to describe relationships between tables that are defined using different metadata objects. As you know already, each Base creates its own shared metadata object

Re: how to use several Bases with config.include and a shared DBSession

2011-12-16 Thread Michael Merickel
at 9:26 AM, Michael Bayer mike...@zzzcomputing.comwrote: On Dec 16, 2011, at 3:23 AM, Michael Merickel wrote: In SQLAlchemy the metadata is the central object that binds tables together and describes their relationships. It is not possible to describe relationships between tables

Re: debug_notfound of url

2011-12-19 Thread Michael Merickel
I think we answered this on IRC already but I think it had to do with having 2 views with the same function name in the same module. Just in case anyone else was planning to try to answer this. On Mon, Dec 19, 2011 at 7:06 PM, Travis Jensen travis.jen...@gmail.comwrote: Banging my head against

Re: Getting started documentation is in cyrillic.

2011-12-19 Thread Michael Merickel
It's a known problem. And just as an aside if you're looking at the getting started docs I'd recommend looking at Pyramid instead of Pylons unless you have a good reason. On Tue, Dec 20, 2011 at 12:24 AM, jfb3 johnfbe...@gmail.com wrote: Even though the url:

Re: Missing Pyramid project templates

2011-12-23 Thread Michael Merickel
In 1.2.5 the paster templates should be there. Ensure that you are actually using pyramid 1.3 and that you are executing paster from the right virtualenv. On Dec 23, 2011 9:43 PM, Eddy eddy.respon...@gmail.com wrote: Okay, I was using 1.2.5 - I didn't realize alpha's were considered stable

Re: Missing Pyramid project templates

2011-12-23 Thread Michael Merickel
with Gevent but haven't seen anyone describe more than 1 instance before. I assume this just for illustrative purposes? Under what circumstance would you need to consider using more than 1 instance of the same app? On Dec 24, 11:26 am, Michael Merickel mmeri...@gmail.com wrote: In 1.2.5 the paster

Re: SQLAHelper 1.0 released, and a proposal

2011-12-28 Thread Michael Merickel
On Wed, Dec 28, 2011 at 3:19 PM, Michael Bayer mike...@zzzcomputing.comwrote: On Dec 28, 2011, at 3:28 PM, Mike Orr wrote: I would think if the plugin is designed for Pyramid, it would be based around ZopeSQLAlchemy, which provides a master transaction for everyone to integrate towards.

Re: SQLAHelper 1.0 released, and a proposal

2011-12-28 Thread Michael Merickel
On Wed, Dec 28, 2011 at 4:19 PM, Mike Orr sluggos...@gmail.com wrote: On Wed, Dec 28, 2011 at 2:10 PM, Michael Merickel mmeri...@gmail.com wrote: DBSession = scoped_session(sessionmaker(extension=ZopeTransactionExtension(), twophase=True)) Is there any downside to setting twophase

Re: SQLAHelper 1.0 released, and a proposal

2011-12-28 Thread Michael Merickel
I hate to be posting this without an awesome solution, but I'd like someone to convince me that this is actually a good idea. I have not yet heard of a good use-case other than laziness or poor design for using SQLAHelper, and those are not qualities a library author should have. Any library that

Re: Paster package not installing

2011-12-28 Thread Michael Merickel
I think you are following the 1.2.* documentation while you installed 1.3.* via easy_install. PasteScript (paster) was dropped as a dependency between the two versions and the docs have changed. So either start reading the 1.3 docs, or run: easy_install pyramid1.3 On Wed, Dec 28, 2011 at 4:35 PM,

Re: SQLAHelper 1.0 released, and a proposal

2011-12-28 Thread Michael Merickel
On Wed, Dec 28, 2011 at 4:25 PM, Michael Merickel mich...@merickel.orgwrote: On Wed, Dec 28, 2011 at 4:19 PM, Mike Orr sluggos...@gmail.com wrote: On Wed, Dec 28, 2011 at 2:10 PM, Michael Merickel mmeri...@gmail.com wrote: DBSession = scoped_session(sessionmaker(extension

Re: LDAP Shared connections

2011-12-29 Thread Michael Merickel
for the connection object to free up), where should that instance live? Thanks! -stephan On Thu, Dec 29, 2011 at 10:31 AM, Michael Merickel mmeri...@gmail.comwrote: It sounds like you just aren't closing the connections when you're done with them. The request callbacks provide a way

Re: LDAP Shared connections

2011-12-29 Thread Michael Merickel
It sounds like you just aren't closing the connections when you're done with them. The request callbacks provide a way to deal with this if you can't just immediately close the connection. On Thu, Dec 29, 2011 at 10:29 AM, Stephan Ellis stephan.el...@gmail.comwrote: Hello All, I'm looking

Re: Pyramid default wsgi server...

2011-12-31 Thread Michael Merickel
I think the goal is something that won't just fold over in production. wsgiref is single threaded and in just no way capable of being deployed. This way if someone deploys it without knowing any better they at least have a chance. On Dec 31, 2011 4:41 PM, John Anderson son...@gmail.com wrote: So

Re: pyramid and social auth

2012-01-02 Thread Michael Merickel
It seems to me you are confused about how pyramid separates authentication, authorization and the login process. The steps involved here are: 1. Is the user authenticated? This is done by checking if the authentication policy can find valid credentials in a request. If they are then great, skip

Re: pyramid and social auth

2012-01-02 Thread Michael Merickel
I suggest using the unreleased master branch of velruse on github. It has several major changes that make it simpler to integrate with pyramid. In there is also a demo application with a simple pyramid project that uses velruse. On Jan 2, 2012 1:11 PM, Kesav Kumar Kolla kesavko...@gmail.com wrote:

Re: SQLAHelper 1.0 released, and a proposal

2012-01-03 Thread Michael Merickel
On Tue, Jan 3, 2012 at 1:49 PM, Siddhartha Kasivajhula countvajh...@gmail.com wrote: Sorry if this is a bit off-topic, but does Elixir ( http://elixir.ematia.de/trac/wiki) fit in anywhere in this discussion? I'm a relative newcomer to pyramid and I've been meaning to use Elixir on top of

Re: Pyramid Debug Routematch Not Working

2012-01-05 Thread Michael Merickel
You probably do not have the DEBUG level enabled for the pyramid package. Make sure you have something along the lines of the default logging setup in your ini. http://docs.pylonsproject.org/projects/pyramid/en/1.2-branch/narr/logging.html On Thu, Jan 5, 2012 at 2:13 AM, jerry

Re: Pyramid 1.3 doc

2012-01-05 Thread Michael Merickel
the docs should be updated now, thanks for the report On Thu, Jan 5, 2012 at 2:50 AM, davidfung davidf...@amgcomputing.comwrote: Hi, there seems to be missing code statement in the Pyramid 1.3 doc below: http://docs.pylonsproject.org/projects/pyramid/en/1.3-branch/narr/configuration.html

Re: @view_defaults and conflict errors

2012-01-05 Thread Michael Merickel
That's a bug. On Thu, Jan 5, 2012 at 5:48 PM, Martin Aspeli optil...@gmail.com wrote: Hi, I'm toying with some browser detection and basically want the home page of my application to be a different view depending on the type of user agent. I have a NewRequest subscriber that adds a marker

Re: Maintenance Debugging after deployment

2012-01-06 Thread Michael Merickel
On Fri, Jan 6, 2012 at 5:02 AM, Ahmed ahmedba...@gmail.com wrote: Is it policy to open a git issue for a doc change? I am ready to do that. A pull request with the changes is ideal, otherwise an issue or an email are fine. :-) -- You received this message because you are subscribed to the

Re: get_appsettings() equivalent under Pyramid 1.2?

2012-01-09 Thread Michael Merickel
The pyramid.paster.get_appsettings(inipath) called as get_appsettings('development.ini#myapp') is implemented as follows: from paste.deploy import appconfig config_name, section = inipath.split('#', 1) here_dir = os.getcwd() return appconfig(config_name, name=section, relative_to=here_dir)

Re: pyramid and zope.component registry

2012-01-16 Thread Michael Merickel
The registry supports adapters, utilities and subscribers. Most of that code was moved into zope.interface.registry, if you look at the pypi changelog for zope.interface version 3.8.0. On Mon, Jan 16, 2012 at 12:46 PM, Arndt Droullier a...@dvelectric.com wrote: Hi, since zope.component has

Re: pyramid_exclog exception in exception view

2012-01-17 Thread Michael Merickel
pyramid_exclog is placed under the exception view tween. This effectively means that the exclog is executed before the HTTPNotFound exception view. I don't have an awesome solution, but wanted to tell you why you're seeing what you're seeing. On Tue, Jan 10, 2012 at 9:29 AM, Jason

Re: route_prefix trailing-slash design issue?

2012-01-18 Thread Michael Merickel
This is a known issue. The fix involves special-casing (and documenting) the inconsistent behavior. Instead we intentionally treat the include(route_prefix=..) to indicate a container in which the suffixed '/' is appropriate. Anyway I decided to document this on github rather than fully explain it

Re: what is the pyramid version of pylons globals ?

2012-01-24 Thread Michael Merickel
request.registry.settings On Tue, Jan 24, 2012 at 12:09 PM, Jonathan Vanasco jonat...@findmeon.comwrote: on setup, I need to stash some information from the environment.ini script , which will be used on every request ( the facebook app ids for dev production ). the only way i can see

Re: Testing with SQL Alchemy and sqlahelper

2012-01-26 Thread Michael Merickel
I'd suggest you write your unit tests in a transactional way. setUp will begin a transaction and tearDown rollback the transaction. This will allow you to setup the database once, and have it in the original state at the start of each test. This means doing the population of the database,

Re: Question about Multiple Database connections reflection with SqlAlchemy ( using sqlahelper )

2012-01-26 Thread Michael Merickel
This question should be directed at the SQLAlchemy mailing list. I'll just post this here in case it helps: http://techspot.zzzeek.org/2012/01/11/django-style-database-routers-in-sqlalchemy/ On Thu, Jan 26, 2012 at 4:47 PM, Jonathan Vanasco jonat...@findmeon.comwrote: I've set up my

Re: is it safe to store data on handlers/views in self, or should it be self.request ?

2012-02-03 Thread Michael Merickel
class-based view is the appropriate term here. I think that handler should only really be used in the context of pyramid_handlers. On Fri, Feb 3, 2012 at 4:25 PM, Mike Orr sluggos...@gmail.com wrote: On Fri, Feb 3, 2012 at 12:18 PM, Chris McDonough chr...@plope.com wrote: On Fri, 2012-02-03

Re: match_param as a dict

2012-02-07 Thread Michael Merickel
I patched 1.2-branch and 1.3-branch last night. match_param will now accept a tuple. You can either use those branches or wait for a release. :-) On Tue, Feb 7, 2012 at 2:50 AM, Simon Yarde simonya...@me.com wrote: Thanks for the correction; I'm working from mobile GitHub and email so it

Re: Bug in wiki tutorial? Can't belive!

2012-02-07 Thread Michael Merickel
The appropriate place is https://github.com/Pylons/pyramid/issues :-) On Tue, Feb 7, 2012 at 1:55 PM, ein Selbst ein.sel...@googlemail.comwrote: Hi everybody, this is really minor, but until the new docs are finished, it might help. BTW is there any mechanism to send bugs/typos from the

Re: subrequests in pyramid

2012-02-07 Thread Michael Merickel
Pyramid prior to 1.3 had no way to perform subrequests publicly. The reason is that the renderer attached to a view is only used if that is the active view for a request. Thus, if you have a URL which is mapped to viewA, and you want to delegate the request to viewB, the only way to do this is to

Re: need your help to overhaul docs

2012-02-08 Thread Michael Merickel
This was just a documentation emphasis... Pyramid won't be getting rid of the component registry without a damn good reason. On Wed, Feb 8, 2012 at 5:33 PM, Iain Duncan iainduncanli...@gmail.comwrote: Configurator methods to call, just as the docs do now. Theoretically, Pyramid may disuse

Re: Raising 403 within traversal when the Forbidden context is already used to show the login page

2012-02-09 Thread Michael Merickel
Pyramid internally raises a HTTPForbidden... this is the safest thing for Pyramid to do, and requires the fewest assumptions about what your app actually wants. From that point, you can catch the HTTPForbidden in an exception view, determine what you actually want to do, and return that. For

Re: Raising 403 within traversal when the Forbidden context is already used to show the login page

2012-02-10 Thread Michael Merickel
Likely pyramid.httpexceptions.HTTPSeeOther should be used instead (status code 303). http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html The new URI is not a substitute reference for the originally requested resource. On Fri, Feb 10, 2012 at 11:48 AM, Mike Orr sluggos...@gmail.com wrote:

Re: Raising 403 within traversal when the Forbidden context is already used to show the login page

2012-02-10 Thread Michael Merickel
On Fri, Feb 10, 2012 at 11:24 AM, Simon Yarde simonya...@me.com wrote: I might have come at it differently raising 401 initially (all we can say is 'auth required' because we don't know who the user is) and then issue 403 if the authenticated user lacked a particular permission, but then I

Re: Raising 403 within traversal when the Forbidden context is already used to show the login page

2012-02-10 Thread Michael Merickel
The real bad practice in the tutorial currently is that it shows you a login view even if you are already logged in. It's not actually wrong to show the login template at the content URL instead of redirecting the user to a login URL. However it's also not usually what you want. Thus the open

Re: writing unit tests that cover pylons and pyramid

2012-02-10 Thread Michael Merickel
You might want to ensure both systems are running the same version of Pylons. I believe c is deprecated in 0.10 and removed entirely in 1.0 in favor of tmpl_context. On Sat, Feb 11, 2012 at 12:06 AM, Jonathan Vanasco jonat...@findmeon.comwrote: my tests keep failing on pylons packages.

Re: Documentation overhaul specifics

2012-02-13 Thread Michael Merickel
On Mon, Feb 13, 2012 at 1:23 PM, Benjamin Sims benjamins...@gmail.comwrote: Sorry to be late to the party, but I would like to pledge £50 (~$80 USD). In terms of concerns/suggestions, I'd particularly like the documentation relating to authentication and authorisation to be expanded - relying

Re: Documentation overhaul specifics

2012-02-13 Thread Michael Merickel
On Mon, Feb 13, 2012 at 2:06 PM, Mike Orr sluggos...@gmail.com wrote: On Mon, Feb 13, 2012 at 11:49 AM, Michael Merickel mmeri...@gmail.com wrote: Out of curiosity have you read http://michael.merickel.org/projects/pyramid_auth_demo/ and did it help at all? It was originally written

Re: Pyramid advocacy, list of high profile sites?

2012-02-14 Thread Michael Merickel
Well there's a big list of logos on http://www.pylonsproject.org/ On Tue, Feb 14, 2012 at 6:44 PM, Iain Duncan iainduncanli...@gmail.comwrote: Wondering if such a thing is around? I am stuck doing a pitch to a committee on why we are using Pyramid and not Drupal, and it would be helpful to

Re: Generate route url with route pattern intact

2012-02-17 Thread Michael Merickel
On Fri, Feb 17, 2012 at 4:00 AM, Mattias mattias.gyllsdo...@gmail.comwrote: Is request.registry.getUtility(IRoutesMapper).get_routes() an official Pyramid api or is it just a implementation detail that may change without prior notice? The route mapper is not a public API. To do it you'd have

Re: Limited traversal

2012-02-18 Thread Michael Merickel
On Sat, Feb 18, 2012 at 3:53 PM, Andrey Popp 8may...@gmail.com wrote: My use-case is different -- to allow User object to be attached on request without touching database (user id is encoded in authc cookie), but I think it should work for constructing lazy resource graph as well. In

Re: Limited traversal

2012-02-19 Thread Michael Merickel
On Sun, Feb 19, 2012 at 3:20 AM, Andrey Popp 8may...@gmail.com wrote: Yeah, thank you, that would work too, but already has custom Query class with othe goodies and also want to access user's id as request.user.id. That's fine of course. request.user.id works with this pattern though, just

Re: need your help to overhaul docs

2012-02-22 Thread Michael Merickel
On Wed, Feb 22, 2012 at 11:31 AM, Jonathan Vanasco jonat...@findmeon.comwrote: 1. A nice paragraph or two giving an overview of the scope / style of Security that is offered , and why you might want to use it. ( even the first bit of

Re: is there a facility in pyramid for sending/validating encrypted cookies ?

2012-02-28 Thread Michael Merickel
a) Your example with the checksum isn't encryption, so watch your jargon. Pyramid doesn't ship with any encryption capabilities. b) See p.session.signed_serialize and p.session.signed_deserialize for signing a payload.

Re: How To Prepare For get_current_registry() Manually

2012-03-01 Thread Michael Merickel
As long as you're using p.paster.bootstrap(..) before the events execute, the threadlocals should be available. This is a use-case that bootstrap is intended to solve. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send

Re: multiple beaker sessions under pyramid ?

2012-03-05 Thread Michael Merickel
On Thu, Mar 1, 2012 at 8:54 PM, Jonathan Vanasco jonat...@findmeon.comwrote: has anyone attempted this yet with pyramid_beaker , or a custom implementation ? It should absolutely be possible. I would suggest using Pyramid's new (1.3+) config.set_request_property() functionality to add another

Re: anyone have an idea to discern if we're operating as https or not ?

2012-03-10 Thread Michael Merickel
With a properly configured server you can just check request.scheme in a predicate to determine if the request is over https. On Mar 10, 2012 1:24 PM, Jonathan Vanasco jonat...@findmeon.com wrote: Hi Fabio- I do the same thing with cookies and the general setup. I wrote a library last week

Re: How to manage specific permissions for one resource?

2012-03-13 Thread Michael Merickel
On Tue, Mar 13, 2012 at 11:52 PM, Mark zhengha...@gmail.com wrote: 1. Does the above scenario mean that EVERY time a brand is created in the system, I would have to generate for instance, b1_create, b1_read b1_delete, b2_create, b2_read, b2_update ... b4_delete permissions? The way I

Re: How to manage specific permissions for one resource?

2012-03-14 Thread Michael Merickel
this acl be? @property def __acl__(self): return [ (Allow, 'editor', ('read', 'update'), (Deny, 'sales_lesser_than_100', 'update') ] Should the deny be first in the list or should it be at the end? On Wednesday, 14 March 2012 00:06:05 UTC-5, Michael Merickel wrote: On Tue

Re: Plugins, in general

2012-03-19 Thread Michael Merickel
http://pyramid.opencomparison.org/ This page has stagnated since Danny originally set it up and it would be wonderful if it could get some love. On Mon, Mar 19, 2012 at 2:16 PM, Mike Orr sluggos...@gmail.com wrote: On Mon, Mar 19, 2012 at 11:13 AM, Chris McDonough chr...@plope.com wrote:

Re: catching sqlalchemy exceptions

2012-03-21 Thread Michael Merickel
Exception handling in pyramid is pretty straightforward. If an exception occurs for the first time, and isn't caught by your code, then pyramid will perform view lookup using that exception as the context. Those views can have their own renderers, permissions and predicates. If another unhandled

Re: catching sqlalchemy exceptions

2012-03-21 Thread Michael Merickel
On Wed, Mar 21, 2012 at 1:06 PM, Jonathan Vanasco jonat...@findmeon.comwrote: The way the 'uncaught' exception bubbles up is a little weird -- it doesn't seem to exist anywhere within the event. It just gets marked as None ( vs the request not having an attribute ). it would be really useful

Re: anyone have a suggestion to do per-environment package 'constants' ?

2012-03-26 Thread Michael Merickel
To be clear, it was straightforward in pylons if you managed to avoid importing any of that code until after the app was initialized. We have a cookbook recipe already for emulating a django-style settings.py which you can freely modify for your needs if you wish. There are obvious reasons for

Re: Calling a view without a view-config or add-view

2012-04-03 Thread Michael Merickel
Well you can certainly do it yourself with the add_my_route function that you create that calls both for you... Otherwise, no, it's by design in Pyramid that routes and views are separate concepts. You can always use traversal, and then it's just a single add_view call with no add_route. :-) On

Re: pyramid_beaker error

2012-04-11 Thread Michael Merickel
Upgrade to the latest version of pyramid_beaker. On Wed, Apr 11, 2012 at 5:00 PM, Clemens Herschel hersc...@panix.com wrote: I get the following error at the inclusion of pyramid_beaker when the application is pserved, no error when pyramid_beaker is taken out of configuration. Thanks for

Re: What about a pyramid collective ?

2012-04-12 Thread Michael Merickel
On Thu, Apr 12, 2012 at 7:41 AM, Domen Kožar do...@dev.si wrote: Having something like djangopackages.com + pypi classifier would achieve the same goal. Pull requests are also easy to make, I would propose rather to have a good read about preferred way of contributing to package maintainers.

Re: i18n question

2012-04-15 Thread Michael Merickel
pedantic from pyramid.request import Request from pyramid.i18n import get_localizer class MyRequest(Request) def translation_activate_language(self, culture): if self._LOCALE_ == culture: return self.localizer self._LOCALE_ = culture del self.localizer

pyramid trove classifier on pypi

2012-04-16 Thread Michael Merickel
We've been granted a new trove classifier on PyPI, so feel free to update your Pyramid-specific addons to use this instead of Pylons in terms of improving searchability on PyPI. Classifier:    Framework :: Pyramid Thanks, Michael -- You received this message because you are subscribed to the

Re: need a namespace package guru....

2012-04-18 Thread Michael Merickel
OS packages can be linked into a virtualenv using virtualenvwrapper's add2virtualenv script, or by simply adding a link to a .pth file in the virtualenv's site-packages directory. The issues brought about by *not* using --no-site-packages are much worse than the overhead of adding the one or two

Re: [Should I be able to do this?] Multiple @view_config for a single method

2012-04-18 Thread Michael Merickel
Routes are not coupled to views, so the docs are just in view configuration atm. http://docs.pylonsproject.org/projects/pyramid/en/1.3-branch/narr/viewconfig.html#view-config-placement On Wed, Apr 18, 2012 at 2:48 PM, Jonathan Vanasco jonat...@findmeon.com wrote: I was trying to figure out how

Re: url = opts.pop('url') KeyError: 'url'

2012-05-02 Thread Michael Merickel
On Wed, May 2, 2012 at 10:02 PM, Mike Orr sluggos...@gmail.com wrote: However, (and this is more a question for the Pyramid developers), earlier versions of Pyramid used to use a pipeline by default, and they could read the application settings. So there's some difference between what they did

Re: custom view params

2012-05-06 Thread Michael Merickel
Do custom predicates solve your problem? def extra_params(*params): def _predicate(context, request): request.extra_params = params return True @view_config(route_name='a_route', renderer='a_renderer', custom_predicates=[extra_params('some_param')]) def v(request) params

Re: testing question

2012-05-11 Thread Michael Merickel
The unittest assert* functions have an optional msg parameter. On Fri, May 11, 2012 at 10:46 AM, Jonathan Vanasco jonat...@findmeon.com wrote: i'm trying to devise the simplest way to write/manage tests for ancillary urls ( legal, contact, etc) and just general 'does this even render' the

Re: Writing configuration decoration?

2012-05-16 Thread Michael Merickel
The way Pyramid thinks about decorators is that when the decorator's callback is invoked upon scan, the configurator object is passed into the callback. From there you can do what you need to do via config or config.registry or config.registry.settings, etc. The simplest way to setup decorators is

Re: Trying to create a custom renderer and getting error

2012-06-04 Thread Michael Merickel
so you are importing json via import json ? and you are using some other thing called JSON ? On Mon, Jun 4, 2012 at 3:42 PM, Zak zakdan...@gmail.com wrote: I'm trying to create a custom renderer like this: config = Configurator(settings=settings)

Re: Trying to create a custom renderer and getting error

2012-06-04 Thread Michael Merickel
You're looking at unreleased code, your options are to maintain/install a fork, or to copy that class into your own project or to write your own json renderer (which is very easy to do). If you install that fork, you can from pyramid.renderers import JSON. On Mon, Jun 4, 2012 at 4:34 PM, Zak

Re: pyramid_mailer exception handling

2012-06-08 Thread Michael Merickel
mailer.send() does not send immediately. As per the docs it uses the transaction manager and sends the mail at the end of the request. You can create an exception view for this exception, or call mailer.send_immediately() instead. The transaction manager helps to avoid sending emails when you get

Re: How would I do cross domain with Pyramid and Nginx

2012-06-14 Thread Michael Merickel
On Thu, Jun 14, 2012 at 11:36 AM, Mark Huang zhengha...@gmail.com wrote: Andi, could you illustrate what your setup was on Pyramid to do this X-Accel thingy? The idea is to send a response that has the X-Accel header.. nginx sees that header in the response and sends to the real client a

Re: Packaging/Distributing pyramid apps

2012-06-15 Thread Michael Merickel
I was a big proponent of pip because it looked like where everything was going, however I've all but abandoned it at this point in favor of easy_install (without attempting to deal with buildout's doctest-style documentation). pip does not: - support binary packages (for windows or scientific

Re: Unicode Error accessing request.params

2012-06-18 Thread Michael Merickel
From my unaccepted SO answer.. AFAIK it's correct though. http://stackoverflow.com/a/11061308/704327 Pyramid supports a request factory. You can use this to decode the request. def request_factory(environ): req = pyramid.request.Request(environ) return req.decode(charset='gbk')

Re: How to get request object inside decorator?

2012-06-19 Thread Michael Merickel
So the generic (supported) way to write a decorator in pyramid that will work with any view is to use the decorator argument to add_view or view_config. This allows your decorator to have a consistent signature no matter whether the actual view is a method, or a function that accepts either

Re: Why are both authentication and authorization policies required ?

2012-06-19 Thread Michael Merickel
Hi, I answered your question on SO. I just thought I'd chime in here that I wasn't kidding.. there really isn't a solid reason why it's required. If you really feel strongly about this open an issue on the tracker but I'd consider it bike shedding. Again, be aware that there is *zero* performance

<    1   2   3   4   5   6   7   >