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
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,
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
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
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
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
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
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
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
@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
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?
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.
@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
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
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:
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
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
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
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
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
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
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
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
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
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
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
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
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:
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,
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
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
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
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
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)
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
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 ;)
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
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
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
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
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')
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
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
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
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
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
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
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
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
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)
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
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
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
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
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)
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
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,
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
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
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
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
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
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
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
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
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
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
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
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
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`
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
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
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
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
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
`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
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
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
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
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
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
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
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
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
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. --
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
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
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.
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
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
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
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', '/
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
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
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
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
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
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
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
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
301 - 400 of 1275 matches
Mail list logo