Re: Trouble storing Suds SOAP client in Configurator registry

2013-05-27 Thread Michael Merickel
that pattern in mind. > > Thanks! > > > > On Thu, May 23, 2013 at 3:35 PM, Michael Merickel wrote: > >> The settings dictionary is copied once when you pass it into the >> configurator, and it is supposed to be a shallow copy. >> >> new_settings = {} >

Re: Clarification about Tweens

2013-05-28 Thread Michael Merickel
Hopefully you also saw http://docs.pylonsproject.org/projects/pyramid/en/1.4-branch/narr/hooks.html#registering-tweens If you want to think in terms of WSGI middleware, the handler is the pyramid request router (or another tween) and the registry is your pyramid registry (same as request.registry

Re: Trouble storing Suds SOAP client in Configurator registry

2013-05-28 Thread Michael Merickel
few locations online, the Suds Client object is not > threadsafe, so that could have something to do with it. I am > reimplementing this with a threadsafe connection pool instead. > > On Mon, May 27, 2013 at 12:37 PM, Michael Merickel > wrote: > > It's *really* difficult fo

Re: disabling routes/views on deployment?

2013-05-30 Thread Michael Merickel
Well a couple options are 1) use config.add_view for those routes so that you can add them to your conditional 2) place the special views in another subpackage that you scan only within your conditional 3) write your own view_config (it's not as scary as it sounds) that can check the setting befor

Re: Is there a default setting for http_cache?

2013-06-11 Thread Michael Merickel
There is not a default setting for http_cache right now. On Tue, Jun 11, 2013 at 8:39 PM, Christoph Zwerschke wrote: > Is it possible to set the http_cache parameter globally for all views in a > Pyramid application? > > -- Christoph > > -- > You received this message because you are subscribed

Re: Pyramid + Velruse + OpenID via Google: how to get EMail

2013-06-13 Thread Michael Merickel
The google_hybrid provider should be providing you with the email address. I will double check that it's working properly later tonight though as I'm in the process working on python3 support for velruse. Note that the openid+oauth1 API is deprecated by google, however, so you should look into usin

Re: Pyramid + Velruse + OpenID via Google: how to get EMail

2013-06-13 Thread Michael Merickel
The profile already contains the 'verifiedEmail' key for google_hybrid with the email address. I have updated the provider on master to also populate the 'emails' list which is what I assume you're checking. On Thu, Jun 13, 2013 at 3:59 PM, Jonathan Vanasco wrote: > I haven't used velruse, but w

Re: multiple requests within a pyramid commandline script

2013-06-14 Thread Michael Merickel
I'm not entirely sure about what you're trying to do, but you can dissect bootstrap pretty easily. `get_app` takes a while because it parses the ini file and loads your app. Just like pserve, you only have to do this once for the process. After that, call `prepare` once per thread, or as many tim

Re: Derive from pyramid.view.view_config

2013-06-17 Thread Michael Merickel
I haven't bothered to read this entire thing, but my first impression is that you are missing the new _depth parameter to the view_config callback. Without specifying this parameter when wrapping pyramid.view.view_config venusian won't be able to figure out what code is actually being decorated. It

Re: is it possible to inspect object with the debug_toolbar on "good" requests ?

2013-06-17 Thread Michael Merickel
import pdb; pdb.set_trace() to trigger debugging in the console or raise an exception to trigger the toolbar On Mon, Jun 17, 2013 at 3:29 PM, Jonathan Vanasco wrote: > I'd like to inspect some of the object attached to `request` in an > interpreter. > > i never had the need to do this before...

Re: remembering credentials with AuthTktAuthenticationPolicy

2013-06-18 Thread Michael Merickel
Well, the AuthTkt policy accepts a max_age parameter to remember. This only works if you aren't setting reissue_time and timeout.. but if you're letting users choose when their sessions expire then you probably don't care about that. ;-) http://docs.pylonsproject.org/projects/pyramid/en/1.4-branch

Re: Stored procedures and SQLAlchemy

2013-06-24 Thread Michael Merickel
You have a better chance of getting this answered on the SQLAlchemy mailing list. On Tue, Jun 25, 2013 at 12:00 AM, Biswas, Pinakee wrote: > Hi, > > ** ** > > We are planning to use Stored Procedures to improve upon DB access > performances. > > ** ** > > Has anyone used Stored Procedure

Re: Accessing the app's settings when no request is available?

2013-06-26 Thread Michael Merickel
You can create a request-like environment by using the bootstrap api which will allow you to use get_current_request if you like, among other things you would normally do in your app. Another option is to simply parse the settings from your ini file using p.paster.get_appsettings('foo.ini'). http

Re: Understanding Pyramid Thread Generation

2013-07-08 Thread Michael Merickel
On Mon, Jul 8, 2013 at 2:00 PM, icook wrote: > So, after a bit more reading I've developed these rough conclusions: > > 1. pserve, being based on BaseHTTPServer, is a single process, single > thread server by default. > No, pserve is a "server runner", meaning it is a CLI that can run tons of di

Re: performance impact of pyramid_tm

2013-07-10 Thread Michael Merickel
The main thing is that it shouldn't be used with long running requests as it's holding on to a database connection. On Jul 10, 2013 8:06 PM, "Robson Roberto Souza Peixoto" < robsonpeix...@gmail.com> wrote: > Hi guys, > > Are there any performance impact of use the pyramid_tm? > > Thanks. > > -- >

Re: Dynamically generate view permissions

2013-07-26 Thread Michael Merickel
Permissions are static things that have no concept of the type of user. That's the purpose of the principals (groups). A view says someone must have the 'view_foo' permission. You then have a dynamic acl that says for this request here's the allowed mappings of groups to permissions. Notice that no

Re: Object level security and lists of objects

2013-07-29 Thread Michael Merickel
In that example you'd just have a permission pertaining to whether the a request has access to a user's items resource. From there your view logic will be responsible for loading the correct list of objects for the request. If each object had its own acl you could go ahead and invoke has_permission

Re: is there a way to move config.add_route out of __init__.py?

2013-08-02 Thread Michael Merickel
# __init__.py def main(global_conf, **settings): config = Configurator(settings=settings) config.include('.routes') return config.make_wsgi_app() # routes.py def includeme(config): config.add_route('foo', '/foo') config.scan() @view_config(route_name='foo', renderer='strin

Re: How to run python thread on only one Paste server?

2013-08-29 Thread Michael Merickel
Your worker should be a separate process, run as a script. When run individually you have very simple control over how many wsgi servers and how many workers you are running. They really have no business being coupled. Of course you could hack it with some CLI flag passed into your INI file. [app

Re: Pyramid 1.5a1 released

2013-08-30 Thread Michael Merickel
Awesome. Note that pip no longer installs pre-release versions so to test out Pyramid via pip you should use either: pip install Pyramid==1.5a1 or: pip install --pre Pyramid - Michael On Fri, Aug 30, 2013 at 2:12 PM, Chris McDonough wrote: > Pyramid 1.5a1 has been released. It is t

Re: Pyramid 1.5a1 released

2013-08-30 Thread Michael Merickel
The community owes a huge thanks to Paul Everitt, Tshepang Lekhonkhobe, Steve Piercy and many others for their documentation efforts in this release. Thanks guys! - Michael On Fri, Aug 30, 2013 at 3:29 PM, Steve Piercy wrote: > Indeed. Huge props to Paul Everitt for shepherding this effort.

Re: question about __call__ in view callable class

2013-09-03 Thread Michael Merickel
The docs are covering things from different perspectives but it's not entirely obvious. I think the view_config docs are more clear about class-based views that the part you linked. http://docs.pylonsproject.org/projects/pyramid/en/1.4-branch/narr/viewconfig.html#adding-view-configuration-using-th

Re: How to add the version number for the static file?

2013-09-04 Thread Michael Merickel
On Wed, Sep 4, 2013 at 1:10 PM, Jonathan Vanasco wrote: > > This works but it's not utilizing pyramid's url generation facilities (static_url/static_path), so I wouldn't consider it a best practice. It's actually very easy to write your own cache buster in a similar vein by adding a pregenerat

Re: Pyramid Security

2013-09-13 Thread Michael Merickel
On Fri, Sep 13, 2013 at 3:28 PM, AM wrote: > @mmrickels auth demo is helpful but I felt that I had to read the > traversal docs and examples about 5 times before I was able to map the demo > and docs to actual things that I wanted to do. Can you highlight any parts of the auth demo that were pa

Re: [pylons-discuss] Re: I look for a standalone hash and check password library which follow « Password Storage» of Mozilla Security Guilines

2013-09-17 Thread Michael Merickel
On Tue, Sep 17, 2013 at 2:38 PM, Jonathan Vanasco wrote: > def verify( hashed , password ): > if hash(password) == hashed : return True > return False > Your verify is vulnerable to timing attacks. :-) -- You received this message because you are subscribed to the Google Groups

Re: [pylons-discuss] templating dependency problem with pyramid=1.5a2

2013-09-25 Thread Michael Merickel
Just to confirm, as Douglas said, you do need to upgrade the debugtoolbar. On Wed, Sep 25, 2013 at 8:17 PM, Douglas Cerna wrote: > I'm not 100% sure, but looking at the traceback, I notice it's the > pyramid_debugtoolbar. I think you need to update it to 1.0.8: > > https://pypi.python.org/pypi/p

Re: [pylons-discuss] authenticated_userid returned None

2013-09-30 Thread Michael Merickel
The groupfinder *is* invoked in response to a request for authenticated_userid or effective_principals. Is that user's email address actually in the USERS dictionary on the next line? If the groupfinder returns None then there is no user. On Mon, Sep 30, 2013 at 1:33 AM, Chung WONG wrote: > I f

Re: [pylons-discuss] threads and global variables

2013-10-07 Thread Michael Merickel
On Mon, Oct 7, 2013 at 4:34 PM, Jonathan Vanasco wrote: > Pyramid might behave like this already , I'm just thinking back to my days > in mod_perl -- where one thread could update a global , but the updated > value wouldn't be available to the other threads ( unless you were able to > get the main

Re: [pylons-discuss] accessing / caching the `settings` outside of a request

2013-10-11 Thread Michael Merickel
I'm a little confused here, but it sounds like you're *more* okay with having a process-wide module global, than you are with a threadlocal via get_current_registry()? When you say "threadsafe", lib.constants.app_settings is certainly not threadsafe, but if it is treated as readonly then you can sh

Re: [pylons-discuss] Overriding configuration files (ini)

2013-10-16 Thread Michael Merickel
The classic example of changing the port in an ini file is to make it a variable, which you can specify on the command-line. The only caveat to doing that is there is no default value so you always have to specify it from the command-line. [server:main] port = %(http_port)s pserve my.ini http_por

Re: [pylons-discuss] check_csrf_token() missing in request.session

2013-10-16 Thread Michael Merickel
check_csrf_token is not on the session object. It is a function that is in the pyramid.session module. On Oct 16, 2013 11:15 PM, "Chung WONG" wrote: > according to > this

Re: [pylons-discuss] pyramid 1.4 app breaks with pyramid-mako 0.3

2013-10-21 Thread Michael Merickel
Hey Robert, pyramid_mako should not be ignoring your settings. Can you paste an error message?. Are you getting an actual error, or something else? The issue I expect to see is that the debugtoolbar needs to be upgraded to at least 1.0.9, as it depends on pyramid_mako 0.3+ because prior to that it

[pylons-discuss] pyramid_mako and the debugtoolbar

2013-10-21 Thread Michael Merickel
Hey guys, I wanted to make a quick announcement to hopefully alleviate some questions. TLDR; upgrade both pyramid_mako to >= 0.3 and pyramid_debugtoolbar >= 1.0.9 if you are using either. The toolbar was depending on some private APIs of pyramid_mako that we removed over the weekend. It was updat

Re: [pylons-discuss] pyramid 1.4 app breaks with pyramid-mako 0.3

2013-10-21 Thread Michael Merickel
lementation > return self.lookup.get_template(self.path) > File > "/usr/venvs/waab/local/lib/python2.7/site-packages/pyramid_mako/__init__.py", > line 80, in get_template > return TemplateLookup.get_template(self, uri) > File "/usr/venvs/waab/local/lib/python2.7/si

Re: [pylons-discuss] pyramid 1.4 app breaks with pyramid-mako 0.3

2013-10-21 Thread Michael Merickel
I actually did include pyramid_mako and then added settings from a > file using config.add_settings. But simply switching the order - I now > include pyramid_mako after add_settings({'mako.directories': 'pkg1:path1 > pkg2path2'}) - does not help. Same error > >

Re: [pylons-discuss] pyramid 1.4 app breaks with pyramid-mako 0.3

2013-10-21 Thread Michael Merickel
ert Forkel wrote: > I'm pretty sure I didn't. In particular for the deployment on the test > server, all ini-files are created new for each deployment. > > > On Mon, Oct 21, 2013 at 5:32 PM, Michael Merickel wrote: > >> Sorry to beat a dead horse but I'm draw

Re: [pylons-discuss] pyramid 1.4 app breaks with pyramid-mako 0.3

2013-10-21 Thread Michael Merickel
Well that was a private API in both cases, and is broken in pyramid_mako > 0.3. You can now do simply: config.include('pyramid_mako') config.add_mako_renderer('.html') On Mon, Oct 21, 2013 at 10:37 AM, Jonathan Vanasco wrote: > I posted in the 1.5a2 release thread a possible docs omission: > >

Re: [pylons-discuss] pyramid 1.4 app breaks with pyramid-mako 0.3

2013-10-21 Thread Michael Merickel
Jonathan I feel like you're ignoring my replies. :-) config.add_mako_renderer('.html') On Mon, Oct 21, 2013 at 10:58 AM, Jonathan Vanasco wrote: > i just upgraded... > > in pyramid_mako 0.2 , you needed to do: > config.add_renderer(".html", "pyramid_mako.renderer_**factory") > > in pyramid

Re: [pylons-discuss] pyramid 1.4 app breaks with pyramid-mako 0.3

2013-10-21 Thread Michael Merickel
On Mon, Oct 21, 2013 at 10:56 AM, Robert Forkel wrote: > Yeah, That's what happened here. For the last test i has disabled the > debugtoolbar. Robert, I honestly forgot that config.add_settings() exists because in my own apps I make sure to doctor up the settings prior to passing them into the c

Re: [pylons-discuss] What is the difference between adding a method by add_request_method or event NewRequest?

2013-10-26 Thread Michael Merickel
The main thing is that request methods are lazily evaluated whereas the events happen on every request. This may not seem like much until you factor in that static views also invoke the events. Request methods also provide some conflict resolution if you wanted to override an addon's methods or pr

Re: [pylons-discuss] Re: regex in URL Dispatch+traversal

2013-11-06 Thread Michael Merickel
I think you don't even need to escape the "-", it just needs to be the last character in the range block. On Wed, Nov 6, 2013 at 12:54 PM, Wyatt Baldwin wrote: > On Tuesday, November 5, 2013 12:43:20 PM UTC-8, Emilio García-Pumarino > Álvarez wrote: >> >> Hi! >> I have this route combined URL Di

Re: [pylons-discuss] pyramid_mako ribbon obscures docs

2013-11-06 Thread Michael Merickel
All I see is the normal github sash. Sounds like a browser/your computer issue. On Wed, Nov 6, 2013 at 5:38 PM, Mike Orr wrote: > The pyramid_mako online docs have a huge ribbon over the top of the > page, "Edit me on GitHub". Does that mean there's something > ReadTheDocs doesn't like about th

Re: [pylons-discuss] Setting Access-Control-Allow-Origin header for files served by a static view

2013-11-11 Thread Michael Merickel
If you have a way to detect which requests/responses are for static routes then you could do it through a NewResponse subscriber. Probably the easiest detection method would be @subscriber(NewResponse) def add_origin_headers(event): route = event.request.matched_route if route and route.na

Re: [pylons-discuss] Re: Pyramid + AJAX. What is the best scheme and practice?

2013-11-11 Thread Michael Merickel
I've seen complaints in the past about this approach causing problems for people due to browsers caching the responses. So they ask for the html version and get back the json cached version. If you run into this problem, I suspect you'll be able to fix it by setting a Vary header on the response ke

Re: [pylons-discuss] Pyramid sqlalchemy scaffold - model import error

2013-11-15 Thread Michael Merickel
In general when a module is a part of a package it cannot be run directly using the python interpreter. There are other options, but Pyramid's scaffolds setup the console scripts using setuptools. These scripts are installed into your virtualenv when you run setup.py develop and are accessible as $

Re: [pylons-discuss] Re: pyramid_tm and disable transactions

2013-12-11 Thread Michael Merickel
The SQLAlchemy session you're using is configured to use the ZTE. You can manage this session manually via transaction.commit() and transaction.abort(), but this is not recommended. If you want to avoid pyramid_tm, it's simple. Just don't use a session configured to use the ZTE. You can easily cre

Re: [pylons-discuss] Beaker successor

2013-12-12 Thread Michael Merickel
Just to reiterate something that Bert hinted at in the other thread - we've improved the SignedCookieSessionFactory API in pyramid 1.5+ to provide a complete implementation of the ISession interface with a pluggable backend, so your work should be done for you. All you need to do is initialize the

Re: [pylons-discuss] Re: context, mako and nivecms

2013-12-29 Thread Michael Merickel
Pyramid is not attempting to abstract away the details of each individual templating engine. The documentation and details for each binding are different and you are expected to read them. The only thing pyramid standardizes is the interface for invoking the renderer such that they may fit into the

Re: [pylons-discuss] context, mako and nivecms

2013-12-31 Thread Michael Merickel
I know I already answered this but considering we're still talking about it, perhaps my point didn't come across. Pyramid offers no guarantees or support for this level of pluggability in the rendering system. Each renderer has specifics that are not dictated by the "renderer api" and one of those

Re: [pylons-discuss] request.exception always None

2014-01-16 Thread Michael Merickel
request.exception is cleared by the exception view which happens before the finished callbacks. I think you could probably consider this behavior a bug. I've opened https://github.com/Pylons/pyramid/issues/1223 for you. On Thu, Jan 16, 2014 at 6:27 AM, wilk wrote: > Hi, > > I don't understand w

Re: [pylons-discuss] Re: request.exception always None

2014-01-16 Thread Michael Merickel
an 16, 2014 at 10:01 AM, wilk wrote: > On 16-01-2014, Michael Merickel wrote: > > --047d7b86df668d6bd104f017b781 > > Content-Type: text/plain; charset=UTF-8 > > > > request.exception is cleared by the exception view which happens before > the > > finished callba

Re: [pylons-discuss] debugtoolbar and json views ?

2014-01-20 Thread Michael Merickel
If there's a raised exception, then toolbar will spit out a url on the console which you can visit to debug the issue. However, anything further isn't gonna happen until the fork done for GSOC is finished which was intended to provide the toolbar to any type of request. On Mon, Jan 20, 2014 at 10

Re: [pylons-discuss] Error attempting ZODB + Traversal Wiki Tutorial

2014-01-24 Thread Michael Merickel
If you're using 1.5a3, then you should be using the 1.5-branch of the documentation, not 1.4 and not master. The tutorials have all been updated to work properly without needing to look at the whatsnew document, unless you really do find a bug. http://docs.pylonsproject.org/projects/pyramid/en/1.5

Re: [pylons-discuss] Re: Raw SQL with Bind Parameters

2014-01-27 Thread Michael Merickel
On Sun, Jan 26, 2014 at 10:55 PM, Johnny Rico wrote: > You need to commit the transaction, you could turn autocommit on: > > DBSession = scoped_session(sessionmaker(autocommit=True, > extension=ZopeTransactionExtension())) > This will probably trigger some exceptions because when using the Zope

[pylons-discuss] pyramid_debugtoolbar 2.0 released - now with ajax!

2014-02-22 Thread Michael Merickel
Hey everyone, the new toolbar has been out for about 2 weeks now, but this announcement is for the majority of people who probably aren't following development very closely. The toolbar now supports tracking ajax and other behind-the-scenes requests that were previously not possible. The panels ar

Re: [pylons-discuss] Re: pyramid_debugtoolbar 2.0 released - now with ajax!

2014-02-23 Thread Michael Merickel
Currently the SQLA panel is disabled if there were no queries in the request. Similar behavior with the other panels as well right now. We didn't change the panel api, but if you were depending on any base templates or other dependencies from the old toolbar, then those have changed quite a bit. Y

Re: [pylons-discuss] override_asset

2014-02-24 Thread Michael Merickel
The asset resolution depends on the current threadlocal registry, which is only available between config.begin() and config.end(), or while processing a request. At the point you're trying to invoke resolve(), there is no registry on the threadlocal stack and thus when resolving assets, the resolve

Re: [pylons-discuss] Pyramid 1.4.5 and DebugToolbar 2.0.2 not working correctly

2014-03-04 Thread Michael Merickel
> > On Mar 2, 2014, at 02:41 , Jarek Rozanski > wrote: > > Traceback (most recent call last): > > […] > > File > "~/PycharmProjects/python32pyramid/lib/python3.2/site-packages/mako/filters.py", > line 39, in > > html_escape = markupsafe.escape > > AttributeError: 'module' object has no attr

Re: [pylons-discuss] Re: best vaguely Pyramid "compatible" static site generators?

2014-03-07 Thread Michael Merickel
I've had in the back of my mind for quite a while the idea of building a pyramid_freezer, inspired by Flask-Freeze. The idea would be to have a simple module using WebTest that would take your app. It could then ping the app for known routes, and take an optional list of other routes that could dum

Re: [pylons-discuss] dynamic view_name to match in traversal based app

2014-03-11 Thread Michael Merickel
Here's the initial discussion on this, and alternatives. https://github.com/Pylons/pyramid/issues/881 On Tue, Mar 11, 2014 at 9:49 AM, Ron Drongowski wrote: > Hi, > > I suppose this question has been answered somewhere but I could not find > an explantion. We are creating a traversal based pyra

Re: [pylons-discuss] Using the ZCA in a Pyramid web application

2014-03-16 Thread Michael Merickel
config.registry is the correct way to access and augment the registry during the setup of the application. If you'd like some patterns to follow, I recommend looking at substanced as it's a heavy user of ZCA implemented by the core Pyramid developers. https://github.com/Pylons/substanced On Sun,

Re: [pylons-discuss] How I know the renderer name in a view?

2014-03-17 Thread Michael Merickel
Currently there is not a mechanism to expose the selected renderer within Pyramid. There are possible work-arounds but in the end you might be better off removing the auto-renderer declaration and instead using p.renderers.render_to_response() or p.renderers.render() yourself if you need this funct

Re: [pylons-discuss] SQLAlchemy and Modifying Package Structure

2014-03-20 Thread Michael Merickel
Your original code should have been using "import mypkg.models" or "from mypkg import models" instead of "import models". The last one is ambiguous because it doesn't know which package to look in (and will not work on py3). This works for you previously because views.py and models.py were in the s

Re: [pylons-discuss] SQLAlchemy and Modifying Package Structure

2014-03-21 Thread Michael Merickel
l the new template > for 1.5, a bit too red for my eyes but cool. > > The tests keep failing but that is another history that I think > belongs to test file code. > > El Thu, 20 Mar 2014 15:18:55 -0500 > Michael Merickel escribió: > > Your original code should have be

Re: [pylons-discuss] Re: [SqlAlchemy] how to return a primary key in scoped session?

2014-04-01 Thread Michael Merickel
If you are using the ZopeTransactionExtension combined with pyramid_tm then the view is irrelevant. pyramid_tm is a tween that wraps everything that happens while processing a request (for the purposes of this discussion). You should be clear up front that the DBSession is wrapping a database *tra

Re: [pylons-discuss] are there any stable ways to access or recreate the underlying mako environment ?

2014-04-03 Thread Michael Merickel
pyramid_mako has the ability to render a def directly using the 'tmpl#def.mako' syntax. http://docs.pylonsproject.org/projects/pyramid_mako/en/latest/#using-a-mako-def-name-within-a-renderer-name On Thu, Apr 3, 2014 at 7:44 PM, Jonathan Vanasco wrote: > I've run into a situation where I have so

Re: [pylons-discuss] Re: Is it possible to define views and routes after app initialization?

2014-04-04 Thread Michael Merickel
On Fri, Apr 4, 2014 at 3:35 PM, Tres Seaver wrote: > @view_config(route='extend_views') > def extend_views(request): > config = Configurator(request.registry) > config.begin() > config.add_route(...) #etc. > config.commit() > Be aware that this is super dangerous on a

Re: [pylons-discuss] Re: Is it possible to define views and routes after app initialization?

2014-04-04 Thread Michael Merickel
if I needed to. > > Thanks. > > On Friday, April 4, 2014 1:49:08 PM UTC-7, Michael Merickel wrote: > >> >> On Fri, Apr 4, 2014 at 3:35 PM, Tres Seaver wrote: >> >>> @view_config(route='extend_views') >>> def extend_views(request): &

Re: [pylons-discuss] Dropping setup.cfg

2014-04-17 Thread Michael Merickel
Babel uses options in the setup.cfg to determine how to do string extraction and a bunch of other stuff. Lingua defers this logic to the standard gettext commands and thus those sections of setup.cfg were no longer necessary. They also were the only options in setup.cfg and so we removed the files

Re: [pylons-discuss] Possible to know if a reified method was called ?

2014-04-17 Thread Michael Merickel
You could annotate the request with some other property (request.called_foo = True) and check if getattr(request, 'called_foo') in the tween. However, if you're okay relying on an implementation detail of reify then the following works: class Foo(object): @reify def bar(self): ret

Re: [pylons-discuss] Re: Possible to know if a reified method was called ?

2014-04-18 Thread Michael Merickel
On Fri, Apr 18, 2014 at 6:19 AM, wilk wrote: > I will not use it if it's not a public api but it's interresting to > know, thanks. > I don't think it's going to be changing. :-) -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe

Re: [pylons-discuss] How to get my projects' abspath?

2014-04-21 Thread Michael Merickel
It's important to differentiate between your configuration and your package. The %(here)s in your ini file is config-relative meaning it has nothing to do with where your package is located. Your ini file, in general, can be anywhere. If you want something that is package-relative then the pkg_reso

Re: [pylons-discuss] Development workflow for Pyramid/Cornice REST Service + AngularJS GUI

2014-04-22 Thread Michael Merickel
I'm looking forward to trying out https://github.com/reebalazs/buildout.javascript.yeoman or some variant of such to easily bootstrap a project with all the necessary fixins. Perhaps it's worth looking at. On Tue, Apr 22, 2014 at 12:06 PM, Paul Everitt wrote: > > On Apr 22, 2014, at 11:34 AM, Tr

Re: [pylons-discuss] Re: How to store session data server side?

2014-04-23 Thread Michael Merickel
On Wed, Apr 23, 2014 at 3:59 PM, wilk wrote: > Could you give an example of a serializer object wich will record the > session on a dict in memory for example ? > https://gist.github.com/mmerickel/8035611 Unfortunately there's one little quirk that you can't reuse the session id, so it changes

Re: [pylons-discuss] How to store session data server side?

2014-04-28 Thread Michael Merickel
On Mon, Apr 28, 2014 at 3:05 PM, Jonathan Vanasco wrote: > I don't remember what we were using, but some of the backend drivers we > had at one point weren't using `Pickle` > Pyramid has an ISession interface and that is the point of pluggability of sessions. Due to this, there really isn't an ex

Re: [pylons-discuss] How to store session data server side?

2014-04-30 Thread Michael Merickel
Ignoring everything else for the moment, you've already made yet another assumption that you're not going to be happy about. The raw cookie value is in no way a session identifier. For example in pyramid_redis_sessions the session identifier is cryptographically signed to prevent clients from even

Re: [pylons-discuss] How to store session data server side?

2014-04-30 Thread Michael Merickel
On Wed, Apr 30, 2014 at 3:28 PM, Chris McDonough wrote: > The presumption that there is a session.id variable won't solve this > particular problem, as Bert and Mike have already said. But as a separate > problem, it could be "solved" if we mandated that a session id be made > available in a com

Re: [pylons-discuss] making the current request available in a debugtoolbar template

2014-04-30 Thread Michael Merickel
The toolbar request is the one passed into panel.render_content(request). Anything from the original request should've been put into panel.data (which was generated during the original request). On Wed, Apr 30, 2014 at 5:14 PM, Jonathan Vanasco wrote: > Does anyone have a recommendation for makin

Re: [pylons-discuss] Re: making the current request available in a debugtoolbar template

2014-04-30 Thread Michael Merickel
The `data` variable is generated during the original request. It is then available out-of-band of the original request for use later when `render_content`, `has_content`, `render_vars`, `title`, etc are called. The only methods invoked in-band with the original request are `__init__`, `process_res

Re: [pylons-discuss] advice sought on 'BeforeRender' and 'render' edge case.

2014-04-30 Thread Michael Merickel
It sounds like you'll be interested in subscriber predicates. http://docs.pylonsproject.org/projects/pyramid/en/1.5-branch/narr/hooks.html#subscriber-predicates Personally I send emails from message queue in a separate process and so there is no conflict between these rendering environments despi

Re: [pylons-discuss] advice sought on 'BeforeRender' and 'render' edge case.

2014-05-01 Thread Michael Merickel
ouldn't fire off until a successful commit. On Thu, May 1, 2014 at 10:54 AM, Jonathan Vanasco wrote: > > > On Thursday, May 1, 2014 12:52:17 AM UTC-4, Michael Merickel wrote: >> >> It sounds like you'll be interested in subscriber predicates. >> >> htt

Re: [pylons-discuss] How to store session data server side?

2014-05-02 Thread Michael Merickel
On Fri, May 2, 2014 at 2:42 PM, Jonathan Vanasco wrote: > The issue is in not having a direct association between a "session object" > and the "cookie value" which created it. > > A client-side session would always correspond to the incoming cookie > value. > > A server-side session could be assoc

Re: [pylons-discuss] pyramid_ldap and Python 3

2014-05-02 Thread Michael Merickel
Did we skip past attempting to merge this with pyramid_ldap? Not feasible? On Fri, May 2, 2014 at 4:53 PM, Christoph Zwerschke wrote: > Am 02.05.2014 21:37, schrieb Steve Piercy: > > Would this be a Pyramid supported add-on, a cookbook recipe, or >> something else? >> http://docs.pylonsproject

Re: [pylons-discuss] order of events/callbacks/tweens

2014-05-06 Thread Michael Merickel
I'm a little confused. We already accepted your PR https://github.com/Pylons/pyramid/pull/1335 to clarify that the order is consistent and acceptable as tweens -> callbacks -> newresponse. Were we not supposed to accept this PR if you were intending to discuss it in pylons-discuss? On Mon, May 5,

Re: [pylons-discuss] Workaround for forward slashes in URL

2014-05-08 Thread Michael Merickel
Unfortunately you need to double-escape slashes to get them through a wsgi-compliant server. If this isn't an option then in Pyramid you could use a regex in the placeholder of sub_id: {sub_id:some_regex}. If the regex doesn't get you there then you can make use {sub_id:.*} and assign a custom pred

Re: [pylons-discuss] Re: TypeError: ObjectId() is not JSON serializable

2014-05-19 Thread Michael Merickel
On Mon, May 19, 2014 at 10:01 PM, Jonathan Vanasco wrote: > The pyramid adapter method is perfectly fine, but at some point you may > need to write (not just render) JSON objects too. I have no idea what you mean by writing vs rendering json objects but hopefully you know that you can do json_ob

Re: [pylons-discuss] Best practice of when to use view callable classes instead of functions?

2014-07-04 Thread Michael Merickel
The best use of classes is the improve the locality of certain operations. A function-based view in Pyramid is responsible for everything it needs on its own. If it doesn't handle something on its own then it must be handled globally. A class however can make it easier to share common code between

Re: [pylons-discuss] What similar on Django-collectstatic for Pyramid?

2014-07-08 Thread Michael Merickel
I think the closest that exists right now is usage of something like pyramid_webassets to manage your static assets. In my own software there is a build step in our deployment pipeline that aggregates these assets. This pipeline however has nothing to do with pyramid or python. There's just a bash

Re: [pylons-discuss] How set X-Accel-Expires in add_view, add_static_view

2014-07-28 Thread Michael Merickel
Your setting to `add_view` is currently being dropped. It's not valid to pass arbitrary things to `add_view`. A good way would be to mutate the response via a decorator, adding the header in yourself. No need for a tween. def x_accel_expires(max_age): def decorator(view): def wrapper(c

Re: [pylons-discuss] Cannot bind metadata to engine for SQLAlchemy

2014-08-06 Thread Michael Merickel
The issue here is that `autoload=True` requires the engine to be attached to the metadata at that time[1]. And because the code at the top-level of the module is executed upon import and the module is imported before main is called, you have this chicken-before-the-egg. You will need to follow the

Re: [pylons-discuss] Pyramid translation do Brazilian Portuguese

2014-08-18 Thread Michael Merickel
It looks to me like a separate repo is the way to go: http://read-the-docs.readthedocs.org/en/latest/localization.html#project-with-multiple-translations On Mon, Aug 18, 2014 at 1:08 PM, AM wrote: > On 08/18/2014 11:06 AM, Chris McDonough wrote: >> >> On 08/18/2014 02:03 PM, Ivan Neto wrote: >>>

Re: [pylons-discuss] Pyramid translation do Brazilian Portuguese

2014-08-18 Thread Michael Merickel
On Mon, Aug 18, 2014 at 1:13 PM, Michael Merickel wrote: > It looks to me like a separate repo is the way to go: > > http://read-the-docs.readthedocs.org/en/latest/localization.html#project-with-multiple-translations I think this is the only reasonable way to do things where Pyr

Re: [pylons-discuss] Making view available only to unauthenticated user

2014-09-01 Thread Michael Merickel
__acl__ = [(Deny, Authenticated, 'view_auth_page'), (Allow, Everyone, 'view_auth_page')] @view_config(permission='view_auth_page') def login_view(request): # ... On Sat, Aug 30, 2014 at 6:21 AM, pyramidX wrote: > What is the recommended approach to making a view available only to > unauthent

Re: [pylons-discuss] pyramid mssql connection string

2014-10-01 Thread Michael Merickel
You will need to install the driver package and any other dependencies required by the particular dialect you are using. For example, for the pyodbc driver you will see the docs claim you need to install pyodbc. http://docs.sqlalchemy.org/en/rel_0_9/dialects/mssql.html#module-sqlalchemy.dialects.

Re: [pylons-discuss] Stupid noob question on Pyramid running under IIS.

2014-10-13 Thread Michael Merickel
The "app" in your second example has the same signature as "application" in your first example. They are both objects that conform to the WSGI protocol. So if your runner for IIS is looking for an "application" module-level variable to be defined in that module then hopefully you have your answer

Re: [pylons-discuss] strategies for multiple "similar" routes to a single view

2014-10-15 Thread Michael Merickel
When defining a route, there are several hooks available to you to configure custom behaviors. 1) The route pattern. 2) Route predicates. 3) Route factory. You basically touched on all of these in your examples. It's usually advantageous to have a single route, so let's ignore the pattern options

Re: [pylons-discuss] strategies for multiple "similar" routes to a single view

2014-10-15 Thread Michael Merickel
Predicates should return True or False. They have no sense of locality, so if you mess with the request and return True, and another predicate returns False then you have screwed up the request for some subsequent route that may match. This is obviously not ideal, but will work in 95% of apps. The

Re: [pylons-discuss] Re: KeyError: 'url'

2014-11-13 Thread Michael Merickel
The issue is that get_appsettings() will default to the "main" app of your ini file. In your case you have named your app "music" as signified by the "[app:music]" section. In this case you must tell initializedb to look there for the settings. env/bin/initializedb development.ini#music On Thu, N

Re: [pylons-discuss] How do you send a function from a view to a Jinja2 template?

2014-11-16 Thread Michael Merickel
You send a function just like any other object. By returning it as the value in a dictionary. python: def hello_fn(name): return 'Hello ' + name return { 'hello': hello_fn, } jinja2: {{ hello('bob') }} - Michael On Sun, Nov 16, 2014 at 12:37 PM, Rosciuc Bogdan wrote: > Hello all, > >

Re: [pylons-discuss] Same context and multiple view_config

2014-12-06 Thread Michael Merickel
permission as a keyword is reserved in view_config and is not a predicate. You can use the effective_principals predicate however in such a way as long as you realize that a user may have both principals and then the view selected is undefined. On Sat, Dec 6, 2014 at 12:44 PM, Mehdi wrote: > Hi >

<    1   2   3   4   5   6   7   >