Re: [pylons-discuss] externally hosted static files

2020-07-23 Thread 'Jonathan Vanasco' via pylons-discuss
This is a very simplified version of my approach: I typically handle this by injecting a `cdn` variable into the default rendering environment, and then just having the templates reference href="${cdn}/path/to/file" I specify the `cdn` var in the `.ini` file for the application. on startup

Re: [pylons-discuss] Migration from Flask - options?

2020-08-31 Thread 'Jonathan Vanasco' via pylons-discuss
I've done a handful of side-by-side migrations or deployments. I think you already identified the generally best approach IMHO: > Conceptually the simplest would be to have a auth cookie that is valid in both, it could be set to only be created in one and honoured in the other. However I

[pylons-discuss] migrating away from formencode?

2020-10-02 Thread 'Jonathan Vanasco' via pylons-discuss
Does anyone have tips/advice for migrating away from Formencode? I have a lot of apps using Formencode and will likely need to move off it. It's no longer maintained, and needs to a patch/fork to run under Python3. That's been fine for internal apps, but it's a pain for open sourced efforts.

Re: [pylons-discuss] migrating away from formencode?

2020-10-02 Thread 'Jonathan Vanasco' via pylons-discuss
too fragile so I try to keep all those apps running under Python2.. On Friday, October 2, 2020 at 3:40:22 PM UTC-4 Steve Piercy wrote: > On 10/2/20 10:06 AM, 'Jonathan Vanasco' via pylons-discuss wrote: > > Does anyone have tips/advice for migrating away from Formencode?

Re: [pylons-discuss] migrating away from formencode?

2020-10-05 Thread 'Jonathan Vanasco' via pylons-discuss
nder schema examples for each Deform widget that you want. >> If you don't see something, ask! >> >> --steve >> >> >> On 10/2/20 1:00 PM, 'Jonathan Vanasco' via pylons-discuss wrote: >> > Thanks, Stev! >> > >> > Deform i

Re: [pylons-discuss] migrating away from formencode?

2020-10-12 Thread 'Jonathan Vanasco' via pylons-discuss
in my use case. Now that Formencode 2 is out > I'll upgrade to it. > > On Mon, Oct 5, 2020 at 7:34 AM 'Jonathan Vanasco' via pylons-discuss > wrote: > > > > Talk about timing. Several hours after I posted this, Formencode merged > the Python3 fix(es)

[pylons-discuss] Will `render_to_response` ever return something that is not `pyramid.response.Response`?

2020-10-12 Thread 'Jonathan Vanasco' via pylons-discuss
I've looked at the code and am pretty sure the answer is no, but a bunch of subclasses are used here, so I think it's best to ask -- Will render_to_response ever return something that is not `pyramid.response.Response`? I have a small library that will act on the output of render_to_respons

Re: [pylons-discuss] Will `render_to_response` ever return something that is not `pyramid.response.Response`?

