Re: [pylons-discuss] Question about creating routes

2024-03-13 Thread Michael Merickel
Laurent, what error do you get? I'm not immediately aware of limitations around using lambdas in Pyramid. This example below works fine with a lambda as a view: from pyramid.config import Configurator from waitress import serve config = Configurator() config.add_route('foo', '/')

Re: [pylons-discuss] request for help upgrading the cookiecutter to support sqlalchemy 2.0

2024-02-05 Thread Michael Merickel
ys, wouldn't want to duplicate someone else's work). >> >> Laurent. >> >> >> Le lun. 29 janv. 2024 à 07:51, Michael Merickel a >> écrit : >> >>> Hey folks, >>> >>> I'd really appreciate it if someone was willing to take the time to &

[pylons-discuss] pyramid_debugtoolbar 4.12 released

2024-02-03 Thread Michael Merickel
pyramid-debugtoolbar 4.12 has been released. - Fixed annoying deprecation warnings on Pyramid 2.0. - Removed dependency on setuptools. Full change history: https://docs.pylonsproject.org/projects/pyramid_debugtoolbar/en/latest/changes.html You can install it via PyPI: pip install

[pylons-discuss] Enabling Github Discussions

2024-01-31 Thread Michael Merickel
Hey folks, I've enabled the discussions feature on the pyramid repository as an alternative form of communication if it simplifies communication for anyone. We shall see! https://github.com/Pylons/pyramid/discussions - Michael -- You received this message because you are subscribed to the

[pylons-discuss] request for help upgrading the cookiecutter to support sqlalchemy 2.0

2024-01-28 Thread Michael Merickel
Hey folks, I'd really appreciate it if someone was willing to take the time to upgrade the pyramid-cookiecutter-starter to use SQLAlchemy 2.0 best practices. Things like rewriting the queries away from Query to simple select(), and using the more modern declarative mapper that is typing

[pylons-discuss] pyramid-debugtoolbar 4.11 released

2024-01-27 Thread Michael Merickel
pyramid-debugtoolbar 4.11 has been released. - Added support for Python 3.12. - Added support for SQLAlchemy 2.x. Full change history: https://docs.pylonsproject.org/projects/pyramid_debugtoolbar/en/latest/changes.html You can install it via PyPI: pip install pyramid-debugtoolbar==4.11

[pylons-discuss] hupper 1.12.1 released

2024-01-26 Thread Michael Merickel
hupper 1.12.1 has been released. Full change history: https://docs.pylonsproject.org/projects/hupper/en/latest/changes.html You can install it via PyPI: pip install hupper==1.12.1 Enjoy, and please report any issues you find to the issue tracker at https://github.com/Pylons/hupper/issues

Re: [pylons-discuss] Re: Using SSL client certificate in a Pyramid application

2023-11-17 Thread Michael Merickel
You don’t need a signed header. You just need to make sure your proxy is configured to remove that header from an incoming request and only put validated data into it before sending it to your app. This is standard for other headers set by your proxy as well. Definitely never trust a header

Re: [pylons-discuss] Using SSL client certificate in a Pyramid application

2023-11-16 Thread Michael Merickel
Another example is that Envoy as a proxy supports adding the x-forwarded-client-cert header to your requests after it validates it.HTTP header manipulation — envoy 1.29.0-dev-bbb4e6 documentationenvoyproxy.io- MichaelOn Nov 15, 2023, at 13:25, Delta Regeer wrote:mod_ssl can stuff the information

Re: [pylons-discuss] Getting error when running inspect in python 3.11, win11

2023-11-14 Thread Michael Merickel
Just fyi there is a pull request on pastedeploy that patches the inspect issue on 3.12. I’m planning to get that released when I can find time this week. - Michael > On Nov 14, 2023, at 15:34, Laurent Daverio wrote: > > Glad to hear that, and many thanks for offering :) I'll let you know if

[pylons-discuss] Pyramid 2.0.2 released

2023-08-25 Thread Michael Merickel
Pyramid 2.0.2 has been released. This release fixes a security advisory affecting static views on Pyramid 2.0 and 2.0.1 installed on Python 3.11.x prior to 3.11.5. If this affects you, please read the changelog for more details! The full changelog is here:

[pylons-discuss] hupper 1.12 released

2023-04-02 Thread Michael Merickel
hupper 1.12 has been released. Full change history: https://docs.pylonsproject.org/projects/hupper/en/latest/changes.html You can install it via PyPI: pip install hupper==1.12 Enjoy, and please report any issues you find to the issue tracker at https://github.com/Pylons/hupper/issues Thanks!

