Re: pyramid_sqla 1.0rc1 released

2011-01-27 Thread Michael Merickel
Is there a reason that a pyramid_sqla template does not add 'pyramid_sqla' as a dependency of the generated project, considering that the project is doing imports from the pyramid_sqla package? Michael On Thu, Jan 27, 2011 at 2:36 PM, Daniel Holth dho...@gmail.com wrote: stucco_auth's the

Re: pyramid_sqla 1.0rc1 released

2011-01-27 Thread Michael Merickel
Also, is there a reason that the template creates websetup.py as well as scripts/create_db.py? I see that create_db.py is documented, so websetup.py must just be there as an example of how to do it? Michael On Thu, Jan 27, 2011 at 8:06 PM, Michael Merickel mmeri...@gmail.comwrote

Re: pyramid_sqla 1.0rc1 released

2011-01-28 Thread Michael Merickel
. Michael On Fri, Jan 28, 2011 at 12:26 AM, Mike Orr sluggos...@gmail.com wrote: On Thu, Jan 27, 2011 at 9:32 PM, Michael Merickel mich...@merickel.org wrote: I'll also point out that the create_db script should probably be initialized with your app's name instead of SimpleDemo in the line

sqlalchemy without scoped_session

2011-01-31 Thread Michael Merickel
I wanted to expand on the pyramid_cookbook entry (https://github.com/ Pylons/pyramid_cookbook/blob/master/sqla.rst) for using sqlalchemy without the scoped_session. So I created a gist that demonstrates more in-depth how it can be setup and used within a project. https://gist.github.com/805439

Re: sqlalchemy without scoped_session

2011-02-01 Thread Michael Merickel
manager, removing the need for a threadlocal transaction manager. Michael On Tue, Feb 1, 2011 at 10:02 AM, Chris McDonough chr...@plope.com wrote: On Mon, 2011-01-31 at 21:12 -0800, Michael Merickel wrote: I wanted to expand on the pyramid_cookbook entry (https://github.com/ Pylons

Re: Help with creating view functions

2011-03-12 Thread Michael Merickel
That error is telling me that you have a bug in your mako template... probably referencing a variable that you forgot to pass in (thus it is undefined). Michael On Sat, Mar 12, 2011 at 4:33 PM, AwaisMuzaffar awais1...@googlemail.comwrote: Hi, Thanks I will read into it more. I assumed it

Re: Pyramid routing questions

2011-03-16 Thread Michael Merickel
The pyramid form of url dispatch is very explicit - you make a specific route and assign a view to handle that based on properties of the request. In order to make the magic routing based on ``action``, the simple way is to just use the pyramid_handlers package which provides a very similar

Re: Pyramid modify query parameter of current url

2011-03-18 Thread Michael Merickel
The query parameter to resource url expects a list of 2-tuples, coincidentally the same as what is returned by request.GET.items(). I'd suggest: qs = dict(request.GET) qs['page'] = 2 url = resource_url(context, request, query=qs.items()) This is untested, but it is not far off from

Re: add_route and view_attr

2011-04-07 Thread Michael Merickel
To solve your problem you probably just need to remove the view_attr from add_route and call config.scan(). The problem here is the ambiguity in add_route because it supports routes and the ability to add a single view. Rather add_view and view_config are identical except that view_config

Re: session, beaker cookie expiration and remember me

2011-04-07 Thread Michael Merickel
I know you can set session.cookie_expires on a per-session basis. Michael On Thu, Apr 7, 2011 at 7:31 AM, Oliver Christen oliver.chris...@camptocamp.com wrote: Dear all I have been asked to implement a way for user to be able to stay logged for a longer period of time if they check a

Re: Cluegun App Example Security

2011-04-18 Thread Michael Merickel
FWIW I just cloned and ran cluegun for the first time using paster serve development.ini in a new virtualenv and it ran fine for me. The /manage view redirected to /login, then admin/admin user/pass took me back to /manage where I was able to delete pastes. It does say Failed login on the login

Re: need help with enginx configuration with Pylons.

2011-04-24 Thread Michael Merickel
I'm not sure what the pros/cons of fastcgi are, but I use nginx in production as a reverse proxy on several projects. This cookbook is for pyramid, but the configuration is framework-agnostic: http://docs.pylonsproject.org/projects/pyramid_cookbook/dev/deployment.html#nginx-paster-supervisord

Re: need help with enginx configuration with Pylons.

2011-04-24 Thread Michael Merickel
does some event based requesting and lends the work to some worker processes? is that right or this will any ways happen with nginx using reverce proxy? Happy hacking. Krishnakant. On 25/04/11 00:41, Michael Merickel wrote: I'm not sure what the pros/cons of fastcgi are, but I use nginx

Re: how can I make pyramid application install configure.zcml with other files.

2011-04-24 Thread Michael Merickel
You need a MANIFEST.in file, or the other option is to install setuptools-git (assuming your files are under git) and package your application using python setup.py sdist. Michael On Sun, Apr 24, 2011 at 9:21 PM, Chung, Ha Nyung minorbl...@gmail.comwrote: I was trying to make my application

Re: Released Pyramid application template with user account management

2011-04-25 Thread Michael Merickel
Please look at the shootout implementation of passwords. I added support for cryptacular there, hoping it might serve as a decent example for using bcrypt, etc. It'd damn easier than dealing with any hashing yourself. https://github.com/Pylons/shootout/blob/master/shootout/models.py#L28 Michael

Re: [Pyramid] Disable SQLAlchemy Transaction

2011-05-12 Thread Michael Merickel
Nothing is stopping you from defining another session object bound to the same engine that does not use the ZTE. As long as your engine is accessible through the settings/registry then it shouldn't be an issue to create a session in your script and use it only there. Michael On Thu, May 12,

Re: best way to handle IntegrityError with pyramid_tm

2011-05-16 Thread Michael Merickel
2) Return a newly committed object (for instance, if I save a new user successfully, I'd like to return that user object to the handler) You can populate your user object's pkey same as always by issuing a session.flush() after adding the object to your session. This will dump it to the

Re: [Akhet] how do I serve my app from subdirectory?

2011-05-16 Thread Michael Merickel
To host a WSGI app at a subdirectory you have to do 2 things. 1) Tell apache to forward requests only for that subdirectory. This is done using the WSGIScriptAlias. 2) Tell the WSGI app that it is being hosted at a subdirectory. This is done by setting the SCRIPT_NAME parameter in the