2020-10-12 Thread 'Jonathan Vanasco' via pylons-discuss
t implementing pyramid.interfaces.IResponse (the > expected return value from the app's configured IResponseFactory). This is, > of course, slightly more general than pyramid.response.Response. > > - Michael > > On Oct 12, 2020, at 13:48, 'Jonathan Vanasco' via pylons

[pylons-discuss] Re: Appengine Logging with Pyramid, need to get current request

2020-11-10 Thread 'Jonathan Vanasco' via pylons-discuss
I don't use Google's platform, but from what I can tell: 1. Their platform adds in the header "X_CLOUD_TRACE_CONTEXT" 2. There are middleware tools for aggregating logs based on that 3. I don't know if the software you linked is using the middleware, but the popular libraries seem to be: * https

[pylons-discuss] Re: Request attributes vs request environment

2020-11-12 Thread 'Jonathan Vanasco' via pylons-discuss
I don't know about "correct", but I use `add_request_method` to attach a custom object(s) with `reify=True,` and then store all the information in those objects. IIRC, the narrative documentation and tutorials use it for similar purposes. https://docs.pylonsproject.org/projects/pyramid/en/late

[pylons-discuss] Re: Creating sub-processes from Pyramid application

2021-01-04 Thread 'Jonathan Vanasco' via pylons-discuss
Have you considered using Celery for this? I started offloading everything related to subprocesses and message queues to it a while back, and have been much happier. On Monday, January 4, 2021 at 11:20:46 AM UTC-5 tfl...@gmail.com wrote: > Hi, > > I need to create custom sub-processes from my

Re: [pylons-discuss] Re: Creating sub-processes from Pyramid application

2021-01-05 Thread 'Jonathan Vanasco' via pylons-discuss
be able to get > access to main Pyramid's registry from my sub-process and it's threads, and > I don't really understand why I get a pointer to > ZCA global registry... :( > > Best regards, > Thierry > -- > https://www.ulthar.net -- http://pyams.readthedocs

Re: [pylons-discuss] Creating sub-processes from Pyramid application

2021-01-06 Thread 'Jonathan Vanasco' via pylons-discuss
(probably more reliable!) of my own developments... >> >> Best regards, >> Thierry >> -- >> https://www.ulthar.net -- http://pyams.readthedocs.io >> >> Le mar. 5 janv. 2021 à 22:18, 'Jonathan Vanasco' via pylons-discuss < >> pylons-...@goog

[pylons-discuss] Re: Pyramid maintenance mode

2021-01-07 Thread &#x27;Jonathan Vanasco&#x27; via pylons-discuss
I typically handle this on nginx which sites in front of Pyramid. if you wanted to do everything in python, you could probably use WSGI middleware to route to a separate maintenance application or html file. On Thursday, January 7, 2021 at 10:09:34 AM UTC-5 C J wrote: > Hi everybody, > > I am

[pylons-discuss] Re: Pyramid maintenance mode

2021-01-07 Thread &#x27;Jonathan Vanasco&#x27; via pylons-discuss
i should add, the pattern for doing this in nginx is often called a flag or semaphore i found this article that goes through a how-to https://blog.devcloud.hosting/configuring-nginx-for-quickly-switching-to-maintenance-mode-e4136cf497f3 basically, you just touch/remove a specific file to chan

Re: [pylons-discuss] Pyramid packaging

2021-01-26 Thread &#x27;Jonathan Vanasco&#x27; via pylons-discuss
FWIW, Based on the stacktrace, I do not think this is the cause -- but it could be. There have been a few related bugs in setuptools and pip regarding the version parser and tag_build directives; the errors I've seen were not like this - but I saw 3 completely different errors from these over t

Re: [pylons-discuss] Pyramid 2.0b1 released

2021-02-24 Thread &#x27;Jonathan Vanasco&#x27; via pylons-discuss
> I'd just say though that if you need the request and don't have it, > it's often an indication that the program's structure is wrong. I authored this change, and you are absolutely correct. This technique is not ideal, but it is designed to stop several anti-patterns that happen with great fr

Re: [pylons-discuss] Pyramid 2.0 released

2021-03-11 Thread &#x27;Jonathan Vanasco&#x27; via pylons-discuss
For those that need 2.0 support with pyramid_session_redis, I have pushed a Pyramid2 compatible branch of pyramid_session_redis to https://github.com/jvanasco/pyramid_session_redis/tree/1.6-branch-concept_a This branch is NOT likely to mature to an actual release, and is basically offered as a

[pylons-discuss] generating docs for views

2021-03-12 Thread &#x27;Jonathan Vanasco&#x27; via pylons-discuss
I had a small Pyramid project which has grown into a much larger one. Many Views service multiple Routes (multiple calls to `@view_config()`), typically offering a default HTML version on a "bare" url, and a JSON version with a ".json" suffix to the url. Documenting these routes has become incr

Re: [pylons-discuss] generating docs for views

2021-03-12 Thread &#x27;Jonathan Vanasco&#x27; via pylons-discuss
t; it is on-demand only). > > https://pyramid-realworld.herokuapp.com/api > > --steve > > > On 3/12/21 1:36 PM, 'Jonathan Vanasco' via pylons-discuss wrote: > > I had a small Pyramid project which has grown into a much larger one. > > > > Many Views serv

[pylons-discuss] debugging JSON encoder issues

2021-03-15 Thread &#x27;Jonathan Vanasco&#x27; via pylons-discuss
I've run into this same problem a few times in unittest. I'm hoping someone else has a better solution. 1. The test harness uses webtest.TestApp to mount the Pyramid application 2. A route has a payload with an object that can not be rendered into json 3. The traceback looks like the item below.