[pylons-discuss] Pyramid 2.0.1 released

2023-01-29 Thread Michael Merickel
Pyramid 2.0.1 has been released. The full changelog is here: https://docs.pylonsproject.org/projects/pyramid/en/2.0-branch/changes.html What's New In Pyramid 2.0: https://docs.pylonsproject.org/projects/pyramid/en/2.0-branch/whatsnew-2.0.html 2.0 release documentation (across all alphas and

[pylons-discuss] hupper 1.11 released

2023-01-02 Thread Michael Merickel
hupper 1.11 has been released. Full change history: https://docs.pylonsproject.org/projects/hupper/en/latest/changes.html You can install it via PyPI: pip install hupper==1.11 Enjoy, and please report any issues you find to the issue tracker at

[pylons-discuss] pyramid_debugtoolbar 4.10 released

2023-01-02 Thread Michael Merickel
Pyramid Debugtoolbar 4.10 has been released. Full change history: https://docs.pylonsproject.org/projects/pyramid-debugtoolbar/en/latest/changes.html You can install it via PyPI: pip install pyramid_debugtoolbar==4.10 Enjoy, and please report any issues you find to the issue tracker at

[pylons-discuss] colander 2.0 released

2023-01-02 Thread Michael Merickel
colander 2.0 has been released. The full changelog is here: https://docs.pylonsproject.org/projects/colander/en/latest/changes.html Documentation: https://docs.pylonsproject.org/projects/colander/en/latest/ You can install it via PyPI: pip install colander==2.0 Enjoy, and please report any

Re: [pylons-discuss] SQLAlchemy 2.0 support

2022-11-24 Thread Michael Merickel
I'm unaware of any incompatibilities with SQLAlchemy 2.0 after reading the upgrade guide pretty extensively when I upgraded to 1.4. Nothing stood out in the changes to me that wouldn't work well with the existing pyramid_tm pattern. > On Nov 24, 2022, at 12:38, zsol...@gmail.com wrote: > >

[pylons-discuss] Re: plaster 1.1.1 and 1.1.2 released

2022-11-20 Thread Michael Merickel
Yeah ok, found another small thing and cut 1.1.2 as well. :-) Check out https://pypi.org/project/plaster/1.1.2/ for more info! - Michael > On Nov 20, 2022, at 19:26, Michael Merickel wrote: > > Hey folks, > > I've released 1.1.1 for plaster. This fixes a bug that seemed

[pylons-discuss] plaster 1.1.1 released

2022-11-20 Thread Michael Merickel
Hey folks, I've released 1.1.1 for plaster. This fixes a bug that seemed to affect folks on Fedora more than most. Check out https://pypi.org/project/plaster/1.1.1/ for more info! - Michael -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group.

Re: [pylons-discuss] plaster 1.1 and plaster_pastedeploy 1.0/1.0.1 released

2022-11-19 Thread Michael Merickel
Thanks for the info. This has been reported here https://github.com/Pylons/plaster/issues/25 and I've been trying to repro it. Something in the new release is not deduplicating things and just need to track that down and I'll get a fix out. :-) I have not yet had this happen in my envs but I

[pylons-discuss] plaster 1.1 and plaster_pastedeploy 1.0/1.0.1 released

2022-11-06 Thread Michael Merickel
Hey folks, I've released new versions of plaster and plaster_pastedeploy. The major changes to both libraries are: - Drop support for Python 2. - Drop dependencies on setuptools. Check out https://pypi.org/project/plaster/1.1/ and https://pypi.org/project/plaster-pastedeploy/1.0.1/ for more

[pylons-discuss] Re: PasteDeploy 3.0

2022-10-17 Thread Michael Merickel
I just released 3.0.1 now as well because 3.0 had the incorrect python_requires metadata which could cause problems on unpinned environments with older Python versions. I'm trying to pull the 3.0 release from PyPI if I can get access. On Sun, Oct 16, 2022 at 6:48 PM Michael Merickel wrote

[pylons-discuss] PasteDeploy 3.0

2022-10-16 Thread Michael Merickel
Hey folks, I just released PasteDeploy 3.0. There are only a couple small changes, but it felt safest to issue a major version bump just incase. The primary change is the removal of a dependency on setuptools by instead using importlib.metadata going forward. See the full changelog here:

Re: [pylons-discuss] How to pass a complex validation object to a forbidden view?

2022-08-29 Thread Michael Merickel
Yeah sorry I looked at the ISecurityPolicy after your comments and subclassing HTTPForbidden probably isn’t the best option in general because you don’t control all of its call sites. For your security policy you likely want to return a subclass of Denied and detect that in your forbidden view.

Re: [pylons-discuss] How to pass a complex validation object to a forbidden view?

2022-08-29 Thread Michael Merickel
You’re free to subclass HTTPForbidden or just extend it. You can also subclass Denied as you noted. The big question to me is whether you can control the generation of that object to use the subclass and off the top of my head I think it’s always done in user code right now if you’re using the

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

2022-08-17 Thread Michael Merickel
I think it's worth noting that zope.sqlalchemy's session registration supports a "readonly" initial state, similar to active and changed that we've all harped on in the past. I'd probably just look into using that and sticking with existing patterns. If you go all-in on readonly as a pattern I

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

2022-08-16 Thread Michael Merickel
transaction.doom() is a good way. Another is to register a commit_veto hook in pyramid_tm. It is a hook that is invoked any time it would be about to commit, giving you a chance to stop it. Advantage of the veto is that you can register it from settings globally. - Michael > On Aug 16, 2022,

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

2022-08-11 Thread Michael Merickel
As Laurent said, if I were starting from scratch a new project I would personally use the pyramid-cookiecutter-starter sqlalchemy and then rip out what I didn’t need but only one part of that cookie cutter is the ORM. It has several other features that you need to solve one way or another so

Re: [pylons-discuss] Pyramid Response with File-like .write() interface

2022-08-09 Thread Michael Merickel
This harkens back to the discouraged write() callable in WSGI PEP returned by the start_response() invocation. The PEP as well as Pyramid as a framework would encourage you to map the logic into an app_iter as Bert suggested. I think you'll want to define a file-like object that you can

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

2022-06-08 Thread Michael Merickel
Well I might have answered too hastily. Seems the first process is controlled by fabric and not virtualenv. - Michael > On Jun 8, 2022, at 19:23, Michael Merickel wrote: > > I doubt you’ll have the same problem with “python -m pyramid.scripts.pserve > dev_admin.ini” but w

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

2022-06-08 Thread Michael Merickel
I doubt you’ll have the same problem with “python -m pyramid.scripts.pserve dev_admin.ini” but would be good to find out. The process list appears to be due to the virtualenv wrapper around a console script which this should skip. - Michael > On Jun 8, 2022, at 15:31, 'Jonathan Vanasco' via

Re: [pylons-discuss] Waitress and multiprocess pooling

2022-05-23 Thread Michael Merickel
Mikko, What is your gunicorn config? > > On May 23, 2022, at 04:52, Mikko Ohtamaa wrote: > >  > Hi all, > > Thank you for your kind support. > > We have been running a Gunicorn for half a week now and you can clearly where > we switched over, as the request latency is much more stable

Re: [pylons-discuss] Waitress and multiprocess pooling

2022-05-19 Thread Michael Merickel
Mikko, The best agnostic impl I know for url prefix is the PasteDeploy prefix middleware. https://docs.pylonsproject.org/projects/pastedeploy/en/latest/modules/config.html#paste.deploy.config.PrefixMiddleware You can mount it in your ini pipeline pretty easily: [pipeline:main] pipeline =

Re: [pylons-discuss] Downsides of committing by default?

2022-05-02 Thread Michael Merickel
My understanding is that it’s a micro optimization that a rollback is slightly more efficient than a commit. I’m not aware of any good arguments against defaulting to changed. Would need to ask the zope.sqlalchemy folks for some insights. - Michael > On May 2, 2022, at 17:55, Theron Luhn

Re: [pylons-discuss] pyramid-jinja2 2.9.1 has been released

2022-03-14 Thread Michael Merickel
Hey folks, egg on my face. I hadn't realized that some of the changes required upgrading to Jinja 3. I have "yanked" the release for now which means you will receive a warning if you install this version from PyPI. We need to re-evaluate the minimum dependencies and determine how to release

Re: [pylons-discuss] Programmatically creating and closing Waitress server: OSError: [Errno 9] Bad file descriptor

2022-01-24 Thread Michael Merickel
Mikko, Have you looked at the StopableWSGIServer in webtest? I wonder if it can help debug what you've been seeing. https://docs.pylonsproject.org/projects/webtest/en/latest/api.html#webtest.http.StopableWSGIServer