Re: URL outside of view callable

2011-05-18 Thread Michael Merickel
The registry is also embedded in the request, and is required for pyramid to find the list of routes... thus a pyramid request object is required to generate the paths as well. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this

Re: Best practices for where to work with SQLAlchemy

2011-05-19 Thread Michael Merickel
Assuming transaction.close is a typo and you meant transaction.commit, you may want to think about not calling it at all and allowing the transaction manager (repoze.tm2 or pyramid_tm) handle performing the commit for you. The reason for this is that your changes will automatically be rolled back

Re: Problem installing egg from file

2011-05-20 Thread Michael Merickel
I think you can just run easy_install egg_file. -- 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: Reusing sqlalchemy models across several pyramid apps

2011-05-23 Thread Michael Merickel
On Mon, May 23, 2011 at 7:35 AM, Daniel Holth dho...@gmail.com wrote: The only limitation I've found is that you have to use class attributes, not string table names, to reference foreign keys. e.g. ForeignKey(User.foobar) instead of ForeignKey('usertable.foobar_id') I've never found a

Re: Debugging mako templates in pyramid?

2011-06-03 Thread Michael Merickel
I'm pretty sure that blaflamme forked weberror and re-added nice tracebacks for mako. However it's only on github and not actually integrated with weberror... you can install it yourself though. https://github.com/blaflamme/pyramid_weberror -- Michael -- You received this message because you

Re: Need help to deploy pylons app under wsgi and apache

2011-06-06 Thread Michael Merickel
You need to configure mod_wsgi to use the correct PYTHONPATH pointing to your virtualenv. Either that or run setup.py develop on your source to install it into the virtualenv. That should help with your DistributionNotFound issues. Also, while this is for pyramid, the instructions are identical

Re: get complete url of app:static as string ?

2011-06-09 Thread Michael Merickel
URLs in pyramid are generated based on the context of the request. Therefore if there is no request telling the generator what the host/port/subpath are, pyramid will not know the correct URL to generate. You can trick pyramid with a fake request, but that's just the way it is. You may want to

