Re: [pylons-discuss] Re: SQLAlchemy 2.0 support

2022-11-28 Thread Zsolt Ero
I just use "PYTHONWARNINGS=default", afaik that's all I need to do right? It shows me all the Pyramid and waitress warnings. On 28. Nov 2022 at 19:53:27, Jonathan Vanasco wrote: > On Sunday, November 27, 2022 at 1:23:21 PM UTC-5 zsol...@gmail.com wrote: > >> Great to know! About the warnings,

Re: [pylons-discuss] Re: SQLAlchemy 2.0 support

2022-11-27 Thread Zsolt Ero
Great to know! About the warnings, I'm on 2.0 and it works, so either some of those RemovedIn20Warning are not removed or none of them are left. I mean I rewrote my queries to 2.0 style, but I've read that 1.x style queries will continue to work, they are just removed from the documentation now.

[pylons-discuss] Re: webtest upload file in body

2021-06-24 Thread Zsolt Ero
I think I figured this one out, I can pass the bytes into params= and it'll work. Strange naming though. On 24. Jun 2021 at 20:56:50, Zsolt Ero wrote: > Hi, > > How can I upload a file in the body in webtest.post? requests allows me > to do this in data=, curl in --data-binar

[pylons-discuss] webtest upload file in body

2021-06-24 Thread Zsolt Ero
Hi, How can I upload a file in the body in webtest.post? requests allows me to do this in data=, curl in --data-binary. Webob reads this in body_file_seekable. How can I do this in webtest.post? Regards, Zsolt -- You received this message because you are subscribed to the Google Groups

[pylons-discuss] modifying database in webtest based testing