Re: [pylons-discuss] Plaster status

2022-01-08 Thread Michael Merickel
plaster and plaster_pastedeploy are around and maintained. :-) > On Jan 7, 2022, at 09:26, Stéphane Brunner > wrote: > > Hello, > > Pyramid depends on plaster: > https://github.com/Pylons/pyramid/blob/master/setup.py#L29-L30 > But the alt commits of plaster and plaster_pastdeploy >

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

2021-12-13 Thread Michael Merickel
The linked waitress docs do work. I deploy waitress behind nginx and envoy and heroku regularly using the guides in there. Make sure to configure the trusted proxy settings and ensure the upstream is setting the right headers. - Michael > On Dec 13, 2021, at 18:22, Jens Troeger wrote: > >

Re: [pylons-discuss] Strange problem with request method

2021-10-11 Thread Michael Merickel
I think there's a lot of unknowns in helping unpack this - for starters there's no code supplied that actually modifies the cache, so of course it is empty! - There's a few gotchas in python - for example if this is done in the main file in your app (foo.py) and you run "python -m foo" then the

Re: [pylons-discuss] Could not find a matching loader for the scheme "file+ini ", protocol "wsgi"?

2021-09-09 Thread Michael Merickel
Do you have plaster_pastedeploy installed? - Michael > On Sep 9, 2021, at 02:28, Simon wrote: > >  > Hi there, > > I got an error about 'could not find a matching loader for the scheme' when I > want to run my Pyramid web app in PyCharm based on Pyramid server. However, > if I directly run

Re: [pylons-discuss] session.close() no longer needed or even never needed?

2021-09-01 Thread Michael Merickel
Unfortunately there's no "right" answer to the situation, it all depends on how you choose to manage database connections in your app. It's hard to answer whether what you're doing now is correct or not without knowing more - you can have pyramid_tm enabled in your app and not actually use it.

Re: [pylons-discuss] Serving large authenticated files

2021-07-14 Thread Michael Merickel
I have some scenarios where I need to do some processing (envelope decryption) on a file from s3 prior to download and then let the user download it and this is how I do it as well. 1. Download giant file from S3 to temporary file. 2. Process file to another temporary file. 3. Return a

Re: [pylons-discuss] modifying database in webtest based testing

2021-06-24 Thread Michael Merickel
If you have the app, the registry is attached as "app.registry" and you can use the underlying prepare() method with it, same as bootstrap does. See https://docs.pylonsproject.org/projects/pyramid/en/latest/api/scripting.html#pyramid.scripting.prepare

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

2021-05-24 Thread Michael Merickel
CSRF has nothing to do with authentication other than that you should rotate it at login/logout privilege boundaries at the very least. You can use the CSRF system without configuring a security/auth policy at all. - Michael > On May 24, 2021, at 14:40, Zsolt Ero wrote: > > Hi Theron, > >

Re: [pylons-discuss] Is there a way to hook into the queue depth warning?

2021-05-21 Thread Michael Merickel
It's using the python stdlib logging library. You can add a handler to that logger that sends emails or does anything else. It really depends on how you're running your processes how to setup logging properly but in Pyramid (which uses logging.config.fileConfig) it would be done by adding

Re: [pylons-discuss] Use route_url just after the routes are added and without request

2021-05-12 Thread Michael Merickel
At that config-time in the application there is no active request and no server running. In Pyramid, all url-generation APIs rely on creating a url "relative to the wsgi environ" or "relative to the current request". This keeps the app itself easy to mount into complex existing url hierarchies.

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

2021-05-10 Thread Michael Merickel
The permission strings are arbitrary. For examples that are using ACLs (like the wiki tutorials) the only requirement is that the strings should match up to ACL entries that you are generating on your context objects. Pyramid does not care about the values of the strings and you could use

Re: [pylons-discuss] Pyramid 2.0: Only venusian callbacks with category 'pyramid' are called by default

2021-03-12 Thread Michael Merickel
have either call config.scan with all the categories used >>> by your product and all the packages you include or set categories=None >>> when calling the config.scan(). >>> >>> So is there a reason for this change, because it causes some issues when >&g

[pylons-discuss] Pyramid 2.0 released

2021-02-28 Thread Michael Merickel
Yay, Pyramid 2.0 is out. Get it while it's hot! If you're able to run 1.10.8 without deprecation warnings then you're in a great spot to upgrade. Several warnings were added to 1.10.x releases to help you prepare. There's shockingly few backward-incompatible changes in this release, so don't

