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

2018-03-06 Thread Michael Merickel
Pyramid only generates urls in the format ://://?#. Your proposed scheme is attempting to marshal all of the data through the anchor. The general idea of such a url that puts the query string in the anchor is to hide that data from the server (anchors are not sent along with requests, they are

Re: [pylons-discuss] Using pyramid + pyramid_simpleform + formencode + sqlalchemy ?

2018-04-08 Thread Michael Merickel
Validation libraries tend to have a way to pass some user-defined state down through the validators. It looks like in formencode you can do this as well via the state argument [1]. You would likely want to pass a dict down containing either the request or the dbsession and then your validators can

[pylons-discuss] Pyramid 1.9.2 released

2018-04-23 Thread Michael Merickel
Pyramid 1.9.2 has been released. The full changelog is here: https://docs.pylonsproject.org/projects/pyramid/en/1.9-branch/changes.html What's New In Pyramid 1.9: https://docs.pylonsproject.org/projects/pyramid/en/1.9-branch/whatsnew-1.9.html 1.9 release documentation (across all alphas and

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

2018-04-02 Thread Michael Merickel
Using the pyramid-cookiecutter-alchemy setup you can access config data at config time using a pattern like this: from transaction import TransactionManager from myapp.models import get_tm_session def main(global_config, **settings): config = Configurator(settings=settings)

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

2018-04-02 Thread Michael Merickel
it > manager protect us from? > > Zsolt > > > On 2 April 2018 at 20:11, Michael Merickel <mmeri...@gmail.com> wrote: > > Using the pyramid-cookiecutter-alchemy setup you can access config data > at > > config time using a pattern like this: > >

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

2018-04-02 Thread Michael Merickel
tence, I'm not sure I understand it. If I'm always > using request.dbsession, by definition I'm protected, to a request's > lifecycle am I not? > > Zsolt > > On 2 April 2018 at 21:47, Michael Merickel <mmeri...@gmail.com> wrote: > > The forking issue is likely because

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

2018-04-02 Thread Michael Merickel
zedb.py like this, as most new users would probably > go through the same path as I did. > > Zsolt > > > > > On 2 April 2018 at 23:18, Michael Merickel <mmeri...@gmail.com> wrote: > > You almost never want to use "with request.tm". This cannot

Re: [pylons-discuss] Getting Nginx + uWSGI + Pyramid working

2018-03-01 Thread Michael Merickel
_permissions/production.ini') This command is almost exactly what uwsgi is doing to load your code and it will fail with the same DistributionNotFound error you're seeing. - Michael On Thu, Mar 1, 2018 at 10:40 AM, Michael Merickel <mmeri...@gmail.com> wrote: > The DistributionNotFound er

Re: [pylons-discuss] Overriding view declaration

2018-02-28 Thread Michael Merickel
https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/advconfig.html#automatic-conflict-resolution Basically if each view is registered from some call within a config.include'd function then if you establish an appropriate include-chain then you can override one call from the other. def

Re: [pylons-discuss] Getting Nginx + uWSGI + Pyramid working

2018-03-01 Thread Michael Merickel
The DistributionNotFound error basically always means that your code is not installed into the virtualenv being used by uwsgi. In this case it's /srv/venv. You should ensure that you've run /srv/venv/bin/pip install appropriately. - Michael On Thu, Mar 1, 2018 at 5:57 AM, Darren Jones

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

2018-04-26 Thread Michael Merickel
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. Anyway, this is how subrequests work - they are isolated. They do have an odd feature that sort of lets you merge

[pylons-discuss] Pyramid 1.10a1 released

2018-10-15 Thread Michael Merickel
Pyramid 1.10a1 has been released. The full changelog is here: https://docs.pylonsproject.org/projects/pyramid/en/1.10-branch/changes.html What's New In Pyramid 1.10: https://docs.pylonsproject.org/projects/pyramid/en/1.10-branch/whatsnew-1.10.html 1.10 release documentation (across all alphas

[pylons-discuss] Pyramid 1.8.6 and 1.9.3 released

2018-10-31 Thread Michael Merickel
Hey folks, I just released new bugfix versions - Pyramid 1.8.6 and 1.9.3. Check the "What's New in Pyramid 1.9" for more information about 1.9.1: https://docs.pylonsproject.org/projects/pyramid/en/1.9-branch/whatsnew-1.9.html Check the "What's New in Pyramid 1.8" for more information about

[pylons-discuss] Pyramid 1.10 released