Re: issue to deploy pylons application under mod_wsgi

2011-06-11 Thread Michael Merickel
I don't use mod_wsgi but the pyramid documentation for it is almost an identical setup to pylons, perhaps it can help you out. http://docs.pylonsproject.org/projects/pyramid/1.0/tutorials/modwsgi/index.html Michael -- You received this message because you are subscribed to the Google Groups

Re: Pyramid, traversal, and file-extensions -- not possible?

2011-06-11 Thread Michael Merickel
Using traversal you'll need to define your own __getitem__ on your context objects that is capable of discriminating your leaf nodes. With regards to the SO question, the pyramid way of dealing with this is much more flexible than the pylons mechanism of an if within the view code. For example

Re: Pyramid, traversal, and file-extensions -- not possible?

2011-06-11 Thread Michael Merickel
On Jun 11, 3:02 pm, Matt Feifarek matt.feifa...@gmail.com wrote: Sure, but we're not using traversal anymore now... we're hand-poking all of this stuff. I like your solution, in a non-traversal situation. Sorry, I gave this example because it's a better solution to the SO solution that you

Re: Simple Jquery AJAX question

2011-06-16 Thread Michael Merickel
On Thu, Jun 16, 2011 at 10:03 AM, AwaisMuzaffar awais1...@googlemail.comwrote: config.add_route('ajax', '/ajax/', view='testproject.views.ajax') def ajax(request): string = 'hello world' return Response(string) This is fine, but there are 2 enhancements you may want to

Re: Pyramid with SQLAlchemy (Non-Gobal session)

2011-06-16 Thread Michael Merickel
On Thu, Jun 16, 2011 at 12:38 AM, Liju lij...@gmail.com wrote: The documentation says 'It’s sometimes advantageous to not use SQLAlchemy’s thread-scoped sessions'. The issue isn't with scoped_session as much as it has to do with using a global variable to store your database connections. It

Re: Logging configuration for applications run without paster

2011-06-18 Thread Michael Merickel
On Fri, Jun 17, 2011 at 9:30 AM, Benjamin Sims benjamins...@gmail.comwrote: After digging, my understanding is that logging is set up my paster rather than as part of Pyramid. The question is therefore how can I ensure that my script works through the same logging framework, based on

Re: ownership authorization

2011-06-18 Thread Michael Merickel
Look at my pyramid auth demo on github. It explains how you can use url dispatch along with a resource tree to do row-level authentication. It basically boils down to creating a dynamic __acl__ property on your resource object that will return entries for only users that own your object.

Re: Pyramid authentication and authorization plugin

2011-06-18 Thread Michael Merickel
On Sat, Jun 18, 2011 at 3:56 PM, Liju lij...@gmail.com wrote: Is there a plugin that can be used with Pyramid framework that can do authentication and/or authorization based on LDAP/Custom Registry (Files etc) DB ? You can use pyramid with repoze.who v2 by way of the pyramid_who plugin. I

Re: Static file in egg file

2011-06-20 Thread Michael Merickel
You need to create a MANIFEST.in file or use one of the SCM plugins for setuptools like setuptools-git which will automatically package files that are under version control. -- Michael -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post

Re: Pyramid_rpc Json-rpc

2011-06-20 Thread Michael Merickel
On Mon, Jun 20, 2011 at 3:39 AM, Istvan istvan.v...@gmail.com wrote: I would be happy to get an example, how to use it. Can someone suggest a tutorial or a simple example? Thanks, Istvan As I said, the JSON-RPC implementation is in the master branch on github. The docs and tests are there as

Re: chameleon makes pyramid unfriendly

2011-06-22 Thread Michael Merickel
On Tue, Jun 21, 2011 at 9:00 AM, Chris Withers ch...@simplistix.co.ukwrote: 1.x, I don't think Pyramid works with 2.x... The reason chameleon doesn't work with 2.x is because you're using deform, which is currently not compatible with 2.x (at least it's locked to 1.3). Pyramid isn't the issue

Re: webhelpers SCRIPT_NAME

2011-06-22 Thread Michael Merickel
On Wed, Jun 22, 2011 at 2:24 PM, Thomi Richards tho...@gmail.com wrote: Yes I am - I have plans to upgrade to Pylons 1.0, and then to pyramid, but I'm waiting for someone to make an ubuntu package for pyramid, or update the pylons package in ubuntu 11.04 to a later version of pylons. I