[pylons-discuss] Pyramid 1.10.8 released

2021-02-28 Thread Michael Merickel
Pyramid 1.10.8 has been released. This release fixes a warning with using the deprecated "imp" module on newer versions of Python. The full changelog is here: https://docs.pylonsproject.org/projects/pyramid/en/1.10-branch/changes.html What's New In Pyramid 1.10:

[pylons-discuss] Pyramid 1.10.7 released

2021-02-20 Thread Michael Merickel
Pyramid 1.10.7 has been released. Whoops, had one remaining PR that hadn't been merged in 1.10.6. - Fixed an issue where reified properties would show up as functions in certain tools instead of attributes. The full changelog is here:

Re: [pylons-discuss] Pyramid 2.0b1 released

2021-02-20 Thread Michael Merickel
don't need to use it. - Michael > On Feb 20, 2021, at 17:39, Mike Orr wrote: > > On Sat, Feb 20, 2021 at 12:57 PM Michael Merickel wrote: >> Check out the new pattern of storing the request in the SQLAlchemy session >> object for easier access in your model layer without thre

[pylons-discuss] Pyramid 2.0b1 released

2021-02-20 Thread Michael Merickel
Pyramid 2.0b1 has been released. - Fixes a circular reference / memory leak between request and context in some apps. - A bunch of documentation and cookiecutter improvements. Check out the new pattern of storing the request in the SQLAlchemy session object for easier access in your model

[pylons-discuss] Pyramid 1.10.6 released

2021-02-20 Thread Michael Merickel
Pyramid 1.10.6 has been released. - Deprecated pyramid.compat so that apps can prepare more easily for their upgrade to 2.0. - Fixed a potential memory leak in which a circular reference between context and request may rely on the garbage collector to clean up. The full changelog is here:

Re: [pylons-discuss] Cornice / Colander design for file upload

2021-02-08 Thread Michael Merickel
To me it just kind of depends on what level of atomicity you need in your API endpoint. If you can accept the binary data without any other parameters then that's great, just do that. If you need it alongside other input then multipart is great. Some people also marshal that stuff in x-foo

Re: [pylons-discuss] testing users with webtest

2021-02-08 Thread Michael Merickel
On Feb 8, 2021, at 18:38, zsol...@gmail.com wrote: > > There are a few things which are confusing me here: > 1. I can remove get_cookie and get_csrf_token and just hard-code > 'dummy_csrf_token' into login / post(), and it still works. Am I missing > something here? The

[pylons-discuss] Pyramid 2.0b0 released

2020-12-15 Thread Michael Merickel
This is likely the last release prior to 2.0, pending any bug reports from users. We've updated the cookiecutter, improved the fixtures and security examples, and tutorials. As such, I'm happy to announce 2.0b0. Read the "What's New in Pyramid 2.0" document for a comprehensive list of changes

Re: [pylons-discuss] Poetry and Pyramid

2020-12-13 Thread Michael Merickel
I cooked up a pyproject.toml that almost works like the setuptools version for the Pyramid scaffold. There is one minor difference in which files are included in the sdist versus wheel, but it's an open bug in poetry to fix. You simply use this file in your project, then do things like `poetry

Re: [pylons-discuss] Pyramid authentication callback not being called

2020-12-13 Thread Michael Merickel
The groupfinder is only invoked on requests that check authentication information. For example a view with a "permission=..." constraint or when calling request.authenticated_userid, or request.has_permission(...). It is not invoked for every request. - Michael > On Dec 12, 2020, at 11:40,

Re: [pylons-discuss] Testing advise

2020-12-06 Thread Michael Merickel
The "recommended" approach for doing this would be to create a DummyRequest and then use its route_url, etc methods. This will allow you to use Pyramid's actual url generation apis instead of re-implementing them yourself, as well as avoiding needing to use the private route mapper. req =

[pylons-discuss] Pyramid 2.0a0 released

2020-11-29 Thread Michael Merickel
Alright folks, it's been a long time coming but we're here - the first alpha of Pyramid 2.0. There's shockingly few backward-incompatible changes in this release, so don't let it scare you. There IS a laundry list of new features. Here are a few highlights: - First release to drop Python 2,

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

