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

2021-12-19 Thread Jens Troeger
Oh, and more question… Monitoring. For example, to monitor Dramatiq ’s asynchronous workers it provides a middleware for Prometheus to gather metrics. What’s does the community

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

2021-12-17 Thread Jens Troeger
Thank you, everyone! @Theron, yes I meant “forwardED”, just a typo. I’ll review the configuration and try again. Regarding the Docker link: my project has heaps of dependencies that I offloaded into another base image, so I think I won’t be able to build on top of yours. @Michael, glad to

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

2021-12-13 Thread Jens Troeger
Hello, I’ve seen some conversation here about running a Pyramid app server inside a Docker container, but none has really answered my questions. My setup is that nginx runs on the host and currently uses *proxy_pass* to

[pylons-discuss] GET, HEAD, the Guillotine middleware extension

2019-10-18 Thread Jens Troeger
Hello, Today I stumbled upon a somewhat dated Pylons project called Guillotine , a WSGI middleware extension. It seems to have only one purpose: rewrite the

[pylons-discuss] Is there a catch-all “predicate mismatch” view?

2019-08-08 Thread Jens Troeger
Hello, During testing we just noticed that existing views whose predicate mismatched when making a request return an error like so: 404 Not Found The resource could not be found. predicate mismatch for view ... (request_method = POST) Is there a way to define a view that matches any and all

[pylons-discuss] How to handle SQLA autoflush failures during Request commit?

2019-06-21 Thread Jens Troeger
Hello, I’m using gunicorn in front of a Pyramid server, and I changed the configuration from 1 to 4 workers. Now I occasionally see the following exception: InvalidRequestError: This Session's transaction has been rolled back due to a previous exception during flush.

Re: [pylons-discuss] Velruse… or what else?

2019-06-07 Thread Jens Troeger
Thank you Michael for sharing your insights here. I’ve looked through some of the code but, as you said, the testing looked rather daunting to me. On top of that, it's actually really easy (imo) to consume OAuth 2.x + > OpenID Connect apis directly. Most bindings for velruse end up being just a

[pylons-discuss] Velruse… or what else?

2019-06-03 Thread Jens Troeger
Hi, Interesting OAuth thread here , thank you! And just in time for my question. I’ve been using Velruse quite happily for a while now, although it’s been stale for a few years. MichaelM

Re: [pylons-discuss] Relationship between requests and Zope transactions

2018-09-07 Thread jens . troeger
Thank you Mike for the information, that all makes sense. I ended up with the same approach that SQLA takes: a “Session” object owned by a DataManager, joined to the Request’s TransactionManager. And then just pass a `dbsession` and `fnsession` and `jobsession` around to functions as needed.

Re: [pylons-discuss] Relationship between requests and Zope transactions

2018-09-02 Thread jens . troeger
Maybe some background… the reason why I asked the initial question is because a few (and a growing number of) request handlers are complex; that is, they call multiple function levels deep. Now request.dbsession, for example, is SQLA’s current DB session tied to the request’s transaction. To

Re: [pylons-discuss] Relationship between requests and Zope transactions

2018-09-02 Thread jens . troeger
Maybe some background… the reason why I asked the initial question is because a few (and a growing number of) request handlers are complex; that is, they call multiple function levels deep. Now request.dbsession, for example, is SQLA’s current DB session tied to the request’s transaction. To

Re: [pylons-discuss] Relationship between requests and Zope transactions

2018-09-01 Thread jens . troeger
Thanks Michael! You are talking about these two lines of code in the cookiecutter’s

[pylons-discuss] Relationship between requests and Zope transactions

2018-09-01 Thread jens . troeger
Hi, According to the documentation here , “Pyramid requests [to] join the active transaction

Re: [pylons-discuss] Re: How to send task-message after request.tm has committed?

2018-06-01 Thread jens . troeger
Hello Thierry, You are talking about these data managers: http://zodb.readthedocs.io/en/latest/transactions.html#data-managers Correct? Other than the Mailer it seems a little difficult to find more verbose documentation? I have played a little more

[pylons-discuss] Re: How to send task-message after request.tm has committed?

2018-05-31 Thread jens . troeger
Poking around the documentation some more, it seems that using an after-commit-hook may work: i.e. when a task needs to be scheduled by the view function, then find the request’s transaction (from `request.tm`?) and

[pylons-discuss] How to send task-message after request.tm has committed?

2018-05-31 Thread jens . troeger
Hi, Within a view function it becomes necessary to run an async task. Celery , Dramatiq , etc are frameworks to handle that. However, my async task needs to read db objects which have been created—and must be committed and persisted—by the

Re: [pylons-discuss] DB QueuePool limit overflow and Pyramid sub-requests

2018-05-01 Thread jens . troeger
Thank you for the explanation, Jonathan! No, I didn't use *use_tweens* and perhaps will give that a try. However, considering our other conversation regarding the requests package and how to issue API calls within a view

[pylons-discuss] Re: Suggested way to issue requests from inside a view callable

2018-05-01 Thread jens . troeger
Thank you everybody, requests it is then!  On Wednesday, May 2, 2018 at 2:40:29 AM UTC+10, Jonathan Vanasco wrote: > > If your synchronous tasks are done "quickly" or must be "blocking" -- like > doing some oAuth or hitting an external API that is guaranteed to return a > request within a

[pylons-discuss] Suggested way to issue requests from inside a view callable