Re: lengthy controller routines

2011-06-22 Thread Michael Merickel
On Wed, Jun 22, 2011 at 2:42 PM, RVince rvinc...@gmail.com wrote: Will the first controller routine be allowed to finish? Or does it abort, in favor of the latest controller routine. I suppose I am asking if multiple controller routines can be executed by the same client simulataneoulsy?

Re: Chameleon have template inheritance like mako?

2011-06-22 Thread Michael Merickel
There's a bug in the newly released pyramid 1.1 alpha 1. Temporary solution until 1.1 alpha 2 is out: easy_install pyramid==1.0 -- Michael -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to

Re: Chameleon have template inheritance like mako?

2011-06-22 Thread Michael Merickel
FWIW alpha 2 is now released, so you can continue to use 1.1 if you would like. -- 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,

Re: using declarative base in pylons project

2011-06-25 Thread Michael Merickel
On Sat, Jun 25, 2011 at 7:19 AM, Grigoriy Tretyakov monax.tinyc...@gmail.com wrote: Hello. I'd like to use declarative_base from sqlalchemy.ext in my project. But for initialize Base, I need engine. How I can get initialized engine in model.__init__.py? May be I could use engine=None?

Re: I can't use [\w]{8}(-[\w]{4}){3}-[\w]{12} in add_route pattern ?

2011-06-28 Thread Michael Merickel
Do you think this may be related to https://github.com/Pylons/pyramid/issues/123 which is patched in the 1.1 alpha release? Michael -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to

Re: Dynamic template rendering

2011-06-28 Thread Michael Merickel
All of Pyramid's template rendering is handled in the context of a request. This is primarily because the template lookup is handled through the registry which is attached to the request. If you have the registry, you can use pyramid.renderers.render() with a dummy request object in order to use

Re: Dynamic template rendering

2011-06-28 Thread Michael Merickel
On Tue, Jun 28, 2011 at 1:52 PM, Liju lij...@gmail.com wrote: But was checking if there was a way to invoke a template directly without having to route request to a view, like JSP (in J2EE). But I guess its not worth it. On Jun 28, 11:27 am, Michael Merickel mmeri...@gmail.com wrote: All

Re: Dynamic template rendering

2011-06-28 Thread Michael Merickel
def null_view(request): pass That pass should actually be a return {}, because if a view is using a renderer it needs to return a dictionary. -- Michael -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group,

Re: comparison between play and pyramid in term of performance

2011-07-07 Thread Michael Merickel
On Wed, Jul 6, 2011 at 9:33 PM, Robert Ramsay duran...@gmail.com wrote: Looking to the future when pyramid can stably run on PyPy, you will likely find it hard to see any difference. FTR, Pyramid does run on PyPy. If you look at jenkins.pylonsproject.org the tests are run on PyPy and Jython

Re: a challenge sending ods file to the browser throgh and an action

2011-07-08 Thread Michael Merickel
For the browser to serve up a file for download you can set the Content-Disposition header on the response. http://en.wikipedia.org/wiki/MIME#Content-Disposition -- Michael -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this

Re: why are not templates automatically reloaded ?

2011-07-16 Thread Michael Merickel
On Sat, Jul 16, 2011 at 5:55 AM, wbwylbt wbwy...@gmail.com wrote: I modified development.ini : 'reload_templates'=true Just to nitpick it should be: [app:myapp] reload_templates = true If you're actually throwing quotes around reload_templates, I'm pretty sure it won't work. -- Michael

Re: signal only works in main thread

2011-07-28 Thread Michael Merickel
You may also be able to run the ssh client within a multiprocessing process that you can spawn from the thread. I can't promise that works, but it shouldn't be difficult to try out. -- Michael -- You received this message because you are subscribed to the Google Groups pylons-discuss group.

Re: Pyramid transactions and other request lifecycle events

2011-08-02 Thread Michael Merickel
Ben was investigating the idea of tying pyramid_beaker to a transaction, but I'm not sure if anything ever came of it. Maybe we should resurrect the idea. -- Michael -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send

Re: Pyramid: choose renderer at runtime