2020-11-12 Thread Michael Merickel
Webob "request" objects are semi-ephemeral in the context of WSGI. Pyramid creates one while processing, and if you're using pyramid_retry then it'll make a new one for each attempt. The "environ", however, is one-per WSGI request and state you put in there will survive for the entire WSGI

[pylons-discuss] Pyramid 1.10.5 released

2020-11-08 Thread Michael Merickel
Hey folks, It's been a while! Pyramid 1.10.5 has been released. It includes super minor changes, but helps by adding a warning related to a backward-incompatible change in 2.0 related to the AuthTkt authentication cookies. As a point of order, an alpha of 2.0 is coming probably in this next

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

2020-10-12 Thread Michael Merickel
There is a null_renderer in Pyramid, but it's not available via render_to_response. I do not see a code path that would return anything other than an object implementing pyramid.interfaces.IResponse (the expected return value from the app's configured IResponseFactory). This is, of course,

Re: [pylons-discuss] Waitress connection cleanup

2020-10-08 Thread Michael Merickel
If a client hangs up then there's no problems, the issue that is being referenced is about unused, idle, connections that are taking up space that counts toward the limit (because while they are idle, a client could send data over it at any moment). The cleanup interval, etc is around how

Re: [pylons-discuss] Newbie Questions About Waitress Channels

2020-10-05 Thread Michael Merickel
The only default I've really changed on waitress in most apps I've written has been the number of threads. On Heroku I also configure waitress to understand the forwarding headers (see trusted_proxy docs) so that client data shows up properly in the WSGI app. I would not worry about these

Re: [pylons-discuss] Newbie Questions About Waitress Channels

2020-10-05 Thread Michael Merickel
The connection limit dictates how many individual tcp connections waitress will handle at a time, and while those are alive (until client hangs up or idle channel timeout) no other connections will be made. The backlog is a signal to the OS to not outright reject connections even if waitress is

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

2020-09-19 Thread Michael Merickel
`remember` is an authentication api and not directly tied to sessions. It does support kwargs that the authentication policy can utilize as it chooses. Your question is about sessions, and the session cookie. It is up to pyramid_session_redis how it chooses to set the cookie, Pyramid does not

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

2020-08-31 Thread Michael Merickel
/master/src/webob/cookies.py> > > > In terms of Pyramid versions, if you need Python2 support - 1.10 is your only > option. Otherwise, just pay attention to the deprecations on Pyramid2 and > you should be able to transition from 1.10 to 2 very easily if you don't want > to ru

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

2020-08-29 Thread Michael Merickel
Are you trying to host the apps in the same process? Where do you want certain shared parts to live as you migrate? In Pyramid code? In Flask code? Agnostic? Option 1: If you want Pyramid to be able to use any Flask code then you'll have to likely setup Flask's threadlocal variables / request

Re: [pylons-discuss] Waitress how setup channel_timeout and max size limits

2020-05-20 Thread Michael Merickel
Yeah it's possible for the channel / socket to close (client hangup, channel timeout, etc) while the WSGI app is still processing the request. The WSGI execution thread will have no idea until it tries to actually write the response at which point an exception may be raised but this is usually

Re: [pylons-discuss] Waitress how setup channel_timeout and max size limits

2020-05-20 Thread Michael Merickel
Waitress is a threaded WSGI server and there isn't a safe way to kill threads inside of a process while they are blocked executing synchronous code. Even if the underlying channel is closed, the thread continues until the request is completed processing and then the response is simply discarded

Re: [pylons-discuss] WebSocket Integration

2020-05-13 Thread Michael Merickel
This looks awesome! Things that aren’t clear to me are how the config and potentially other services / settings are shared as well as authentication and data store connections. And what the pitfalls may be there. It looks like it’s using asgiref so I assume you are supposed to use its

Re: [pylons-discuss] Python 3.8 and __init__.py in views directory

2020-03-25 Thread Michael Merickel
Sorry can you give more context? Did you delete the __init__.py in your views folder? If so, I would expect some issues. > On Mar 24, 2020, at 22:12, Sydo Luciani wrote: > > No problem with python 3.5 environment, but missing views/__init__.py, throws > below errors in Python 3.8. > > Even

Re: [pylons-discuss] Saving a lot of data to Postgresql database in Pyramid using SQLAlchemy

2020-03-20 Thread Michael Merickel
dbsession.add on each row is pretty much worse case scenario. Start with https://docs.sqlalchemy.org/en/13/_modules/examples/performance/bulk_inserts.html which shows you how to use