2018-04-30 Thread jens . troeger
Hello, I guess following up on the thread on Pyramid’s sub-requests , what is the recommended way to issue a (synchronous) request to an external server from within a view callable? Using the requests package, or are

Re: [pylons-discuss] DB QueuePool limit overflow and Pyramid sub-requests

2018-04-30 Thread jens . troeger
Jonathan, On Monday, April 30, 2018 at 4:17:50 AM UTC+10, Jonathan Vanasco wrote: > > How are you handling your session connection and cleanup? Are you using > pyramid_tm? If so, are you using the `use_tween` on the invoke_subrequest > to properly close each connection in the pool? If not,

Re: [pylons-discuss] DB QueuePool limit overflow and Pyramid sub-requests

2018-04-28 Thread jens . troeger
Hi Jonathan, Assuming you have 1 request and 5 subrequests, shouldn't there only be 2 > connections needed in the pool (i.e. the main request establishes a first > connection, then subrequest 1 establishes a second connection which is > re-used by 2-5)? You wouldn't be able to save a

Re: [pylons-discuss] DB QueuePool limit overflow and Pyramid sub-requests

2018-04-28 Thread jens . troeger
Thank you Michael, In general I strongly urge you to reconsider using subrequests... they are > there for people to use but they have lots of drawbacks versus just calling > a bunch of reusable functions. > What would you recommend then to issue a request from within a view function? Using

[pylons-discuss] DB QueuePool limit overflow and Pyramid sub-requests

2018-04-26 Thread jens . troeger
Hello, Perhaps this forum is more appropriate to ask than the SQLAlchemy group (see this same question over there ). I would like to understand the interplay between a SQLA session and a Pyramid’s subrequest

[pylons-discuss] route_url() to generate a URL with …/#/… (for Javascript)

2018-03-06 Thread jens . troeger
Hi, Using request.route_url() I’m trying to generate a URL of the form: _app_url/#/foo?arg=bla Using a route="/#/foo" escaped the hash, and so did "/{hash_}/foo", and that's according to the change comment

[pylons-discuss] Re: What’s the type of `request` in an exception view?

2018-01-27 Thread jens . troeger
After some more tinkering: the `request` parameter is of type *pyramid.util.Request* which is derived from *pyramid.request.Request*, so using isinstance() is safe. As per this example

[pylons-discuss] What’s the type of `request` in an exception view?

2018-01-27 Thread jens . troeger
Hello, I’ve got the following exception view: @view_config( context=Exception, permission=NO_PERMISSION_REQUIRED, ) def handle_exception(exc, request): """Last resort view function.""" … I had assumed that the `request` parameter here is the same instance as the `request`

[pylons-discuss] Confused with parameter `request` in exception views.

2018-01-27 Thread jens . troeger
Hello, Following the examples of how to implement an exception view (see here or here

[pylons-discuss] Re: pyramid webdav example?

2017-12-11 Thread jens . troeger
This question is somewhat dated and still unanswered. I’d like to renew it though: has anybody in the meantime been playing around with WebDAV (or its derivates CalDAV and CardDAV

[pylons-discuss] How to handle DB transaction failures/request race conditions

2017-11-27 Thread jens . troeger
Hello, Looking at the SQLAlchemy cookie cutter , a request gets its own transaction-backed db session, and on its way out a response commits that transaction and closes the session. There are activation

[pylons-discuss] Attaching custom header to all responses

2017-11-06 Thread jens . troeger
Hi, This question is more of a curious one as I explore different possible solutions for a problem. What is the recommended way of adding an X-Myapp-Didum header to *every* response returned from the server? It looks like there are different ways to achieve that: - Change the Response

Re: [pylons-discuss] How to enable JSON renderer as default for all views?

2017-11-06 Thread jens . troeger
Thanks Michael! Would you like me to submit a PR for the adjusted comment as per your suggestion? All of my (Cornice) view functions are decorated like so: @some_service.post( content_type="application/json",

[pylons-discuss] How to enable JSON renderer as default for all views?

2017-11-01 Thread jens . troeger
Hello, The documentation for the default renderer for all views seems to suggest that the following should work: from pyramid.renderers import JSON config = Configurator( … )

Re: [pylons-discuss] Proper handling of views for ACL roles

2017-10-16 Thread jens . troeger
Thank you, Michael, exactly what I was looking for :-) I understand your point of mutually exclusive roles for predicates, but seeing that `effective_principals` takes a list, I assume that I can use multiple roles for the predicate? Cheers, Jens On Monday, October 16, 2017 at 11:04:56 AM

[pylons-discuss] Proper handling of views for ACL roles

2017-10-15 Thread jens . troeger
Hi, I'm using Cornice and Pyramid for my REST API server, and followed the standard authorization examples using ACLs

[pylons-discuss] How do I "forward" requests and switch their contexts?

2017-09-19 Thread jens . troeger
Hello everybody, I could need a bit of help with a more architectural question. I'm using Cornice to build a REST server on top of Pyramid/SQLAlchemy. Now I've got two main "domains" in my endpoints, which are accessed by the two different user roles in

[pylons-discuss] Re: New Pyramid Celery integration implementation

2016-12-08 Thread jens . troeger
Thank you for this thread, good pointers! I'd be curious to hear your opinions to this code review request: http://codereview.stackexchange.com/questions/148872/integrating-celery-task-queue-with-pyramid/ Thanks! On Sunday, August 21, 2016 at 8:41:35 PM UTC+10, Mikko Ohtamaa wrote: > > Hi