2011-08-04 Thread Michael Merickel
This may help you: http://stackoverflow.com/questions/6553569/in-pyramid-how-can-i-use-a-different-renderer-based-on-contents-of-context/6557728#6557728 On top of that, pyramid also supports: request.override_renderer = ... via

Re: how to handle sqlalchemy exception with pyramid?

2011-08-05 Thread Michael Merickel
The real exceptions occur when the data is flushed to the database, not the actual commit. If you do a dbsession.flush() in your view code and it doesn't error then you can be fairly certain that the transaction's commit() will not fail. -- Michael -- You received this message because you

Re: ipython isn't invoked for paster shell

2011-08-11 Thread Michael Merickel
I do not believe that IPython is supported in the *Pylons* shell, paster shell. We do have support for IPython in the paster pshell command that ships with Pyramid. I, however, could be wrong, it's been a while since I've used Pylons. -- Michael -- You received this message because you are

Re: ipython isn't invoked for paster shell

2011-08-14 Thread Michael Merickel
Another thing to mention is that we recently updated the Pyramid pshell to support IPython 0.11... the embedded shell was backward incompatible with 0.10. As 0.11 was only recently released you may be experiencing this fallback behavior. Looks like the Pylons shell will need an upgrade if anyone

Re: ipython isn't invoked for paster shell

2011-08-19 Thread Michael Merickel
Pyramid's 'pshell' also supports both versions of IPython here: https://github.com/Pylons/pyramid/blob/eaf6cb2372bb274e83b7322b4dc80744de07cb8b/pyramid/paster.py#L185 On Fri, Aug 19, 2011 at 2:04 AM, Andrey Popp 8may...@gmail.com wrote: On Wed, Aug 17, 2011 at 10:02 PM, Iuri Diniz

Re: The MetaData is not bound to an Engine or Connection.

2011-08-19 Thread Michael Merickel
First of all this belongs in the SQLAlchemy mailing list. I'm guessing that you have not setup your Session object with the engine yet, so bind=Session.bind is just binding to None. Wherever you are initializing your engine you'll want to be doing engine = engine_from_config(...)

Re: Pyramid 1.2a1 released

2011-08-24 Thread Michael Merickel
It's funny you should ask. :-) http://michael.merickel.org/2011/8/23/outgrowing-pyramid-handlers/ On Aug 24, 2011 6:24 AM, Graham Higgins gjhigg...@gmail.com wrote: Particular thanks to Michael Merickel for this release; much of the code and design in 1.2 is his. Hats off to MM

Re: Pyramid 1.2a1 released

2011-08-24 Thread Michael Merickel
On Wed, Aug 24, 2011 at 12:42 PM, Michael Merickel mich...@merickel.orgwrote: It's funny you should ask. :-) http://michael.merickel.org/2011/8/23/outgrowing-pyramid-handlers/ On Aug 24, 2011 6:24 AM, Graham Higgins gjhigg...@gmail.com wrote: Q: Are using Handlers kinda frowned upon? Coming

Re: Pyramid 1.2a1 released

2011-08-24 Thread Michael Merickel
Tweens are Pyramid-specific middleware. They go between the WSGI stack and the main Pyramid application, effectively wrapping your app. On Wed, Aug 24, 2011 at 6:44 PM, Alexandre Conrad alexandre.con...@gmail.com wrote: 2011/8/23 Chris McDonough chr...@plope.com Pyramid 1.2a1 has been

Re: Applying changes to the database schema – SQLAlchemy

2011-08-29 Thread Michael Merickel
You should address this question to the SQLAlchemy mailing list as it's unrelated to Pyramid, but basically as you said, it's a hard problem that will not be solved simply by changing the property on the column in your class definition. You will need to learn how to mutate the underlying database,

Re: Issue with pyramid 1.2a+

2011-08-30 Thread Michael Merickel
The way weberror worked is that it'd dump the URL to the console, and you could visit that url to see the traceback. I think this was fairly reasonable. -- Michael -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send

Re: Issue with pyramid 1.2a+

2011-08-30 Thread Michael Merickel
I don't see this as an issue because if you're deploying with the debugtoolbar enabled you should be shot. Regardless adding the token to the url doesn't sound like a big deal. I guess we'll just have to think about it. -- Michael -- You received this message because you are subscribed to the