2018-10-31 Thread Michael Merickel
Pyramid 1.10 has been released. This is the last planned release on the 1.x series, other than bug fixes and user contributed features to the 1.x-master branch. Expect Pyramid 2.x to support only Python 3+ (minor version to be determined). Pyramid's releases contain python_requires metadata

[pylons-discuss] Pyramid 1.10b1 released

2018-10-27 Thread Michael Merickel
Pyramid 1.10b1 has been released. Pending any unforeseen issues, expect the final build in a few days. 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.1 released

2018-11-06 Thread Michael Merickel
Pyramid 1.10.1 has been released. This is a very minor bugfix release fixing a regression in 1.10. Expect Pyramid 2.x to support only Python 3+ (minor version to be determined). Pyramid's releases contain python_requires metadata which will cause pip and other compliant tools to install only the

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

2018-11-12 Thread Michael Merickel
On Mon, Nov 12, 2018 at 4:29 AM Mikko Ohtamaa wrote: > > https://stackoverflow.com/questions/15593516/how-to-run-a-script-after-pyramids-transaction-manager-has-returned > > Please not that thread local `transaction.manager` might be discouraged > nowadays, but not sure what is the best practice

Re: [pylons-discuss] Understanding how to perform functional testing using transactions with pyramid + SQLAlchemy + pytest + webtest for views that use a postgreSQL database.

2018-11-06 Thread Michael Merickel
Andi, I think this is a fantastic approach. The key here is to override request.dbsession to a mocked out version which is not connected to pyramid_tm at all, giving you full control of commit/rollback from the outside. One extra step would be to disable pyramid_tm entirely by setting

Re: [pylons-discuss] Store class at process start, and use it to initiate inside function?

2018-10-07 Thread Michael Merickel
This sounds like an application-global object. These are typically stored on the registry at config-time. For example, in your main you could set config.registry.foo = contract. The registry is available as request.registry and subsequently anything you add to it. You can see lots of examples of

Re: [pylons-discuss] Store class at process start, and use it to initiate inside function?

2018-10-08 Thread Michael Merickel
As far as defining an object as read-only, there is nothing specific to Pyramid here and you'll have to find a satisfactory solution in the rest of Python world. On Mon, Oct 8, 2018 at 11:20 AM Lukasz Szybalski wrote: > > > On Sunday, October 7, 2018 at 12:59:58 AM UTC-5, Michael Meri

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

2018-09-02 Thread Michael Merickel
> > You are talking about these two lines of code > > in > the cookiecutter’s model/__init__.py,

Re: [pylons-discuss] Depricate CallbackAuthenticationPolicy?

2018-09-24 Thread Michael Merickel
Adam, I'd be interested in reviewing a PR that (at least) docs-deprecated the feature. By this I mean removing most info about it from the docs and pointing people at the subclassing approach - but without actually changing the code. I've already changed at least one example in the Pyramid docs to

Re: [pylons-discuss] Depricate CallbackAuthenticationPolicy?

2018-09-25 Thread Michael Merickel
On Tue, Sep 25, 2018 at 10:09 AM Mike Orr wrote: > On Mon, Sep 24, 2018 at 3:21 PM Michael Merickel > wrote: > > We'd deprecate it in 1.10 and remove it in 2.0 as we're planning to do > with pickle-based sessions [2]. > > Why are pickle-based sessions being removed? I sw

Re: [pylons-discuss] Depricate CallbackAuthenticationPolicy?

2018-09-25 Thread Michael Merickel
On Tue, Sep 25, 2018 at 10:51 AM Mike Orr wrote: > Is there a timeline for Pyramid 2? 2018 or 2019? > There is not a timeline... probably first half of 2019 but it depends on who contributes what when. -- You received this message because you are subscribed to the Google Groups

Re: [pylons-discuss] Creating a request copy?

2019-01-15 Thread Michael Merickel
There is no supported way to deep copy a general request object. Instead I would suggest copying the headers/body directly and replaying the request through the router as part of your simulations. On Tue, Jan 15, 2019 at 4:09 AM Thierry Florac wrote: > Hi, > Simple question: I have a use case

Re: [pylons-discuss] Store class at process start, and use it to initiate inside function?

2018-12-11 Thread Michael Merickel
:11:55 PM UTC-6, Lukasz Szybalski > wrote: >> >> >> >> On Monday, October 8, 2018 at 12:10:20 PM UTC-5, Michael Merickel wrote: >>> >>> If you are doing loading of data at "first run of the function" then you >>> have introduced a ra

Re: [pylons-discuss] Security Headers + Extras Project

