Quantcast
Channel: User Michael Merickel - Stack Overflow
Browsing all 39 articles
Browse latest View live

Comment by Michael Merickel on Can I raise exception in python pyramid...

I totally agree with this by the way. The primary dbsession should be used for “successful” or “primary” work and if there’s other data you want to record outside of that then it should be done in a...

View Article



Comment by Michael Merickel on Gzipping all HTTP traffic with Pyramid

You can still install pip install paste fwiw.

View Article

Comment by Michael Merickel on How to protect a pyramid registry from changes...

a deep copy would be impossible - a shallow may be possible but I'm unaware of a public api for it

View Article

Comment by Michael Merickel on Using Pyramid events and multithreading

The issue here is that you cannot re-use the env as a context manager multiple times. I've provided the appropriate way in my answer.

View Article

Comment by Michael Merickel on few requests causes 503 errors (nginx,...

It's often done by nginx if the backend doesn't send any bytes in the response in a certain amount of time. Gunicorn may have similar settings.

View Article


Comment by Michael Merickel on Webob / Pyramid query string parameters out of...

Any chance you can reproduce it outside of your app?

View Article

Comment by Michael Merickel on Random NoTransaction in Pyramid

I suspect you only run into problems when running two requests at the same time which exposes some race conditions between the shared session being opened/closed in unexpected ways when each request is...

View Article

Comment by Michael Merickel on Connection pool to external services (redis)...

Globals are bad in almost every type of programming, albeit generally necessary in embedded domains. Globals are a type of side effect (state mutated/handled outside of the function signature) and make...

View Article


Comment by Michael Merickel on How can I compare a Javascript Variable with...

The answer is correct... jinja executes on the server and javascript executes in the client's browser. If you want to compare, then you have to get the jinja variable into javascript, and then it can...

View Article


Comment by Michael Merickel on How to prevent two users execute a function...

I think it's more complicated than a boolean field because you need a compare-and-set operation that is atomic. redis.io/topics/distlock has some information about using redis to do locking.

View Article

Comment by Michael Merickel on How do I manually commit a sqlalchemy database...

The code snippet I pasted, if put into a view callable, should work. If the celery task is invoked after the commit, as in the paste, and it's returning a NoResultFound, my suspicion is that there's...

View Article

Comment by Michael Merickel on Using React fetch gives...

If you turn on the pyramid.debug_notfound = yes setting in your ini file then the http response will note which predicates are failing to match which will help understand what is going on.

View Article

Comment by Michael Merickel on How to reference artifact generated by...

Did you ever figure this out?

View Article


Answer by Michael Merickel for Pyramid override default requests log to add...

For code that I control I'd usually wrap things in my own utility that I can instrument instead of trying to patch/modify how urllib3 works or performs its own logging. This could be just a few...

View Article

Answer by Michael Merickel for How to override python pyramid app config...

The configurator is where you should perform overrides. So the answer is to modify web_main or define your own. Pyramid has an override mechanism via config.include(), but it does not work one level...

View Article


Answer by Michael Merickel for When/where should openid tokens be validated...

Sure, you can store the JWT token in a cookie. You choose the authentication policy - just write one that does that instead of using one that stores it in the session.

View Article

Answer by Michael Merickel for Accessing Pyramid Settings throughout the program

Pyramid itself does not use global variables, which is what you are asking for when you ask for settings to be available in class-level or module-level attributes. For instance-level stuff, you can...

View Article


Answer by Michael Merickel for How to get a db session at Pyramid app...

If you're using the cookiecutter then it's pretty straightforward. The session factory is stored in config.registry['dbsession_factory'] and you can grab it and use it to make sessions whenever you...

View Article

Answer by Michael Merickel for Using Pyramid events and multithreading

get_current_registry() is trying to access the threadlocal variable Pyramid registers when processing requests or config to tell the thread what Pyramid app is currently active IN THAT THREAD. The...

View Article

Answer by Michael Merickel for Webob / Pyramid query string parameters out of...

As a simple example, this works fine for me, and the MultiDict has always preserved the order and so I suspect something is getting rewritten by something you're using in your stack.from pyramid.config...

View Article
Browsing all 39 articles
Browse latest View live




Latest Images