Re: Issue with pyramid 1.2a+

2011-08-30 Thread Michael Merickel
, Aug 30, 2011 at 1:15 PM, Chris McDonough chr...@plope.com wrote: On Tue, 2011-08-30 at 14:01 -0500, Michael Merickel wrote: The way weberror worked is that it'd dump the URL to the console, and you could visit that url to see the traceback. I think this was fairly reasonable. So I have

[pyramid_rpc] 0.3 release

2011-08-30 Thread Michael Merickel
pyramid_rpc 0.3 has been released. Here are the changes: - JSON-RPC support. - Updated both JSON-RPC and XML-RPC to support a workflow closer to that used by Pyramid itself. RPC methods are actual views, thus they accept the full array of view predicates including permissions. - Added a view

Re: Routing requested based on presence of query params

2011-09-02 Thread Michael Merickel
``request_method`` is limited to comparison with a single query parameter. To add more complex behavior you will need to use a custom predicate. Note that you are not required to use 2 routes here... After the pattern is matched for your route, there is view lookup performed based on the *view*

Re: How to route http/https for specific views?

2011-09-05 Thread Michael Merickel
This is actually a fairly large security hole unless you are carefully controlling when the auth cookies are being passed to avoid sending those cookies in the clear. Also the performance on https these days shouldn't be an issue, more and more sites are moving to pure-https. Regardless, the

Re: Composite application configuration

2011-09-07 Thread Michael Merickel
Apologies for not following most of the conversation, but just thought I'd mention that in the past I've done: def main(global_conf, **app_settings): settings = global_conf.copy() settings.update(app_settings) Which allows you to override settings in your app if you want while still

Re: Chaining of views using wrapper

2011-09-12 Thread Michael Merickel
1) What url are you visiting when you get the error? 2) There are no routes in play here, so I can't tell if your talk of using pyramid_handlers is a red herring, or the actual problem. Can you elaborate? And to clarify why I care, render_view_to_response (the underlying code behind wrapping

Re: Chaining of views using wrapper

2011-09-12 Thread Michael Merickel
As I said in my previous reply, the wrapped views do not work with routes, only with traversal. Thus they will not work with handlers, which are an abstraction on top of routes. Pyramid does not have a public api for invoking other views during a request. Instead it provides a very extensible

Re: Chaining of views using wrapper

2011-09-12 Thread Michael Merickel
No problem. I feel obligated to mention however that pyramid_handlers works fine for this case as well. You can decorate multiple methods with the same name but different predicates. For example: class MyHandler(object): def __init__(self, request): self.request = request

Re: Why is my database session disappearing?

2011-09-13 Thread Michael Merickel
This is a subtle error that is on the docket to get fixed in the future. The issue here is that the settings stored by Pyramid is a *copy* of the dict you passed to the Configurator. Thus any modifications you do to the original dict are irrelevant. Either modify your setup code to mutate the

Re: Correct way to use a custom 404 view

2011-09-13 Thread Michael Merickel
The way to think about this is that Pyramid is at the end of a WSGI pipeline. It supports a way for catching and handling any exceptions that occur within Pyramid itself via exception views. You have seen one exception view already via the HTTPNotFound exception. You may add an exception view for

Re: wiki.pylonshq.com still supported?

2011-09-15 Thread Michael Merickel
There was some talk at one point of dumping it out as a static site hosted read-only somewhere. I haven't heard anything about that in months though. Sounds like a good idea to me. -- Michael -- You received this message because you are subscribed to the Google Groups pylons-discuss group.

Re: [Paste] Pyramid on Python 3.2

2011-09-25 Thread Michael Merickel
Pyramid is only actually dependent on PasteScript for the paster command and scaffolds, so whether Paste gets ported or not isn't a big deal. The paster command is used to generate scaffolds, start servers and the convenient ability to paster request simulate a request into a conforming WSGI app.

Re: [Paste] Pyramid on Python 3.2

2011-09-25 Thread Michael Merickel
On Sun, Sep 25, 2011 at 7:45 PM, Mike Orr sluggos...@gmail.com wrote: I guess we should spec out what we're using in PasteDeploy and PasteScript. Then we can either write a minimal tool(s) for Pyramid that does that, or look for something that does that. If it's a Pyramid tool, we can use