[pylons-discuss] pyramid_session_redis 1.6.0 released

2021-03-30 Thread &#x27;Jonathan Vanasco&#x27; via pylons-discuss
pyramid_session_redis 1.6.0 is now released on Github and PyPi. Notable changes: * Pyramid2 is now supported. * Pyramid1.x and Python2 are still fully supported. * The Session object has two new methods: * Session.adjust_cookie_expires * Session.adjust_cookie_max_age * These methods

Re: [pylons-discuss] how does pyramid know what "create" , "view", "edit" etc is ?

2021-05-12 Thread &#x27;Jonathan Vanasco&#x27; via pylons-discuss
Extending and hoping to clarify Steve's example above, Pyramid users typically leverage the "predicates" to handle this mapping. by using the `request_method` predicate to map "GET" to "view", "POST" to "create", etc. On Monday, May 10, 2021 at 4:27:09 PM UTC-4 grc...@gmail.com wrote: > > excell

Re: [pylons-discuss] Problem between Pyramid's CSRF protection and Deform

2021-05-12 Thread &#x27;Jonathan Vanasco&#x27; via pylons-discuss
They're not the same at all. The difference is on purpose. Janzert is correct, though his description may not necessarily be clear. The following might make more sense: The two functions do the following: pyramid.csrf.get_csrf_token(request) discern active ICSRFStoragePolicy invoke {

[pylons-discuss] Replacing Freenode?

2021-05-19 Thread &#x27;Jonathan Vanasco&#x27; via pylons-discuss
Are there any plans to replace Freenode, in light of the recent developments? See: https://boingboing.net/2021/05/19/freenode-irc-staff-quit-after-new-owner-seizes-control.html https://libera.chat/ -- You received this message because you are subscribed to the Google Groups "pylons-d

Re: [pylons-discuss] Replacing Freenode?

2021-05-20 Thread &#x27;Jonathan Vanasco&#x27; via pylons-discuss
uses which is behind such stalwarts as Debian, Libreoffice (in the U.S.) > and PostgreSQL.Org > > > > On Wed, May 19, 2021 at 7:24 AM 'Jonathan Vanasco' via pylons-discuss < > pylons-...@googlegroups.com <mailto:pylons-...@googlegroups.com>> wrote:

[pylons-discuss] debugtoolbar - don't intercept a raised exception ?

2021-05-21 Thread &#x27;Jonathan Vanasco&#x27; via pylons-discuss
One of my CI tests deals with an edge case, in which a HTTPMovedPermanently is raised in deeply nested code. This almost never gets raised in Production - rules on the loadbalancer/gateway typically catch it. With the debugtoolbar off, Pyramid serves the redirect. With the debugtoolbar enabled

[pylons-discuss] Re: debugtoolbar - don't intercept a raised exception ?

2021-05-25 Thread &#x27;Jonathan Vanasco&#x27; via pylons-discuss
I *temporarily* solved this by modifying an existing tween. The relevant code looks like this: def my__tween(request): _redirect = None try: response = handler(request) except HTTPException as exc: _redirect = exc if _redirect:

Re: [pylons-discuss] SQLAlchemy create_engine future argument

2021-08-13 Thread &#x27;Jonathan Vanasco&#x27; via pylons-discuss
> It looks like the `future` flag on Engine and the `future` flag on Session are two separate things. So you need to add `future=True` to either sessionmaker or the Session constructor. Confirming this. There is also a `future` on `Connection` objects, but that is inherited from `Engine`. Se

Re: [pylons-discuss] Best practices for running Pyramid (docker) and nginx (host) deployment

2022-01-07 Thread &#x27;Jonathan Vanasco&#x27; via pylons-discuss
On Monday, December 13, 2021 at 9:14:30 PM UTC-5 the...@luhn.com wrote: > 1) pserve isn’t really comparable with gunicorn, its just a way to launch > a server, such as gunicorn or waitress. You’re probably using waitress, > that’s what the Pyramid docs use. > > I personally use gunicorn, but m

Re: [pylons-discuss] Subscribing to connection lost / failed transaction event?