Re: [pylons-discuss] Serving a Single File from the Root

2020-03-14 Thread Michael Merickel
The unicode issue is just due to opening the file in unicode mode (the default in python 3) and then setting the result to body (which expects bytes). Modify the open calls to use open(..., 'rb') and it should work. > On Mar 14, 2020, at 11:16, Sydo Luciani wrote: > > Procedure to serve

Re: [pylons-discuss] Trying to execute console_scripts in web browser (with nginx and uwsgi)

2020-03-03 Thread Michael Merickel
han uwsgi to run my app. > > Thank you Michael. > > > Em terça-feira, 3 de março de 2020 15:40:42 UTC-3, Michael Merickel > escreveu: >> >> I suspect it's something to do with UWsgi doing funky things with fork >> and subprocesses. For example >> https:/

Re: [pylons-discuss] Trying to execute console_scripts in web browser (with nginx and uwsgi)

2020-03-03 Thread Michael Merickel
point, since the call to the script is being made > directly now, but I always got the same error. > > Please, do you known what I'm doing wrong? > > Thank you. > > Emerson > > > Em quinta-feira, 27 de fevereiro de 2020 21:28:04 UTC-3, Michael Merickel > escr

Re: [pylons-discuss] Trying to execute console_scripts in web browser (with nginx and uwsgi)

2020-02-27 Thread Michael Merickel
Your environment isn't modifying the env PATH, which is what Popen is relying on to find the script. It'd be better not rely on the PATH and instead just run the code using `python -m foo`, but that doesn't actually work with console scripts. You would instead do

Re: [pylons-discuss] pyramid_tm - is there an acceptable way to unjoin the transaction and use explicit commits?

2020-02-09 Thread Michael Merickel
stom transaction adapter to get a Redis session > attached to the transaction. Since Redis is non-transactinal, t saves > its pending work in the object, and on commit it writes it to the > database. > > On Fri, Feb 7, 2020 at 9:04 AM Michael Merickel > wrote: > > >

Re: [pylons-discuss] pyramid_tm - is there an acceptable way to unjoin the transaction and use explicit commits?

2020-02-07 Thread Michael Merickel
pyramid_tm does have a configurable activate_hook that you can use to turn off the TM for certain endpoints. You would need to coordinate that with something else that managed the transaction. If I were doing it myself I'd probably configure my activate hook to return true/false based on an custom

Re: [pylons-discuss] Re: tracking down a test issue - ResourceWarning: unclosed file <_io.BufferedRandom

2020-02-05 Thread Michael Merickel
If you're opening files you should use the context manager - for example: with request.POST['file'] as field: data = field.file.read() On Tue, Feb 4, 2020 at 3:53 PM Jonathan Vanasco wrote: > After even more testing (half my day!)... > > My app needed an `add_finished_callback` to close

Re: [pylons-discuss] upgraded to 1.4.2 and requests got stuck (load 1.0)

2020-01-09 Thread Michael Merickel
I've been using 1.4.2 in production on heroku with 5 Standard-1X dynos and have not observed this issue across a decent amount of traffic. That being said we'll probably need more info to go on than your observations so far to reproduce or turn it into any sort of bugfix. I'm not really sure what

Re: [pylons-discuss] Confused accessing db sessions

2020-01-06 Thread Michael Merickel
This is a super common complaint from people and it doesn't have a single definitive solution. There are a couple handy tricks: 1. If your classmethod receives any managed objects, you can get a reference to the session from the object itself. For example ``sqlalchemy.orm.object_session(user)``.

[pylons-discuss] pyramid_tm 2.4 has been released

2020-01-06 Thread Michael Merickel
pyramid_tm 2.4 has been released. This is a very minor release in preparation for Pyramid 2.0 but contains a handy hook for testing and some info on how to override pyramid_tm in a functional test suite. PyP/Changelog: https://pypi.org/project/pyramid_tm/2.4/ Documentation:

Re: [pylons-discuss] question regarding url dispatch with very similar routes

2019-12-19 Thread Michael Merickel
You didn't make it completely clear what you're doing with your view_config but I assume it's something to do with the match_param predicate after your factory updates the matchdict. That's fine, and you could use it to annotate the request with another attribute and then write a custom predicate

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

2019-10-21 Thread Michael Merickel
It's worth pointing out that while WSGI apps in general have that issue, webob (and thus pyramid apps) automatically handle this. 1) webob automatically truncates the body on a head request. 2) pyramid automatically configures any view that takes `request_method='GET'` to also take HEAD and