Re: Is there an opposite of 'authenticated' in Pyramid?

2011-09-26 Thread Michael Merickel
On Mon, Sep 26, 2011 at 1:36 PM, Benjamin Sims benjamins...@gmail.comwrote: That is, a way to check that a user is not authenticated in order to restrict access to a login form? Restricting access is done via Pyramid's use of ACLs (mapping a user's principals to permissions). This means that

Re: Is there an opposite of 'authenticated' in Pyramid?

2011-09-27 Thread Michael Merickel
On Tue, Sep 27, 2011 at 4:53 AM, Dan Sommers d...@tombstonezero.net wrote: On Mon, 26 Sep 2011 23:29:07 -0500, Michael Merickel wrote: On Mon, Sep 26, 2011 at 1:36 PM, Benjamin Sims benjamins...@gmail.comwrote: How about some combination of the Authenticated principal and DENY

Re: pyramid_tm: problem upgrading to 0.3

2011-09-28 Thread Michael Merickel
pyramid_tm is now a tween placed under excview. Thus the pipeline for a request ends up: wsgi server - exception views - pyramid_tm - pyramid So the issue here is that pyramid_tm actually expires the commit *before* the exception view is executed. This means that you cannot do database

Re: how to exclude some views from csrf checking

2011-09-29 Thread Michael Merickel
matched_route has been around since at least 1.0. It's only not None if using url dispatch. Also, it's a failed attempt at a fix anyway, because now I remember that it isn't populated until after the NewRequest subscriber has been called. Perhaps you should place your CSRF checks on a ContextFound

Re: Serving Static File with Permissions using Nginx, Uwsgi

2011-10-08 Thread Michael Merickel
You can still have nginx serve your static files after pyramid has checked the permissions by having pyramid return a response containing the x-accel-redirect header. For more info about it look into nginx's version of X-Sendfile. http://wiki.nginx.org/X-accel http://wiki.nginx.org/XSendfile --

Re: Serving Static File with Permissions using Nginx, Uwsgi

2011-10-10 Thread Michael Merickel
Your solution actually isn't any more efficient than what you had before, so I'd expect you'd see a similar performance issue. The point of X-Accel-Redirect is that you do not have to open the file and read it in Python. Your view should return a simple Response object with no body, and just the

Re: Serving Static File with Permissions using Nginx, Uwsgi

2011-10-10 Thread Michael Merickel
On Mon, Oct 10, 2011 at 2:34 PM, Sharil Shafie sisha...@gmail.com wrote: OK. That means that the response doesnt contain that read file code. That's the idea. The response body would be filled in by nginx. Regardless this was all just a suggestion, there are other reasons why your original

Re: Modifying Beaker Session Timeout

2011-10-11 Thread Michael Merickel
http://stackoverflow.com/questions/7603674/how-do-i-override-the-default-session-timeout-with-pyramid-pyramid-beaker-bea -- Michael -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to

Re: in defense of traversal

2011-10-12 Thread Michael Merickel
On Wed, Oct 12, 2011 at 2:00 PM, Mariano Mara mariano.m...@gmail.comwrote: The with recursive sql idiom (such as the one you would find in pgsql and oracle) could be of help on this situation. It's harder than it sounds to actually utilize that. Each step of traversal expects a new context

Re: ApplicationDelete event

2011-10-13 Thread Michael Merickel
How about registering an atexit handler to cleanup the thread. http://docs.python.org/library/atexit.html -- 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

Re: Recommended way to do background processing once the response is sent

2011-10-16 Thread Michael Merickel
Using a messaging queue via celery or zeromq or anything else is the recommended solution. The response callback is not executed out-of-band so it won't help you here. There's also the option of just using multiprocessing or something to offload the work if you don't want to setup another

Re: Crazy behavior of `Making A “User Object” Available as a Request Attribute`

2011-10-17 Thread Michael Merickel
Okay, I can't tell if you are misunderstanding that cookbook recipe, or if you made the decision independent of that to store the user object in your *session*. That is not what the recipe is advocating. It advocates a mechanism to query the user the first time you access that property of the

Re: Crazy behavior of `Making A “User Object” Available as a Request Attribute`