2021-06-24 Thread Zsolt Ero
Hi, I have my webtest based testing set up like the following. @pytest.fixture(scope="session") def app(): testing_config = { 'sqlalchemy.url': 'postgresql+psycopg2://x@/x', 'redis.sessions.secret': 'x', # random string 'redis.sessions.db': 1,

Re: [pylons-discuss] minimal auth/security policy implementation

2021-05-24 Thread Zsolt Ero
Hi Theron, Thanks for your reply. It looks indeed simpler. How much more minimal can I make it? I definitely want to "circumvent" the whole security system, I'm perfectly happy with using my new require_admin=True like options. I just want CSRF to work and it seems to be dependent on

Re: [pylons-discuss] changing session cookie max_age?

2020-09-23 Thread Zsolt Ero
Just for reference I'd like to post what worked for me. Thanks for the detailed help. Finally I've settled on the following values: ``` redis.sessions.secret = xxx redis.sessions.cookie_max_age = 31536 # 10 years, basically forever redis.sessions.timeout = 1800 redis.sessions.cookie_secure

[pylons-discuss] Non-multithread compatible modules and waitress

2019-05-05 Thread Zsolt Ero
I had a few questions in https://github.com/Pylons/waitress/issues/253, which were not really an issue and I'd like to ask them here instead. My question mostly is that if I'm using modules which are non-multithread compatible in pserve / waitress, how can I make sure they work correctly?

[pylons-discuss] How to detect WebOb NoVars case

2019-05-05 Thread Zsolt Ero
There is a bug in WTForms 2.2+ which related to how WebOb handle request.POST in GET requests. https://github.com/wtforms/wtforms/issues/460 We are trying to find a WebOb specific solution with the maintainer, to handle the NoVars case. I just wanted to ask, what approach would you recommend

Re: [pylons-discuss] Questions about DB engine setup

2019-05-01 Thread Zsolt Ero
Thanks for the answers. I've been using gunicorn with sync workers and it seems clear to me. If I understand correctly, up-till-some-point, everything in the script is shared across the processes, and these receive identical ids in Python. Everything which happens at import time is definitely in

Re: [pylons-discuss] Questions about DB engine setup

2019-04-30 Thread Zsolt Ero
Thanks a lot for all the answers. So far I've only implemented select queries, using dbsession.execute. I'll read about the "changed" state handling. About the additional options: pool_pre_ping seems to work well and doesn't seem to have any side effects. pool_reset_on_return on the other hand

[pylons-discuss] Questions about DB engine setup

2019-04-27 Thread Zsolt Ero
I'm trying to set up an API which would use SQLAlchemy Core (not ORM) + PostgreSQL. The server is a Google managed PostgreSQL instance, on external IP. I have a couple of questions. Since I needed to manually add SSL certificates as connect_args to create_engine + some additional arguments,

Re: [pylons-discuss] processing after responding to client

2019-01-10 Thread Zsolt Ero
rry > > > Le jeu. 10 janv. 2019 à 13:37, Zsolt Ero a écrit : >> >> Actually, it doesn't result in async-like behaviour, the client is >> still waiting for the function inside the commit hook. I guess I don't >> understand the concept then. >> >> On

Re: [pylons-discuss] processing after responding to client

2019-01-10 Thread Zsolt Ero
Actually, it doesn't result in async-like behaviour, the client is still waiting for the function inside the commit hook. I guess I don't understand the concept then. On Thu, 10 Jan 2019 at 13:15, Zsolt Ero wrote: > > I'm just now implementing this. Are you saying that basically, by

Re: [pylons-discuss] processing after responding to client

2019-01-10 Thread Zsolt Ero
I'm just now implementing this. Are you saying that basically, by using addAfterCommitHook, I can replace put relatively fast (say, <10 seconds), functions into async-like behaviour, without requiring any external queue service? old: # send email was an async function, via a decorator (using

[pylons-discuss] processing after responding to client

2018-11-10 Thread Zsolt Ero
On a fairly classic Pyramid app (sync, gunicorn, SQLAlchemy / Postgresql, like the starter template), I am storing analytics-like events in a table for some of my views. Like this skeleton: @view_config(route_name='test', request_method='POST', renderer='json') def test(request): # body of

[pylons-discuss] Re: API file upload

2018-04-17 Thread Zsolt Ero
for this? Zsolt On 17 April 2018 at 15:10, Zsolt Ero <zsolt@gmail.com> wrote: > I've realised the following: > 1. If I don't specify Content-Type, curl defaults to x-www-form-urlencoded > 2. What I thought is the binary file's contents as a string is > actually not working r

[pylons-discuss] Re: API file upload

2018-04-17 Thread Zsolt Ero
I've realised the following: 1. If I don't specify Content-Type, curl defaults to x-www-form-urlencoded 2. What I thought is the binary file's contents as a string is actually not working reliably. On an XML upload of a single file I get thousands of items and request.POST.items() looks like: ['

[pylons-discuss] API file upload

2018-04-17 Thread Zsolt Ero
Hi, I'm trying to implement an API to a website which didn't have an API yet. It's purpose will be to allow file uploads from 3rd party native apps. I'd like to implement the API like Dropbox v2 API, just as a good reference for API design. It's upload endpoint has the following specs:

Re: [pylons-discuss] Pyramid + SQLAlchemy + PostgreSQL: idle connections

2018-04-02 Thread Zsolt Ero
use the explicit > manager". > > The only time you really need to think about transaction stuff is when > pyramid_tm is not active which is basically at config-time and in console > scripts. > > - Michael > > On Mon, Apr 2, 2018 at 2:54 PM, Zsolt Ero <zsolt@gmail.c

Re: [pylons-discuss] Pyramid + SQLAlchemy + PostgreSQL: idle connections

2018-04-02 Thread Zsolt Ero
nsaction. > > [1] > https://docs.pylonsproject.org/projects/pyramid-tm/en/latest/#custom-transaction-managers > > On Mon, Apr 2, 2018 at 2:21 PM, Zsolt Ero <zsolt@gmail.com> wrote: >> >> Michael, I've updated the code to your recommendation. >> >>

Re: [pylons-discuss] Pyramid + SQLAlchemy + PostgreSQL: idle connections

2018-04-02 Thread Zsolt Ero
ession and re-attach/merge them into any session where you > use them.. ORM objects are only valid on the dbsession they were loaded > from. > > - Michael > > > On Mon, Apr 2, 2018 at 11:59 AM, Zsolt Ero <zsolt@gmail.com> wrote: >> >> OK, I agree wit

Re: [pylons-discuss] Pyramid + SQLAlchemy + PostgreSQL: idle connections

2018-04-02 Thread Zsolt Ero
OK, I agree with that. Still, storing config values in the database is a common pattern for medium to large web apps, so it at least makes sense to have some kind of resource about how to do it. I hope that if nothing else at least this thread will be useful for someone in the future. -- You

Re: [pylons-discuss] Pyramid + SQLAlchemy + PostgreSQL: idle connections

2018-04-02 Thread Zsolt Ero
Wouldn't the second / "foolproof" way described here be a good choice for the default Pyramid implementation? Just as a safety measure. http://docs.sqlalchemy.org/en/latest/core/pooling.html#using-connection-pools-with-multiprocessing On 2 April 2018 at 18:32, Jonathan Vanasco

Re: [pylons-discuss] Pyramid + SQLAlchemy + PostgreSQL: idle connections

2018-04-02 Thread Zsolt Ero
connection().engine.dispose() del dbsession Zsolt On 2 April 2018 at 17:54, Jonathan Vanasco <jvana...@gmail.com> wrote: > On Sunday, April 1, 2018 at 8:18:39 PM UTC-4, Zsolt Ero wrote: >> >> Hi Jonathan, >> >> I'm not 100% sure I understand when are you

Re: [pylons-discuss] Pyramid + SQLAlchemy + PostgreSQL: idle connections

2018-04-01 Thread Zsolt Ero
Hi Jonathan, I'm not 100% sure I understand when are you talking about the "standard" Pyramid way of the cookiecutter template's get_tm_session's implementation and when are you talking about my special addition of using the db to set up the app. I don't know how and when is a gunicorn process

Re: [pylons-discuss] Pyramid + SQLAlchemy + PostgreSQL: idle connections

2018-04-01 Thread Zsolt Ero
how can I benefit from including it? Zsolt On 1 April 2018 at 09:53, Zsolt Ero <zsolt@gmail.com> wrote: > Hi, > > I'm running Pyramid + SQLAlchemy + PostgreSQL in a "classic" sync stack > (like the cookiecutter one, pyramid_tm, etc.), simple gunicorn default > (pr

[pylons-discuss] Pyramid + SQLAlchemy + PostgreSQL: idle connections

2018-04-01 Thread Zsolt Ero
Hi, I'm running Pyramid + SQLAlchemy + PostgreSQL in a "classic" sync stack (like the cookiecutter one, pyramid_tm, etc.), simple gunicorn default (process) workers. I have a few problems (via pg_top or ps aux): 1. I'm getting about 2x the number of PostgreSQL connections as the number of

Re: [pylons-discuss] gevent/sqlalchemy/psycopg2/gunicorn setup?

2017-08-31 Thread Zsolt Ero
2017 16:34:36 UTC+2, Mikko Ohtamaa wrote: > > Hi, > > > On 31 August 2017 at 17:19, Zsolt Ero <zsol...@gmail.com > > wrote: > >> After reading zzzeek's great blog post: >> http://techspot.zzzeek.org/2015/02/15/asynchronous-python-and-databases/ >

[pylons-discuss] gevent/sqlalchemy/psycopg2/gunicorn setup?

2017-08-31 Thread Zsolt Ero
After reading zzzeek's great blog post: http://techspot.zzzeek.org/2015/02/15/asynchronous-python-and-databases/ and SO answer: https://stackoverflow.com/a/16503103/518169 I would like to use gevent / sqlalchemy / psycopg2 / gunicorn in a new application. All I've found for Pyramid is the old

[pylons-discuss] Re: pyramid and react working together?

2017-08-31 Thread Zsolt Ero
Yes, it works perfectly. The only interesting bit is integrating create-react-app's watch mode with Pyramid, or any classic backend for that matter, if you use server side routing. Not very complicated, but to set up watch mode, you need to: 1. Eject the app 2. Make it look for a different port

Re: [pylons-discuss] uWSGI logging issues with Pyramid

2017-01-20 Thread Zsolt Ero
I was thinking of that as well, but it implies using the same ini file, which I'd like to keep separate. On 2017. Jan 20., Fri at 17:56, Jonathan Vanasco wrote: > I think the command you want in uwsgi is `ini-paste-logged` instead of > `paste` > > >

Re: [pylons-discuss] uWSGI logging issues with Pyramid

2017-01-19 Thread Zsolt Ero
ons.html?highlight=paste-logger#paste-logger > > uWSGI doesn’t automatically pick up your fileConfig logging otherwise. > > (Basically unless you explicitly call fileConfig for your .ini right now > uWSGI doesn’t do anything with your logging handlers/information) > > > On

Re: [pylons-discuss] uWSGI logging issues with Pyramid

2017-01-19 Thread Zsolt Ero
ster ini file, how are you starting uWSGI? > > Bert > > On Jan 19, 2017, at 08:08, Zsolt Ero <zsolt@gmail.com> wrote: > > I believe this is uWSGI specific, and might even be a bug in uWSGI, but > since many people are using uWSGI with Pyramid here, I'd be interested to >

[pylons-discuss] uWSGI logging issues with Pyramid

2017-01-19 Thread Zsolt Ero
I believe this is uWSGI specific, and might even be a bug in uWSGI, but since many people are using uWSGI with Pyramid here, I'd be interested to know how did you solve it. I've migrated a project from Gunicorn to uWSGI. My problem is that my previously set-up file-based logging is all

Re: [pylons-discuss] Checking if a route is allowed

2016-11-11 Thread Zsolt Ero
rom Budapest is the van sharing service http://GoOpti.com . Been using them for years.  * there is a discussion on the sprint’s mailinglist about sharing an AirBNB place:  https://groups.google.com/forum/#!topic/dragonsprint/4Dew-8y6qMk Cheers, z. On 10 Nov 2016, at 23:53, Zsolt Ero < mailto:zsol

Re: [pylons-discuss] Checking if a route is allowed

2016-11-10 Thread Zsolt Ero
Thanks a lot! I'm thinking about it, since I'm quite close (in Budapest). On Thu, 10 Nov 2016 at 23:48 Mikko Ohtamaa < mailto:Mikko Ohtamaa > wrote: a, pre, code, a:link, body { word-wrap: break-word !important; } This might or might not work, but looks complicated

Re: [pylons-discuss] Checking if a route is allowed

2016-11-10 Thread Zsolt Ero
Thanks. So this is how my site is setup: I have a RootFactory: class RootFactory(object): __acl__ = [ (Allow, Authenticated, 'user'), (Allow, 'g:admin', 'admin'), (Allow, 'g:superadmin', 'ALL_PERMISSIONS'), ] def __init__(self, request): pass used

[pylons-discuss] Checking if a route is allowed

2016-11-10 Thread Zsolt Ero
Hi, I'd like to do the simplest possible thing in Pyramid / URL Dispatch, yet it seems almost impossibly hard to do it. So it's the super common case of having a menu, and I'd only like to insert menu items which are available for the current user. I'm looking for a function to fit in this

Re: [pylons-discuss] How to fix request.client_addr

2016-04-28 Thread Zsolt Ero
Thanks, that's a great howto, unfortunately, I'd need to compile nginx from sources to get that module. On 29 April 2016 at 03:03, Jonathan Vanasco wrote: > You can do this in nginx. > > Cloudflare publishes a list of trusted ips; the nginx set_real_ip module > will only

Re: [pylons-discuss] How to fix request.client_addr

2016-04-28 Thread Zsolt Ero
X-Forwarded-For > with the value of Cf-Connecting-Ip. > > Bert > > > On Apr 23, 2016, at 17:09, Zsolt Ero <zsol...@gmail.com > > wrote: > > > > I got a weird bug, in which request.client_addr was reported as > 192.168.76.75:52411, which broke a function which expected i

[pylons-discuss] How to fix request.client_addr

2016-04-28 Thread Zsolt Ero
I got a weird bug, in which request.client_addr was reported as 192.168.76.75:52411, which broke a function which expected it to be a standard IP address. In the documentation I've read that this could be anything, so I guess this isn't a surprise. I am using CloudFlare -> nginx -> gunicorn ->