Re: [pylons-discuss] waitress - customer headers

2019-10-15 Thread Michael Merickel
If you can see the header in a flask app served with gunicorn but not in the same app using waitress then the answer is likely related to the actual content of the request and header so you probably need to provide a reproducible example. I think the current dummy example you're showing is

Re: [pylons-discuss] Adding functionality to the core

2019-09-19 Thread Michael Merickel
My personal feeling is most things that can be done out of core should be done out of core, but if new hooks or functionality is needed in core to accomplish that then we should consider adding it. The only exceptions are things that seem clear to affect a large percentage of the community or

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

2019-08-08 Thread Michael Merickel
pyramid.exceptions.PredicateMismatch is a subclass of HTTPNotFound and thus a generic 404 handler (notfound_view_config) will catch it. You can define an exception_view_config specifically for PredicateMismatch if you wish to be more specific but most people would let it fall through to the 404

Re: [pylons-discuss] Docs page down?

2019-07-30 Thread Michael Merickel
Thanks Brian, it seems to be related to RTD being down right now. https://twitter.com/readthedocs/status/1156337277640908801 On Tue, Jul 30, 2019 at 7:07 PM Brian Connor wrote: > Hi all. Thanks for the great docs and tutorials. I've been enjoying > learning the framework, though I've been

Re: [pylons-discuss] Protecting a single view with permission based on context

2019-07-25 Thread Michael Merickel
Does the permission actually need to change or can the context object just return an appropriate ACL based on its state? If you can have the context object be smarter then problem solved with a single permission. Otherwise yes you can certainly just handle it imperatively in the view code. On

Re: [pylons-discuss] waitress: can not see the 4 default threads

2019-07-18 Thread Michael Merickel
processes != threads, it looks like you're thinking that waitress is using processes based on your suggestion that you think os.getpid() should return something different, or that you can't see them being started. - Michael On Thu, Jul 18, 2019 at 2:54 PM Philip May wrote: > In the waitress

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

2019-06-07 Thread Michael Merickel
On Fri, Jun 7, 2019 at 2:38 AM Jens Troeger wrote: > The recent OAuth thread > > recommends requests-oauthlib > … Can you recommend any > particular package, is the that one good?

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

2019-06-03 Thread Michael Merickel
On Mon, Jun 3, 2019 at 8:59 PM Jens Troeger wrote: > I’ve been using Velruse quite > happily for a while now, although it’s been stale for a few years. > MichaelM was somewhat active on that > project too, and he still seems to

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

2019-04-27 Thread Michael Merickel
The session and sessionmaker are only necessary if you want to hook into pyramid_tm, because zope.sqlalchemy requires a session object and won't work with a simple connection. That being said, I would want to such that pyramid_tm handles the commits for you. That being said, you might abstract

[pylons-discuss] Pyramid 1.10.4 released

2019-04-15 Thread Michael Merickel
Hey folks, I just released 1.10.4. This simply fixes a performance regression introduced in 1.10.3 related to the view_config decorator. Check the "What's New in Pyramid 1.10" for more information about 1.10: https://docs.pylonsproject.org/projects/pyramid/en/1.10-branch/whatsnew-1.10.html As

[pylons-discuss] Pyramid 1.10.3 released

2019-04-11 Thread Michael Merickel
Hey folks, I just released 1.10.3. The changes are small but it does add the ignore_files setting to [pserve] which some people may appreciate. Check the "What's New in Pyramid 1.10" for more information about 1.10.2:

Re: [pylons-discuss] a library for building config stores

2019-04-05 Thread Michael Merickel
Pyramid uses plaster to load files and hasn't depended on ini directly since 2017. See https://docs.pylonsproject.org/projects/pyramid/en/1.9-branch/whatsnew-1.9.html#major-feature-additions. Granted all tutorials etc still use plaster_pastedeploy as the primary connector, but anyone is free to

Re: [pylons-discuss] is there a standardized way of detecting the environment (e.g. bootstrap)

2019-03-20 Thread Michael Merickel
a bit. > > > On Wednesday, March 13, 2019 at 3:53:54 PM UTC-4, Michael Merickel wrote: >> >> No bootstrap does not inject any custom settings or anything into the app. >> >> On Wed, Mar 13, 2019 at 2:33 PM Jonathan Vanasco >> wrote: >> >&g

  1   2   3   4   5   6   7   >