2022-03-15 Thread &#x27;Jonathan Vanasco&#x27; via pylons-discuss
100% with you. That's why I wrote it isn't "really" possible. It is possible, just under limited conditions. IIRC, one could also use the COMET chunking technique to faciliate this - though that would likely cause some client side issues. If you're doing a direct browser-to-server connection,

[pylons-discuss] Re: Looking for best option for Pyramid deployment

2022-03-15 Thread &#x27;Jonathan Vanasco&#x27; via pylons-discuss
We run Pyramid via uwsgi, behind an OpenResty server (Nginx fork with embedded lua interpreter). IMHO the "best" stack is somewhat dependent on your application. We have a large application and the forking model of uwsgi - combined with many of its management hooks - lets us aggressively lev

[pylons-discuss] Re: pyramid_tm 2.5 has been released

2022-03-16 Thread &#x27;Jonathan Vanasco&#x27; via pylons-discuss
I assume this message is automated by a release script, and that is out of date. The changes and latest aren't rendered onto those docs, and the anchors don't exist. The changes do appear here: https://github.com/Pylons/pyramid_tm/blob/master/CHANGES.rst On Sunday, March 13, 2022 at 4:01:18

Re: [pylons-discuss] Re: pyramid_tm 2.5 has been released

2022-03-31 Thread &#x27;Jonathan Vanasco&#x27; via pylons-discuss
m/en/latest/changes.html > > --steve > > > On 3/16/22 10:10 AM, 'Jonathan Vanasco' via pylons-discuss wrote: > > I assume this message is automated by a release script, and that is out > of date. > > > > The changes and latest aren't rendered onto thos

[pylons-discuss] pserve run in a child process under Fabric/Invoke + VirtualEnv ?

2022-06-08 Thread &#x27;Jonathan Vanasco&#x27; via pylons-discuss
I doubt anyone here may have experienced this, but I've run out of resources to explore on this... We use Fabric (fabfile.org) to automate a lot of things. It is great. I built a new routine in it this week, and I can't get it to clean up properly. The routine simply spins up an admin version

Re: [pylons-discuss] pserve run in a child process under Fabric/Invoke + VirtualEnv ?

2022-06-09 Thread &#x27;Jonathan Vanasco&#x27; via pylons-discuss
virtualenv wrapper around a console > script which this should skip. > > > > - Michael > > On Jun 8, 2022, at 15:31, 'Jonathan Vanasco' via pylons-discuss < > pylons-...@googlegroups.com> wrote: > > I doubt anyone here may have experienced this, but

Re: [pylons-discuss] Pyramid, partial and resumable downloads, HTTP Accept Ranges

2022-07-08 Thread &#x27;Jonathan Vanasco&#x27; via pylons-discuss
^ ditto On Tuesday, June 28, 2022 at 6:28:23 PM UTC-4 the...@luhn.com wrote: > Easiest way is to not do it :) I try to offload downloads/uploads to a > service like S3. Let somebody else do the heavy lifting. If > authentication is needed, I’ll generate a presigned URL in Pyramid and > redi

Re: [pylons-discuss] Re: using pyramid without an ORM ?

2022-08-16 Thread &#x27;Jonathan Vanasco&#x27; via pylons-discuss
On Tuesday, August 16, 2022 at 11:45:24 AM UTC-4 Mike Orr wrote: > It is rolling back in some of my testing when there's no > insert/delete/update, but I want to make sure it always does, just in > case something somehow modifies the database when we didn't intend to. > It's not that big a deal but

[pylons-discuss] Re: Top like monitoring for Pyramid / Gunicorn

2022-08-22 Thread &#x27;Jonathan Vanasco&#x27; via pylons-discuss
Have you tried using statsd ? (https://github.com/statsd/statsd) See * https://www.etsy.com/codeascraft/measure-anything-measure-everything/ * https://thenewstack.io/collecting-metrics-using-statsd-a-standard-for-real-time-monitoring/ Typically you log each request start and the stop reason (s

Re: [pylons-discuss] [ANN] web-top

2022-08-24 Thread &#x27;Jonathan Vanasco&#x27; via pylons-discuss
This looks interesting. I'll try to test it on uwsgi and contribute a PR if it works. If anyone can beat me to it though... On Wednesday, August 24, 2022 at 4:44:09 AM UTC-4 mi...@redinnovation.com wrote: > Hi Thierry, > > >> That seems to be a nice project! >> I would like to provide an integr