[pylons-discuss] Re: Pyramid + uwsgi auto reload on source change

2016-01-12 Thread Jonathan Vanasco
On Tuesday, January 12, 2016 at 1:22:24 PM UTC-5, Jason wrote: This doesn't answer your question, but I would recommend using pserve and > waitress for development. > We use nginx>uwsgi in production and nginx>pserve in development. By keeping nginx consistent, it really minimized the

Re: [pylons-discuss] what are best practices for Session management for REST API

2016-01-06 Thread Jonathan Vanasco
You can also use oAuth tokens, or even a combination of an account identifier and message digest that is using a shared-secret. -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop receiving emails from it,

Re: [pylons-discuss] Best supervisor for sourcing in large number of env vars?

2016-01-04 Thread Jonathan Vanasco
Just for another perspective... I use a `fabric` file (as part of deployment) to dynamically build these types of files. I also use `supervisord` for process management. The fabric command will simply use the 'main config file' , which is a python file filled with string and dicts, to build

[pylons-discuss] Re: Pyramid 1.6b3 released

2015-12-18 Thread Jonathan Vanasco
For anyone else interested in exactly what Michael and others did: The list of tag commits: https://github.com/Pylons/pyramid/commits/1.6b3 And unified diff from 1.6b2 https://github.com/Pylons/pyramid/compare/1.6b2...1.6b3 -- You received this message because you are subscribed to the

Re: [pylons-discuss] How different is pyramid too pylons?

2015-12-16 Thread Jonathan Vanasco
I would say that Pyramid is a lot more similar to Pylons than Michael thinks. Because of the maturity/age of the projects, a lot of the newer (and stranger) Pyramid features don't have a variation in Pylons -- but almost everything in Pylons can be quickly ported to Pyramid. The routing is

[pylons-discuss] Re: Pyramid 1.6b1 released

2015-11-19 Thread Jonathan Vanasco
On Sunday, November 15, 2015 at 9:54:49 PM UTC-5, Michael Merickel wrote: > > - pserve --reload will no longer crash due to syntax errors in your code! > Yay! > This is actually amazing. Thank you! -- You received this message because you are subscribed to the Google Groups

Re: [pylons-discuss] Re: Pyramid 1.6b1 released

2015-11-19 Thread Jonathan Vanasco
On Thursday, November 19, 2015 at 1:49:50 PM UTC-5, Michael Merickel wrote: > It's not perfect as it'll still crash on non-syntax-errors (mostly bad > imports). We'll try to improve that at some point but this is a good start > for many types of errors. > This will save me at least a dozen

Re: [pylons-discuss] Re: how to return a http exception in json ?

2015-11-15 Thread Jonathan Vanasco
On Sunday, November 15, 2015 at 1:58:05 PM UTC-5, Mike Orr wrote: > Also, I'm not really bothered if the method, which normally returns a > dict, instead returns a complete response with a bunch of HTML text, > because I can make some judgments based on the class; e.g., it would > have

Re: [pylons-discuss] Re: how to return a http exception in json ?

2015-11-14 Thread Jonathan Vanasco
On Saturday, November 14, 2015 at 8:55:33 AM UTC-5, Mike Orr wrote: > > ... but it should work with HTTPUnprocessableEntity > > I may try that with some of my responses. > I use some custom exceptions and handling to generate the right response. I don't particularly like it. I think the

[pylons-discuss] Re: how to return a http exception in json ?

2015-11-13 Thread Jonathan Vanasco
@Chris That approach will send a HTTP-200 status response. That can create issues on the API client side where the status-code matters. -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop receiving

[pylons-discuss] pyramid_redis_sessions vs pyramid_beaker + redis (both currently flawed)

2015-11-13 Thread Jonathan Vanasco
Just wanted to warn others on this. Using redis as the session store via `pyramid_redis_sessions` and `pyramid_beaker` (via beaker_extensions) are both incredibly flawed. Moderate amounts of traffic can cause issues by sending lots of unnecessary traffic to Redis. What's wrong?

Re: [pylons-discuss] Is it necesary that all views should be in a single file

2015-11-11 Thread Jonathan Vanasco
Ack! Sorry, I forgot about `config.scan('views')`. Thanks for correcting me. Another way of looking at the "route" vs "views" is this: A route is essentially just a shorthand name for a url (which may contain different patterns), and needs to be handled differently in multiple contexts.

Re: [pylons-discuss] Is it necesary that all views should be in a single file