2018-12-10 Thread Michael Merickel
On Mon, Dec 10, 2018 at 12:21 PM Bert JW Regeer wrote: > Pyramid also by default supports all of the "secure" parts of the cookie. > There are no extra flags that can't already be set using Pyramid. > > Using the Secure package for cookies is unnecessary. > I imagine the benefit is less for

Re: [pylons-discuss] Security Headers + Extras Project

2018-12-10 Thread Michael Merickel
across requests. On Mon, Dec 10, 2018 at 2:55 PM Michael Merickel wrote: > On Mon, Dec 10, 2018 at 12:21 PM Bert JW Regeer wrote: > >> Pyramid also by default supports all of the "secure" parts of the cookie. >> There are no extra flags that can't already be set using Pyr

Re: [pylons-discuss] Re: Pyramid Registry Creates Too many connections To the Same Server with pysimplesoap

2018-11-17 Thread Michael Merickel
The pyramid registry is effectively a singleton. There is only one per Pyramid app. Thus, from your example code, you're creating 10 persistent soap connections per instance of the app. If you're forking the server or anything then this may explode the way you're describing. You need to come up

Re: [pylons-discuss] Documentation for error messages

2019-01-09 Thread Michael Merickel
The error is basically saying that you aren't passing a valid path to your wsgi app. See the bottom of https://docs.pylonsproject.org/projects/waitress/en/latest/usage.html for some waitress-serve examples. On Wed, Jan 9, 2019 at 6:37 AM Steve Piercy wrote: > There is code in Waitress that

Re: [pylons-discuss] Re: Waitress 1.2.0 beta 1

2019-01-02 Thread Michael Merickel
I suspect you can ignore the warning and that it is a bug. It seems likely that this [1] should be "if data and not self.logged_write_no_body" to avoid warning when the body is missing on a response that may contain a body? [1]

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] Check if a user can access a particular view

2019-02-20 Thread Michael Merickel
Just to expand on Theron's suggestion a bit more: there is not a general solution to the problem because Pyramid's routing system is flexible enough that it's not easy to tell which view will be invoked for a particular request without actually executing the request. If you know what permission

Re: [pylons-discuss] Depricate CallbackAuthenticationPolicy?

2019-02-22 Thread Michael Merickel
AM Michael Merickel > wrote: > > > > On Tue, Sep 25, 2018 at 10:09 AM Mike Orr wrote: > >> > >> On Mon, Sep 24, 2018 at 3:21 PM Michael Merickel > wrote: > >> > We'd deprecate it in 1.10 and remove it in 2.0 as we're planning to > do with pic

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

2019-03-13 Thread Michael Merickel
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: > there seems to be a few ways a pyramid app can be run > > is there a way to detect if the current application was started via > `pyramid.paster.bootstrap`? > >

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

Re: [pylons-discuss] RotatingFileHandler and pserve --reload

2019-01-25 Thread Michael Merickel
I opened https://github.com/Pylons/pyramid/issues/3455 to track this. On Fri, Jan 25, 2019 at 3:00 PM Michael Merickel wrote: > The issue is that pserve configures logging *before* forking the children, > while in the monitor process, and then configures logging again in the &

Re: [pylons-discuss] RotatingFileHandler and pserve --reload

2019-01-25 Thread Michael Merickel
The issue is that pserve configures logging *before* forking the children, while in the monitor process, and then configures logging again in the child subprocesses after forking. This is an issue and hasn't been pointed out by anyone before. This means you always have two processes opening those

[pylons-discuss] Pyramid 1.9.4 and 1.10.2 released

2019-01-30 Thread Michael Merickel
Hey folks, I just released new bugfix versions - Pyramid 1.9.4 and 1.10.2. Check the "What's New in Pyramid 1.10" for more information about 1.10.2: https://docs.pylonsproject.org/projects/pyramid/en/1.10-branch/whatsnew-1.10.html Check the "What's New in Pyramid 1.9" for more information about

[pylons-discuss] colander 1.6.0 released

2019-01-31 Thread Michael Merickel
colander 1.6.0 has been released. The full changelog is here: https://docs.pylonsproject.org/projects/colander/en/latest/#change-history Documentation: https://docs.pylonsproject.org/projects/colander/en/latest/ You can install it via PyPI: pip install colander==1.6.0 Enjoy, and please

[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:

[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

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

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] 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] 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] 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] 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] 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] 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] 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-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-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] 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] 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] 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] 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

[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] 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)``.

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] 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] 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] 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] 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] 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] 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] 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 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] 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] 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] 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] 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

[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] 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.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] 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] 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] 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] 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] 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] 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] 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] 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

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] 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 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 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.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:

[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.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

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] 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] 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] 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

<    1   2   3   4   5   6   7   >