2011-10-17 Thread Michael Merickel
You would have to paste code to explain why your user object isn't re-queried between requests, because that makes no sense. All the @reify decorator does is cache the object within a single request, it doesn't affect other threads or other requests at all. All I can think of is that you are

Re: Intermittent encoding error after moving to Apache

2011-10-27 Thread Michael Merickel
The MySQL errors are likely the fact that you didn't set the pool_recycle time in your SQLAlchemy connection pool. MySQL connections timeout (by default) after 8 hours I believe. http://www.sqlalchemy.org/docs/dialects/mysql.html#connection-timeouts The timeout is also available as an INI

Re: match_param not behaving as expected - pyramid-1.2.1-Py2.7

2011-10-28 Thread Michael Merickel
match_param is for matching items in the matchdict. These are patterns in your url, for example if you had the url /match/{param}, then you might use match_param='param=edit' to only match when that pattern is edit. request_param is used to match the query string in your url (things after the

Re: h.link_to() in Pyramid

2011-10-31 Thread Michael Merickel
These things are not automatically exposed in Pyramid like they were in Pylons. Pyramid's request object has a tmpl_context, but to expose it you must use it in the template as request.tmpl_context or you can inject it as c or some such via a BeforeRender event. A helper object in templates can

Re: Possible? Raise HTTPNotFound within Exception handler view

2011-11-05 Thread Michael Merickel
It is not possible to raise an exception within an exception view. -- 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: Clarification on Authorization?

2011-11-10 Thread Michael Merickel
Yeah so building off of what Joe said, the basic idea is that the object in question (the context for that URL) should be able to tell the system what principals can access it, and with what permission (ACLs). You can place an __acl__ on your RandomObject that returns the list of Accounts

Re: Form field processing

2011-11-14 Thread Michael Merickel
The key[subkey] syntax is not supported in WebOb (I think). On Mon, Nov 14, 2011 at 11:41 AM, Chris McDonough chr...@plope.com wrote: On Mon, 2011-11-14 at 09:28 -0800, Mengu wrote: actually, pylons had this. it was request.params.getall('param') but pyramid does not support this. It

Re: Checking permission using route name?

2011-11-14 Thread Michael Merickel
You can use pyramid.security.has_permission() to check access to a particular permission. view_execution_permitted is traversal-only. For has_permission() you just need to be sure to pass in the context that contains the correct ACLs for that view. On Mon, Nov 14, 2011 at 12:18 PM, Mark Erbaugh

Re: Form field processing

2011-11-14 Thread Michael Merickel
-'):]] = request.POST.get(k) name = profile.get('name', 'Bob') On Mon, Nov 14, 2011 at 12:29 PM, Chris McDonough chr...@plope.com wrote: On Mon, 2011-11-14 at 13:27 -0500, Chris McDonough wrote: On Mon, 2011-11-14 at 12:21 -0600, Michael Merickel wrote: The key[subkey] syntax is not supported in WebOb (I think

Re: beaker configuration

2011-11-14 Thread Michael Merickel
This is probably because the arguments to the method change every time the method is called. i.e. self is a different instance of your class every time. On Mon, Nov 14, 2011 at 1:49 PM, Jason ja...@deadtreepages.com wrote: Whenever I call a method decorated with cache_region it is still

Re: beaker configuration

2011-11-14 Thread Michael Merickel
Don't upgrade to 1.6 quite yet. pyramid_beaker doesn't support it until its next release which I hope will be very soon. On Mon, Nov 14, 2011 at 3:21 PM, Jason ja...@deadtreepages.com wrote: You're absolutely right. Caching instance methods with the cache_region decorator is only supported in

Re: Multiple transactions within request

2011-11-15 Thread Michael Merickel
It's been hard to follow what has actually been tried, but I just wanted to point some stuff out about zope.sqlalchemy (the code for it is literally 1 small file and shouldn't be talked about with such a scary tone). When doing transaction.savepoint() it returns a savepoint object that calls

Re: Absolute path for static assets/ Get file modified time

2011-11-16 Thread Michael Merickel
You will need to use the pkg_resources api from the Python stdlib. Currently (this will be fixed in 1.3) there is no public API for computing paths. import pkg_resources asset_path = 'mypackage:static/favicon.ico' package, file = asset_path.split(':', 1) abs_path =

  1   2   3   4   5   6   7   >