2015-11-11 Thread Jonathan Vanasco
@view_config is a decorator that registers the view callable function ( http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/viewconfig.html#adding-view-configuration-using-the-view-config-decorator ) The various arguments trigger the view. There are other ways to register a view

Re: [pylons-discuss] fine-tuning a deployment under uwsgi + supervisord

2015-11-10 Thread Jonathan Vanasco
On Tuesday, November 10, 2015 at 11:58:22 AM UTC-5, Jeff Dairiki wrote: > > I'm not arguing that this is the best way, but as a data point, here's > what I do. > I'm mad I didn't think of this! It's a great solution for me, because we already have a `fabric` script do much of the same as

[pylons-discuss] Re: Using multiple rederers to display a page

2015-11-10 Thread Jonathan Vanasco
For your described needs, you should not be using "render" multiple times. Mako supports the following: * Defs and Blocks - http://docs.makotemplates.org/en/latest/defs.html * Template Inheritance - http://docs.makotemplates.org/en/latest/inheritance.html * Template Namespace and Inclusion:

[pylons-discuss] Re: Is it necesary that all views should be in a single file

2015-11-09 Thread Jonathan Vanasco
You can have views in multiple files, and even different packages. `views.py` is just a "scaffold" or reference implementation. IIRC, Pyramid will automatically scan either `views.py` or a `views/` package directory and subdirectories by default. (ie, everything with an `__init__.py`) If

Re: [pylons-discuss] fine-tuning a deployment under uwsgi + supervisord

2015-11-07 Thread Jonathan Vanasco
On Saturday, November 7, 2015 at 12:22:40 AM UTC-5, Mike Orr wrote: > > The ideal way would be to have a different INI file for different kinds of > deployment > I used to believe that... but as projects progressed, ini files got larger and more difficult to maintain. It's hard enough

[pylons-discuss] fine-tuning a deployment under uwsgi + supervisord

2015-11-06 Thread Jonathan Vanasco
I'm trying to squeeze some more performance out of a cluster and an easy fix was segmenting out all the "admin" routes/views to be conditionally enabled. (This saves enough MB per process that I can run a handful more processes. yay.) I'm trying to figure out a good way to re-enable the

[pylons-discuss] [dogpile.cache] disabling global caching?

2015-11-04 Thread Jonathan Vanasco
I need to disable certain types of caching via a region's `@cache_on_arguments` decorator in some of our development environments. Looking at the dogpile docs, it seems that I could use the `shoud_cache_fn` argument to handle this (and just use a central call to handle this). Has anyone had to

Re: [pylons-discuss] Re: Pyramid & gunicorn & nginx + X-Forwarded-Proto

2015-11-03 Thread Jonathan Vanasco
On Friday, October 30, 2015 at 11:27:33 AM UTC-4, Randall Leeds wrote: > > It looks like you'll need to check this setting: > http://docs.gunicorn.org/en/19.3/settings.html#forwarded-allow-ips > > Trusting the X-Forwarded headers from the open internet is not safe, so > gunicorn normally only

[pylons-discuss] Re: Pyramid & gunicorn & nginx + X-Forwarded-Proto

2015-10-30 Thread Jonathan Vanasco
You probably just need this in your .ini: [app:main] filter-with = proxy-prefix [filter:proxy-prefix] use = egg:PasteDeploy#prefix -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop receiving emails from

[pylons-discuss] Pyramid view_config's "accept" predicate and default (catch-all) view

2015-10-25 Thread Jonathan Vanasco
The default needs to appear last in the routing configuration, that is what is followed in-order. -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to

[pylons-discuss] Re: Pyramid, traversal, SQLAlchemy, and ACLs

2015-10-21 Thread Jonathan Vanasco
This looks painful to me for a few reasons: 1. Hitting the db on everything is pricey. Building this with the foresight that a read-through cache will eventually be needed might be a good idea. 2. Some of the SqlAlchemy generation looks to be likely expensive (within Python). It would probably

Re: [pylons-discuss] Re: Good gridview component for pyramid

2015-09-30 Thread Jonathan Vanasco
FWIW, we do a lot of this rendering using json output and Dust.js. The reason why we chose that as the templating language is that it's supported in browser via javascript and there are various options available for server side rendering (for example, a python library Ashes is largely

[pylons-discuss] Re: How to check in view code if it runs in development or production mode now?

2015-09-29 Thread Jonathan Vanasco
If you don't want to deal with examining the request each time, you can populate the templating environment with a variable or even a function/package that has the tests using event subscribers. def BeforeRender_event(event): request = event.get("request") or

[pylons-discuss] Re: Sending mail and exception reports

2015-09-29 Thread Jonathan Vanasco
We use pyramid_mailer and enjoy it. We're a bit heavily invested into it though, because of some custom & approved patches + transaction support. In terms of exception reporting -- we do exception logging into SQL via a custom tween. It's super simple code. Logging into an immediate mail send

[pylons-discuss] Re: advice for sending events back to javascript from pyramid (redis, polling, asyc, etc)

2015-09-29 Thread Jonathan Vanasco
we have a similar situation. `pyramid` is the main web application. when a user uploads a file, it is handed off to `celery` via `redis`, which handles all the image resizing and uploading onto S3. the solution we went with: • short polling on a configurable delay. We default to 2500ms, and

[pylons-discuss] advice sought - efficient way to handle very standardized simple routes

2015-09-14 Thread Jonathan Vanasco
I'm doing a code-review/integration on some very standardized routes, and wondering if anyone has looked into this issue before. the PR has about 150+ routes that currently has little-to-no logic, and are basically just a URL mapped to a mako file. we use class-based views, so it looks like:

Re: [pylons-discuss] advice sought - efficient way to handle very standardized simple routes

2015-09-14 Thread Jonathan Vanasco
On Monday, September 14, 2015 at 2:55:05 PM UTC-4, Vincent Catalano wrote: > > If each of your views is mapped to a separate template file I would > consider registering each route imperatively. That way, you can still > utilize the application's template configuration. If that's not an option,

Re: [pylons-discuss] Adding default key+values to the session (using the SignedCookieSessionFactory)

2015-09-09 Thread Jonathan Vanasco
On Tuesday, September 8, 2015 at 1:19:43 PM UTC-4, Bert JW Regeer wrote: > > Why? > > Registering a new session factory is easy, and allows it to be reused > easily in other applications that already use request.session. Registering a new session factory is easy once you have a bit of

Re: [pylons-discuss] Adding default key+values to the session (using the SignedCookieSessionFactory)

2015-09-08 Thread Jonathan Vanasco
On Monday, September 7, 2015 at 12:31:04 PM UTC-4, Bert JW Regeer wrote: > > I would have built a new session factory, that simply instantiates a > SignedCookieSessionFactory and adds my defaults. > > The only reason why I don’t think it’s a good idea is that it gets pickled > and sent down

Re: [pylons-discuss] Adding default key+values to the session (using the SignedCookieSessionFactory)

2015-09-08 Thread Jonathan Vanasco
Actually, I had an easier idea... Just use `add_request_method` to create a new `request.session_proxy` function. instead of calling `request.session`, just do all the operations on `request.session_proxy` -- which just proxies responses to the request.session object and alters it as you

Re: [pylons-discuss] Traversal and extra round trip to db

2015-08-31 Thread Jonathan Vanasco
Wait... am I to read this that traversal searches down for success (A>B>C>D>E) and not up for failure (!E>!D>!C>!B>!A)? Are there no hooks to support caching for parent levels? -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe

[pylons-discuss] Re: Traversal and extra round trip to db

2015-08-31 Thread Jonathan Vanasco
Michael- Thanks for the clarification! Makes perfect sense. Tres- SqlAlchemy's ORM cache is limited to a session and within a transaction. It also generates internal cache ids based on the primary keys, and only works for selecting items via that key directly. For example (in pseudocode)

Re: [pylons-discuss] Registering Services Best Practices

2015-08-31 Thread Jonathan Vanasco
Is your concern code maintenance or performance? Bert's suggestion would be cleaner -- and I believe you could even just drop things in your `.ini` -- but it will still execute during the main setup. -- You received this message because you are subscribed to the Google Groups

Re: [pylons-discuss] Re: Non-Javascript Web UI framework?

2015-08-24 Thread Jonathan Vanasco
On Friday, August 21, 2015 at 2:29:26 PM UTC-4, Vincent Catalano wrote: I would personally recommend against using Flash or Flex. You are much better off with Javascript. My suggestion to use Flash/Flex was supposed to be dripping in sarcasm. Sorry if that didn't come across right ;)

Re: [pylons-discuss] Traversal over a filesystem

2015-08-24 Thread Jonathan Vanasco
if you pprint the json (json and simplejson both have indent arguments) it instantly becomes human readable. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To unsubscribe from this group and stop receiving emails from it, send an email to

[pylons-discuss] Re: Non-Javascript Web UI framework?

2015-08-21 Thread Jonathan Vanasco
You could build your app in Adobe's Flash or Flex, and have it broker payloads of data back and forth to Pyramid. (Personally, I would prefer Javascript to that) -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To unsubscribe from this group

[pylons-discuss] any interest in a lowlevel pyramid oauthlib integration?

2015-08-07 Thread Jonathan Vanasco
i needed to support an oauth server, and pyramid_oauthlib was too highlevel i'm nearly done with the oauth1 work, and wondering if anyone would be interested in helping out on the oauth2 implementation. if so, i'll repackage and MIT license this to collaborate on. the working name is

[pylons-discuss] Re: legacy app's dojo xhr requests failing with PredicateMismatch error

2015-08-04 Thread Jonathan Vanasco
Looking at the HISTORY (https://github.com/Pylons/pyramid/blob/master/HISTORY.txt), 1.5 had some fixes to the logic of predicate mismatches and NotFound -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To unsubscribe from this group and stop

[pylons-discuss] Re: Global CORS Policy for Cornice Resources

2015-08-03 Thread Jonathan Vanasco
I'm sure there's a better way...but I've typically handled stuff like that by importing my own decorator, which just invokes the package decorator with my common arguments. This is pseudocode and off the top of my head.. from custom import my_resource @my_resource(path='/login')

[pylons-discuss] Re: advice sought- using 1 domain on DEV, 2 domains on PRODUCTION

2015-07-31 Thread Jonathan Vanasco
Sorry, to be more clear: My idea is have nginx rewrite `developers.domain.com/PATH` onto `domain.com/developers/PATH` , and have all the URLs consider / of `developers.domain.com` as root... (step 3 above) But then I have the issue of testing and browsing on the dev server -- where the root

[pylons-discuss] advice sought- using 1 domain on DEV, 2 domains on PRODUCTION

2015-07-30 Thread Jonathan Vanasco
We have a need build out a small developer site that will live on `developers.domain.com` The current idea to implement is this: 1. Serve off of a route that is /developers/ 2. Write all html as if we're on developers.domain.com 3. In production: rewrite `developers.domain.com/PATH` to

[pylons-discuss] Re: How to manage configuration for multiple app instances of single code base?

2015-07-30 Thread Jonathan Vanasco
I'm a bit confused by this. Running different instances/ini files suggests that you're doing a multiple, differential, deployment. Using a database for configuration suggests a multi-tenant setup. FWIW, In my experience dealing with different environments for deployment, I've used a mixture

[pylons-discuss] Re: What do folks use for build tools? (buildout alternatives?)

2015-07-21 Thread Jonathan Vanasco
out of all the various tools I looked at, ansible seemed to be one of the better ones -- but I really didn't want to learn another tool. I got sick of trying to learn all the different configuration systems... and took the lazy choice (but more work) -- fabric. It manages my virtualenv and

Re: [pylons-discuss] Re: middleware vs components for auth

2015-07-20 Thread Jonathan Vanasco
On Saturday, July 18, 2015 at 11:35:44 AM UTC-4, Iain Duncan wrote: Off topic: have you tried the new glass for your glasses that changes the colour balance to reduce eye strain? I used to get very frequent migraines from coding, and an updated prescription with the the new fancy glass

[pylons-discuss] Re: middleware vs components for auth

2015-07-17 Thread Jonathan Vanasco
a third option is to use a tween, which would basically be a hybrid of a middleware and a sharedlib. the question I have is on the logistics of deployment -- are these different apps going to be on the same machine or will they be on different machines? also, how will you coordinate updates

Re: [pylons-discuss] global handling of query strings

2015-07-17 Thread Jonathan Vanasco
On Friday, July 17, 2015 at 5:24:44 AM UTC-4, Oliver Berger wrote: Access Tokens in the query string seem insecure to me since they persist in server log files... the access token would be fine if it's a Nonce (assuming this is some sort of oAuth style access grant). You could easily

[pylons-discuss] Re: middleware vs components for auth

2015-07-17 Thread Jonathan Vanasco
can you share how you envision the auth policy to work in any detail? 1. simple access 2. fine grained ACLs 3. auth can be cached for X amount of time OR auth may need to be immediately revoked/updated 4. will this be high load, low traffic, somewhere in between -- You received this message

Re: [pylons-discuss] Re: middleware vs components for auth

2015-07-17 Thread Jonathan Vanasco
On Friday, July 17, 2015 at 6:53:05 PM UTC-4, Iain Duncan wrote: Cached I think. ... I'd say medium. Normally low, but occasionally we could be dealing with 1 user type traffic. Sorry, I've had a migraine and eye-strain all week and can't seem to phrase questions (or anything)

[pylons-discuss] Re: pyramid or repoze.who for auth auth middleware?

2015-07-16 Thread Jonathan Vanasco
for something similar, i just used oAuth. since I control both endpoints (the micro-app and the accounts app), the token exchange is automatic and happens in two instantaneous redirects (ie, the user doesn't click anything). the benefit of this approach is that you can use different servers

Re: [pylons-discuss] Re: Render Jinja-template to string

2015-07-07 Thread Jonathan Vanasco
Have you tried: email/mytemplate.html -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To unsubscribe from this group and stop receiving emails from it, send an email to pylons-discuss+unsubscr...@googlegroups.com. To post to this group, send

Re: [pylons-discuss] Inconsistent ImportError

2015-07-01 Thread Jonathan Vanasco
On Wednesday, July 1, 2015 at 9:32:41 AM UTC-4, Brian Looker wrote: Oh! Deleting the .pyc files did it. Thank you very much! I remember learning about the potential for that problem at a Python Bootcamp, but hadn't encountered it before. I put a dumb little file called 'cleanup.py' in

Re: [pylons-discuss] Inconsistent ImportError

2015-06-30 Thread Jonathan Vanasco
Some possibly dumb questions: 1. are you failing to start it with the same .ini 2. can you start the failed project using the working virtualenv, and vice versa? 3. have you tried with a new virtualenv, and comparing? 4. have you tried deleting all the .pyc files? sometimes an old one will

[pylons-discuss] Re: Cloud IDE

2015-06-13 Thread Jonathan Vanasco
On Saturday, June 13, 2015 at 4:15:33 PM UTC-4, r/ Wobben wrote: Is there a good cloud ide that I can usefor pylons development ? I think you're the first person to being up a cloud ide on this list. Pyramid works on most non-cloud IDEs with minimal setup. (see Steve's note about PyCharm)

[pylons-discuss] Re: Removing whitespace from chameleon templates

2015-06-11 Thread Jonathan Vanasco
I use mako, and that functionality is would be called with a 'preprocessor'. The name for the chameleon version is expression engine and is done by writing a custom compiler. its in their docs under `extensions`. I'm not sure how to integrate either with the default template language support

[pylons-discuss] Re: Removing whitespace from chameleon templates

2015-06-11 Thread Jonathan Vanasco
ignore what I just said. I looked at the chamelon docs again and I was wrong. that section is for adding new language commands. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To unsubscribe from this group and stop receiving emails from it,

Re: [pylons-discuss] Re: Removing whitespace from chameleon templates

2015-06-11 Thread Jonathan Vanasco
CSS/Javascript aren't much of a problem if they hit the whitespace manager within the correct tags -- I forget the name of the processor we were using, but it detected that and didn't alter it. If you use a library built for this task, it's already done. Same thing with 'pre' tags. The

[pylons-discuss] Re: Hook for serialization to JSON with marshmallow schemas

2015-06-08 Thread Jonathan Vanasco
On Monday, June 8, 2015 at 5:23:03 AM UTC-4, Martin Stein wrote: @Jonathan: Probably you know this already, but have you seen the 'add_adapter' method for extending the pyramid JSON renderer? One of the first things I do when I start a new Pyramid-project is to add an adapter for

[pylons-discuss] Re: Hook for serialization to JSON with marshmallow schemas

2015-06-07 Thread Jonathan Vanasco
I usually convert to a dict in the view and then have a custom JSON encoder instead of the pyramid one. The default encoder (in the json package) doesn't handle a lot of datatypes (like datetime) so it was easiest to replace. -- You received this message because you are subscribed to the

[pylons-discuss] Re: Hook for serialization to JSON with marshmallow schemas

2015-06-06 Thread Jonathan Vanasco
what if you did something like: 1. define a custom renderer `render_marshmallow` that just does json on the columns (not relationships) unless you already... 2. define a request property of `render_marshmallow_schema` 3. have your views define `request.render_marshmallow_schema ` (unless

[pylons-discuss] Re: Hook for serialization to JSON with marshmallow schemas

2015-06-06 Thread Jonathan Vanasco
What about defining your own renderer, and using that in viewconfig instead of json? -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To unsubscribe from this group and stop receiving emails from it, send an email to

[pylons-discuss] feedback on routing plugin?

2015-06-05 Thread Jonathan Vanasco
If anyone has time/feedback, I started prototyping a simple (working) plugin for pyramid's routing. The basic idea is to register regular expressions – or the pairing of a 'key' with a regular expression – into the config object. You then write routes that invoke a macro syntax for the patterns

[pylons-discuss] Re: manage.py equivalent?

2015-06-01 Thread Jonathan Vanasco
In addition to all of the above... there is also Fabric and it's derivatives that make managing the installation and app very simple. I just want to note that a lot of stuff that is best done in manage.py under Django are commands that could be run within Pyramid, but might be better handled

Re: [pylons-discuss] Re: manage.py equivalent?

2015-06-01 Thread Jonathan Vanasco
On Monday, June 1, 2015 at 1:15:42 PM UTC-4, Chris McDonough wrote: Whoa. Fabric. How did we get there. We run a bunch of bootstrapped command-line pyramid via Fabric. They can (and do) run standalone, but this makes it all available within a single executable. Depending on what you're

Re: [pylons-discuss] puzzling stack trace

2015-05-26 Thread Jonathan Vanasco
It's been a long time since I've used Apache, but I think this might be a variation of why I left that architecture. I recall that if you run mod_wsgi (or mod_python, or mod_perl, or mod_php) on port 80, you could trigger timeout errors from slow connections or cancelled requests. The fix was

Re: [pylons-discuss] Re: Connection issue with redis_session

2015-05-22 Thread Jonathan Vanasco
What I'd imagine happening is this: 1. You're connecting on http, not https so... 2. The key isn't in the session, which will (correctly) raise an issue. If you're doing https, I think you need to put Pyramid behind something (i'm not sure if pserve can handle https or not). I run nginx on my

[pylons-discuss] Re: replacing memcached with redis in beaker

2015-05-22 Thread Jonathan Vanasco
just circling back; it was a drop-in fix. the only weird thing is that keys are saved in this format: beaker:{session_id}:session i would have expected beaker:session:{session_id} so to make things more standard, I just saved into it's own database id. -- You received this message

Re: [pylons-discuss] Best way to specify renderer at runtime

2015-05-20 Thread Jonathan Vanasco
You can use a view_config with no renderer, then call `render_to_response` This is my preferred method, because it gives me control within the views themselves. If you're talking about changing an entire global template directory, and not just for some views, something like what Chris

[pylons-discuss] replacing memcached with redis in beaker

2015-05-19 Thread Jonathan Vanasco
We need to simplify a production environment, and dropping memcached for redis seems to be the right solution. Migrating dogpile.cache looks easy. But we're also running beaker's sessions (via pyramid_beaker) and won't be able to migrate away from that for some time. The `beaker_extensions`

Re: [pylons-discuss] Re: Connection issue with redis_session

2015-05-18 Thread Jonathan Vanasco
Cookies (in general) have a few flags: * httponly - tells the browser to only send to severs; not allow JS access * secure - tells the browser to only send to secure servers (https, i think there are other secure methods too) Pyramid (and many other python packages) usually abstract them into

Re: [pylons-discuss] Re: Connection issue with redis_session

2015-05-17 Thread Jonathan Vanasco
On Saturday, May 16, 2015 at 5:12:08 PM UTC-4, Laurence Rowe wrote: Signed cookies are usually just fine, you only need encryption if you want to prevent the user from inspecting the content stored in their cookies. Encryption is also needed if you want to prevent others on the network

[pylons-discuss] Re: Connection issue with redis_session

2015-05-15 Thread Jonathan Vanasco
Sorry a bit confused about the types/locations of data you're talking about. Also I checked and pyramid does not have encrypted cookies. Sorry. I thought I read that someone had released a package; maybe it was a 3rd party plugin. Anyways... If your session has some sort of abstract 'account

[pylons-discuss] Re: Connection issue with redis_session

2015-05-15 Thread Jonathan Vanasco
pyramid_redis_session requires storing sessions on a redis server... so you need to install redis on your machine AND create a database/password on redis. redis is a GREAT solution for managing server-side session data. if you don't need to store data server side though (because it is very

[pylons-discuss] Re: Forms and Validation With Deform ???

2015-05-11 Thread Jonathan Vanasco
Developers also mark stuff as alpha to denote that, even though it probably works 99.999% of the time, they don't have enough bandwidth to actively maintain it as stable software. If there's a bug in alpha, developers shrug. If there's a bug in stable, developers yell viciously on mailing

Re: [pylons-discuss] How force DBSession to flush and commit SQLAlchemy expression language

2015-05-11 Thread Jonathan Vanasco
`mark_changed()` is what you want, for the reasons that Michael mentioned. if you want the convenience of his second method with a negligible performance hit, you could write a sqlalchemy event listener that calls mark_changed whenever `execute()` is called. personally, I think it's better

Re: [pylons-discuss] trypyramid.com and python 2.x

2015-05-09 Thread Jonathan Vanasco
I like the by artisans line. I think leading with Python3 is fine, but there should be a callout like 100% compatible with Python 2! -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To unsubscribe from this group and stop receiving emails

[pylons-discuss] Re: Seth - set of utilities for Pyramid framework

2015-04-16 Thread Jonathan Vanasco
Some of the tweens look really useful to me ( the secure and mobile ones seem like a smart use of tweens!) I'm not sure how popular the other ones would/should be -- or how often people would want to use multiple tweens. I'm bringing this up, because if multiple tweens would be used, it might

[pylons-discuss] Re: Pyramid 1.6a1 (and 1.4.8, and 1.5.6) now out

2015-04-15 Thread Jonathan Vanasco
Woo hoo! Now I can delete all the cruft I had in place to get around that response rendering behavior! Thanks, Pyramid! -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To unsubscribe from this group and stop receiving emails from it, send an

Re: [pylons-discuss] Pyramid + authentication via Facebook, Twitter, ...

2015-04-15 Thread Jonathan Vanasco
I found Velruse to be a hassle to integrate for my needs. I just rolled my own. For Twitter I use Twython. It's about 10 lines of pyramid code to implement an outgoing request and inbound callback. The Facebook I wrote `facebook_utils` which is just a lightweight API wrapper. That's about

[pylons-discuss] marking a json response as a server error

2015-04-03 Thread Jonathan Vanasco
The majority of JSON errors I return are 200-ok messages with an internal error message. I have a current need to upgrade an existing response/renderer into an error, as it's being consumed by a 3rd party javascript plugin that we don't have as much control in: This seems to work, but I'm

[pylons-discuss] Re: timing an application's setup ?

2015-03-23 Thread Jonathan Vanasco
That works PERFECT! thanks! from pyramid.events import ApplicationCreated, subscriber import os import psutil import time def application_created(event): time_now = time.time() time_start = psutil.Process(os.getpid()).create_time() print

[pylons-discuss] timing an application's setup ?

2015-03-21 Thread Jonathan Vanasco
Has anyone figured out a way to time an application's setup? I'm interested in the total time from the process being invoked until it's ready to serve. The ApplicationCreated event seems to be a good finish time, but I can't figure out a good start time to include the overhead of whatever

Re: [pylons-discuss] pattern for caching views ?

2015-03-13 Thread Jonathan Vanasco
Ah, so you're not using it to cache the views. No one seems to. Odd. I've migrated my worst views into this pattern with little trouble. The improvements seem great. There were a handful of page elements that were customized based on the request status. In order to handle those, I've

Re: [pylons-discuss] pattern for caching views ?

2015-03-13 Thread Jonathan Vanasco
Thanks Chris. I agree with everything you said. The reason why I found this weird, is that this response caching pattern is common and supported in most Python frameworks. It's not terribly hard to implement -- but since view_config natively supports json, string, mako, chamelon, et. --

Re: [pylons-discuss] pattern for caching views ?

2015-03-13 Thread Jonathan Vanasco
On Friday, March 13, 2015 at 3:53:38 PM UTC-4, Chris McDonough wrote: You mean renderers specified via view_config(renderer=...). Like I said, I don't think this is the right place to implement caching. Sorry, I think we're having 2 different conversations about the same thing. I'm not

Re: [pylons-discuss] pattern for caching views ?

2015-03-13 Thread Jonathan Vanasco
the `view_config` issue I encountered is that there is essentially no native way to return HTML. view_config supports most other types (templating engines, json, plaintext) but not HTML. that's very awkward to me. -- a lot frameworks have application-level page/view/response caches. the

[pylons-discuss] pattern for caching views ?

2015-03-12 Thread Jonathan Vanasco
I have a few views that are high traffic and too intensive for normal processing. I need to cache them. I tried an inner generator pattern for the HTML, which works well, but generating the response is ugly: @view_config(route=index) def my_view(self): the core data is cached within the view.

[pylons-discuss] Re: Comment tree in Pyramid with Mako

2015-03-12 Thread Jonathan Vanasco
reddit is written in Pylons (Pyramid's precursor) and Mako. Versions of their code have been opensourced and are on github. You can learn from it directly. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To unsubscribe from this group and

Re: [pylons-discuss] pattern for caching views ?

2015-03-11 Thread Jonathan Vanasco
how are you using it ? my caching decorator is actually dogpile's @cache_region.cache_on_arguments() the only way i could leverage it is with an internal generator function. otherwise there is always a cache miss (`request` would end up in the cache key, and is unique). that works, but i

[pylons-discuss] Re: Pyramid 1.5.4 released

2015-03-10 Thread Jonathan Vanasco
Do you have a dev version of Pyramid (ie, github master) checked out and installed? `pip install` will create an error like that if you do. The easy way to switch (IMHO) is to just easy-install instead ``easy_install pyramid==1.5.4` pip is really good for new environments, but it has a lot

[pylons-discuss] Re: Routes with same name and different url

2015-03-04 Thread Jonathan Vanasco
On Wednesday, March 4, 2015 at 10:30:44 AM UTC-5, Oliver Berger wrote: If you want the same view executed for several urls just decorate it twice with a different route... +1 That's what most people would do. it would look something like this: config.add_route ('test_index', '/

Re: [pylons-discuss] Re: Routes with same name and different url

2015-03-04 Thread Jonathan Vanasco
On Wednesday, March 4, 2015 at 12:52:51 PM UTC-5, Chris McDonough wrote: To be pedantic... Thanks for catching that! -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To unsubscribe from this group and stop receiving emails from it, send an

[pylons-discuss] Re: Pyramid 1.5.3 released

2015-02-23 Thread Jonathan Vanasco
On Sunday, February 22, 2015 at 5:14:37 PM UTC-5, Michael Merickel wrote: - Work around an issue where ``pserve --reload`` would leave terminal echo disabled if it reloaded during a pdb session. Backported from https://github.com/Pylons/pyramid/pull/1577 WOW. Amazing! I've been

Re: [pylons-discuss] introducing pyramid_services 0.1.1

2015-02-17 Thread Jonathan Vanasco
On Tuesday, February 17, 2015 at 1:30:01 PM UTC-5, David Glick wrote: It's an explicit design goal of Pyramid that application developers not have to understand the ZCA even when it's used internally: http://docs.pylonsproject.org/projects/pyramid/en/latest/designdefense.html#ameliorations

Re: [pylons-discuss] introducing pyramid_services 0.1.1

2015-02-17 Thread Jonathan Vanasco
This is really great. Thanks. It might make sense to ticket (for a sprint?) someone writing a brief overview about Interfaces to Pyramid's docs, and then link to that in your docs once it's done. Pyramid's docs (and the misc unofffical docs on the site) gloss over how the zope Interfaces are

[pylons-discuss] Re: is request.view_name set via url dispatch , or just traversal?

2015-02-12 Thread Jonathan Vanasco
Thanks a ton. I couldn't figure out what was going on -- I tried this on 3 operating systems, each with a clean virtualenv. Then I realized I had meant to use `request.matched_route.name`, and not `request.view_name` -- You received this message because you are subscribed to the Google

[pylons-discuss] is request.view_name set via url dispatch , or just traversal?

2015-02-12 Thread Jonathan Vanasco
I use URL Dispatch, and can't ever seem to see request.view_name populated. can someone confirm if it is supposed to appear in url dispatch routing as well? if so, i must be over-riding it somehow or have a bad install of something. -- You received this message because you are subscribed to

[pylons-discuss] Re: Changing behavior based on view_config

2015-02-09 Thread Jonathan Vanasco
I prefer using separate route names like you did. I tend to inspect `request.path` though. I don't like defs that have lots of inline context switches though. I prefer to use class based views and dispatch the `request` to other methods depending on the logic needed. I find it much easier

[pylons-discuss] Re: What is the difference between View and Route predicates?

2015-01-29 Thread Jonathan Vanasco
They don't actually differ at all. There is really only one Predicate object with a specified behavior. As the docs say You can use the same predicate factory as both a view predicate and as a route predicate. So they're really the same thing - a PredicateFactory - just invoked in a

<    1   2   3   4   5   6   7   8   9   10   >