[pylons-discuss] Re: What should I use to inject data into multiple view responses before JSON rendering?

2024-04-11 Thread Jonathan Vanasco
I don't know what is recommended, but have done similar things before. One way I've done something similar is to use a custom renderer in the `@view_config`. Another way I've accomplished this is to set a request attribute early on - either in a tween or in the view class instantiation or even

[pylons-discuss] Re: Question about serving video and audio (e.g .mp4 and .ogg)

2024-03-25 Thread Jonathan Vanasco
Unless you need to lock those files down with pyramid auth, I would isolate them away for Apache to serve. I am very familiar with Dreamhost, and running fcgi stuff on it. I keep some subversion/trac stuff on it - I really need to upgrade those to git! I would avoid serving anything static on

[pylons-discuss] Re: Question about creating routes

2024-03-13 Thread Jonathan Vanasco
I'm not sure about lambdas, but this reminded me the tutorial with "discriminators", which goes into some troubleshooting: https://docs.pylonsproject.org/projects/pyramid_cookbook/en/latest/configuration/whirlwind_tour.html I feel like I've encountered something around this concept before , but

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

2024-02-05 Thread Jonathan Vanasco
I don't have time to do this, but would be happy to be looped in for code review if there is another PR. It looks like you've gotten most things done already. I think the alembic integration may be out of date, as those files haven't been touched for a while. I can ask Federico on the

[pylons-discuss] Re: Enabling Github Discussions

2024-02-05 Thread Jonathan Vanasco
After using github discussions as a secondary support channel, SqlAlchemy froze the Google Group a few months ago and uses it as the only official channel now. It has worked fairly well. On Wednesday, January 31, 2024 at 8:57:29 PM UTC-5 Michael Merickel wrote: > Hey folks, > > I've enabled

Re: [pylons-discuss] feedback on Supabase auth sample app for Pyramid

2023-12-04 Thread Jonathan Vanasco
sed it because I don’t store secret data in cookies, so > using the signed factory one is easier and didn’t require additional crypto > libraries to be added to my stack. > > On Nov 30, 2023, at 15:26, Jonathan Vanasco wrote: > > Wow. This looks great. I wish I knew about it

Re: [pylons-discuss] feedback on Supabase auth sample app for Pyramid

2023-11-30 Thread Jonathan Vanasco
Wow. This looks great. I wish I knew about it sooner. Digging into the code, there was a PR to split things out and support JSON serialization – however there are no unit tests covering this or docs for it. @Delta do you know of any public examples of this usage? If so I'd be happy to play

Re: [pylons-discuss] feedback on Supabase auth sample app for Pyramid

2023-11-30 Thread Jonathan Vanasco
> Any suggestions for 1-3 simple examples? Ideally with only Python dependencies -- I'd rather not add Redis, MongoDB etc. since we already have Supabase. Aside from beaker, no. I maintain `pyramid_session_redis` and - as long as you disable redis administration - it is relatively

Re: [pylons-discuss] feedback on Supabase auth sample app for Pyramid

2023-11-29 Thread Jonathan Vanasco
First off, the refresh/access tokens are sensitive credentials that must be protected from exposure to third parties. I would personally consider this implementation as a low security risk when it comes to the two tokens, as they'd be left as plaintext in the browser's settings/profile whether

Re: [pylons-discuss] Problems when using Gunicorn and Postgresql together

2023-11-21 Thread Jonathan Vanasco
rst connection is being made and how it is recycled, as the last few versions of the cookiecutter do defend against this behavior. On Tuesday, November 21, 2023 at 1:06:43 AM UTC-5 Mike Orr wrote: > On Mon, Nov 20, 2023 at 4:14 PM Jonathan Vanasco > wrote: > > > > SQLAlch

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

2023-11-20 Thread Jonathan Vanasco
> other headers set by your proxy as well. Definitely never trust a header > without checking those properties of your deployment though. > > - Michael > > On Nov 17, 2023, at 10:02, Jonathan Vanasco wrote: > >  > > I do a lot of work with SSL Certs. If y

Re: [pylons-discuss] Problems when using Gunicorn and Postgresql together

2023-11-20 Thread Jonathan Vanasco
SQLAlchemy supports this via `Engine.dispose()`, which is the documented way of handling a post-fork connection: https://docs.sqlalchemy.org/en/13/core/connections.html#engine-disposal Invoking `Pool.recreate()` should be fine, but the documented pattern is to call `Engine.dispose` > How

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

2023-11-17 Thread Jonathan Vanasco
I do a lot of work with SSL Certs. If you are using publicly trusted client certificates (i.e. LetsEncrypt, Digisign, etc), then you basically just need to do what Michael suggested - ensure your gateway or server populates the headers or environment variables with the information for the

[pylons-discuss] Re: `add_request_method` doesn't seem to work within an `includeme` anymore

2023-09-20 Thread Jonathan Vanasco
I just remembered the debugtoolbar works as a separate application, which explains why I'm seeing different values for `id(config)` in the toolbar and main app during setup. unless I am crazy, this should never have worked. On Wednesday, September 20, 2023 at 5:46:46 PM UTC-4 Jonathan

[pylons-discuss] `add_request_method` doesn't seem to work within an `includeme` anymore

2023-09-20 Thread Jonathan Vanasco
This is driving me a bit crazy. I hope someone can see the issue or changelog I am missing in the current pyramid and debugtoolbar. I am adding some typing and tests to a debug toolbar that has the following in the includeme: ``` def includeme(config: "Configurator"):

[pylons-discuss] Re: Functional tetsing of an app using pyramid_cas (Apereo CAS)

2023-07-31 Thread Jonathan Vanasco
There are a few ways I have done this. 1-In the functional tests, just rely on the headers being set/unset. Then test the full SSO to set headers on integrated tests. 2- If the SSO functions use the Requests library, you can use Responses to mock the response. This way you can simulate a SSO

Re: [pylons-discuss] pyramid_session_redis - v1.7.0rc1

2023-06-16 Thread Jonathan Vanasco
ect update. It will have a code freeze > at the beginning of July. Do you expect a release by then? Although I > don't need to upgrade it if the changes are mainy for mypy, which I > don't use. > > On Tue, Jun 13, 2023 at 10:04 AM Jonathan Vanasco > wrote: > > >

[pylons-discuss] pyramid_session_redis - v1.7.0rc1

2023-06-13 Thread Jonathan Vanasco
I've released a new branch of pyramid_sesion_redis with an rc1 status: 1.7.0rc1 https://pypi.org/project/pyramid-session-redis/ https://github.com/jvanasco/pyramid_session_redis If anyone is able to test this on their staging systems, I would be very appreciative. This has been

Re: [pylons-discuss] webob SignedSerializer questions

2023-06-12 Thread Jonathan Vanasco
Regeer wrote: > > On Jun 12, 2023, at 12:42, Jonathan Vanasco wrote: > > I've been updating my session library to utilize typing/mypy and this > implementation detail surfaced between mypy integration and some new tests. > > I hope someone can enlighten me on this and some b

[pylons-discuss] webob SignedSerializer questions

2023-06-12 Thread Jonathan Vanasco
I've been updating my session library to utilize typing/mypy and this implementation detail surfaced between mypy integration and some new tests. I hope someone can enlighten me on this and some best testing practices... Webob's SignedSerializer expects to dump to, and load from, `bytes`. The

[pylons-discuss] Re: Question about Pyramid + ZODB + RelStorage performances

2023-06-06 Thread Jonathan Vanasco
> So, does anyone have any idea about the origin of this increase in PostgreSQL activity and performance decrease? Since pg_stat_activity is not showing anything, my typical troubleshooting is this: 1. Have your app log the exact queries, along with the time it takes to run. You can do this

[pylons-discuss] Re: Hypatia - drop Python 2, GitHub Actions?

2022-12-19 Thread Jonathan Vanasco
I can't speak for the maintainers, but the Pylons Projects have been standardizing onto Github Actions so there is appeal. IIRC, support for projects has also been targeting 3.7+. But as a personal preference, while I don't use this library myself, whenever I move a project onto GitHub

[pylons-discuss] Pyramid Authentication/Authorization Questions

2022-11-29 Thread Jonathan Vanasco
I have 2 large Pyramid applications that use an in-house authentication/authorization and request pre-processing system. I'm in the middle of porting a legacy mod_perl app to Pyramid, and weighing the options of: (i) converting everything to more native Pyramid code, or (ii) abstracting the

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

2022-11-29 Thread Jonathan Vanasco
mid 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, I'm on 2.0 and it works, so either >>> som

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

2022-11-28 Thread Jonathan Vanasco
On Sunday, November 27, 2022 at 1:23:21 PM UTC-5 zsol...@gmail.com wrote: > 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. > The warnings are still there, you most likely have fully compatible

[pylons-discuss] Re: SQLAlchemy 2.0 support

2022-11-27 Thread Jonathan Vanasco
There was one potential incompatibility with transaction, but the zope.sqlalchemy team addressed it already ( see https://github.com/zopefoundation/zope.sqlalchemy/issues/60 ). There are deprecation warnings that are still unhandled ( see

[pylons-discuss] feedback? cookiecutter for maintaining larger projects

2022-11-10 Thread Jonathan Vanasco
I recently had to upgrade some legacy systems and build out a few new projects. While doing this, I decided to standardize everything to a pattern/framework we've settled on over the past few years. This involved creating a cookiecutter based on the standard Pyramid cookiecutter, and I

Re: [pylons-discuss] [ANN] web-top

2022-08-24 Thread 'Jonathan Vanasco' via pylons-discuss
This looks interesting. I'll try to test it on uwsgi and contribute a PR if it works. If anyone can beat me to it though... On Wednesday, August 24, 2022 at 4:44:09 AM UTC-4 mi...@redinnovation.com wrote: > Hi Thierry, > > >> That seems to be a nice project! >> I would like to provide an

[pylons-discuss] Re: Top like monitoring for Pyramid / Gunicorn

2022-08-22 Thread 'Jonathan Vanasco' via pylons-discuss
Have you tried using statsd ? (https://github.com/statsd/statsd) See * https://www.etsy.com/codeascraft/measure-anything-measure-everything/ * https://thenewstack.io/collecting-metrics-using-statsd-a-standard-for-real-time-monitoring/ Typically you log each request start and the stop reason

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

2022-08-16 Thread 'Jonathan Vanasco' via pylons-discuss
On Tuesday, August 16, 2022 at 11:45:24 AM UTC-4 Mike Orr wrote: > It is rolling back in some of my testing when there's no > insert/delete/update, but I want to make sure it always does, just in > case something somehow modifies the database when we didn't intend to. > It's not that big a deal

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

2022-08-15 Thread Jonathan Vanasco
I second what Michael said. The sqlalchemy starter template is the right way to go. The major thing this template does, is provide you with the glue between a SQLAlchemy "Session" and the pyramid request. See :

Re: [pylons-discuss] Pyramid, partial and resumable downloads, HTTP Accept Ranges

2022-07-08 Thread 'Jonathan Vanasco' via pylons-discuss
^ ditto On Tuesday, June 28, 2022 at 6:28:23 PM UTC-4 the...@luhn.com wrote: > Easiest way is to not do it :) I try to offload downloads/uploads to a > service like S3. Let somebody else do the heavy lifting. If > authentication is needed, I’ll generate a presigned URL in Pyramid and >

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

2022-06-09 Thread 'Jonathan Vanasco' via pylons-discuss
alenv wrapper around a console > script which this should skip. > > > > - Michael > > On Jun 8, 2022, at 15:31, 'Jonathan Vanasco' via pylons-discuss < > pylons-...@googlegroups.com> wrote: > > I doubt anyone here may have experienced this, but I've run out of

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

2022-06-08 Thread 'Jonathan Vanasco' via pylons-discuss
I doubt anyone here may have experienced this, but I've run out of resources to explore on this... We use Fabric (fabfile.org) to automate a lot of things. It is great. I built a new routine in it this week, and I can't get it to clean up properly. The routine simply spins up an admin version

[pylons-discuss] Re: Waitress and multiprocess pooling

2022-05-12 Thread Jonathan Vanasco
- What's the recommended modern multiprocess enabled web server to do more scaleable Pyramid hosting? I like uWSGI, but others like gunicorn and I think there is another popular option. Regardless of the server you choose, please be aware they may (though I am pretty sure they all will) all

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

2022-05-11 Thread Jonathan Vanasco
IMHO it's not a micro-optimization. RDBMs systems will often take a performance hit on the COMMIT vs rollback when there are multiple simultaneous transactions, and it can cause issues on clustered/replicant systems. I often forget about this too. The techniques that have worked for me: *

Re: [pylons-discuss] Re: pyramid_tm 2.5 has been released

2022-03-31 Thread 'Jonathan Vanasco' via pylons-discuss
nges.html > > --steve > > > On 3/16/22 10:10 AM, 'Jonathan Vanasco' via pylons-discuss wrote: > > I assume this message is automated by a release script, and that is out > of date. > > > > The changes and latest aren't rendered onto those docs, and the anchors >

[pylons-discuss] Re: pyramid_tm 2.5 has been released

2022-03-16 Thread 'Jonathan Vanasco' via pylons-discuss
I assume this message is automated by a release script, and that is out of date. The changes and latest aren't rendered onto those docs, and the anchors don't exist. The changes do appear here: https://github.com/Pylons/pyramid_tm/blob/master/CHANGES.rst On Sunday, March 13, 2022 at 4:01:18

[pylons-discuss] Re: Looking for best option for Pyramid deployment

2022-03-15 Thread 'Jonathan Vanasco' via pylons-discuss
We run Pyramid via uwsgi, behind an OpenResty server (Nginx fork with embedded lua interpreter). IMHO the "best" stack is somewhat dependent on your application. We have a large application and the forking model of uwsgi - combined with many of its management hooks - lets us aggressively

Re: [pylons-discuss] Subscribing to connection lost / failed transaction event?

2022-03-15 Thread 'Jonathan Vanasco' via pylons-discuss
e transaction, and > pyramid should run the exception view machinery (although that response > will never make it back to the client, it should be possible to use it at > that point to do any extra cleanup or whatnot though) > > Hopefully Andrew Free this helps somewhat, in that it is poss

Re: [pylons-discuss] Subscribing to connection lost / failed transaction event?

2022-03-07 Thread Jonathan Vanasco
Just to clarify the above comment, this concept isn't really possible with any internet technology in general, not just Pyramid. On Thursday, February 17, 2022 at 8:35:25 PM UTC-5 Bert JW Regeer wrote: > No, this is not possible *. > > * Except under some very narrow circumstances, but none

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

2022-01-07 Thread 'Jonathan Vanasco' via pylons-discuss
On Monday, December 13, 2021 at 9:14:30 PM UTC-5 the...@luhn.com wrote: > 1) pserve isn’t really comparable with gunicorn, its just a way to launch > a server, such as gunicorn or waitress. You’re probably using waitress, > that’s what the Pyramid docs use. > > I personally use gunicorn, but

[pylons-discuss] pyramid_session_redis 1.6.3 released

2021-11-16 Thread Jonathan Vanasco
Pyramid Session Redis 1.6.3 is now available on Github and PyPi * https://github.com/jvanasco/pyramid_session_redis * https://pypi.org/project/pyramid-session-redis/ The new version was released to support developers who do not actively monitor deprecation warnings, and have not already

[pylons-discuss] Re: keeping the tests out of the wheel

2021-10-26 Thread Jonathan Vanasco
About a year ago, I moved all my projects to the pattern that Pyramid uses itself... * /src/PROJECT * /tests * /MANIFEST.in * /pyproject.toml * /setup.cfg * /setup.py * /tox.ini That has eliminated 99% of the packaging issues I've encountered in the past. IIRC, that became the standardized

Re: [pylons-discuss] SQLAlchemy create_engine future argument

2021-08-13 Thread 'Jonathan Vanasco' via pylons-discuss
> It looks like the `future` flag on Engine and the `future` flag on Session are two separate things. So you need to add `future=True` to either sessionmaker or the Session constructor. Confirming this. There is also a `future` on `Connection` objects, but that is inherited from `Engine`.

[pylons-discuss] Re: debugtoolbar - don't intercept a raised exception ?

2021-05-25 Thread 'Jonathan Vanasco' via pylons-discuss
, 2021 at 3:55:34 PM UTC-4 Jonathan Vanasco wrote: > One of my CI tests deals with an edge case, in which a > HTTPMovedPermanently is raised in deeply nested code. This almost never > gets raised in Production - rules on the loadbalancer/gateway typically > catch it. > > With th

[pylons-discuss] debugtoolbar - don't intercept a raised exception ?

2021-05-21 Thread 'Jonathan Vanasco' via pylons-discuss
One of my CI tests deals with an edge case, in which a HTTPMovedPermanently is raised in deeply nested code. This almost never gets raised in Production - rules on the loadbalancer/gateway typically catch it. With the debugtoolbar off, Pyramid serves the redirect. With the debugtoolbar

Re: [pylons-discuss] Replacing Freenode?

2021-05-20 Thread 'Jonathan Vanasco' via pylons-discuss
ses which is behind such stalwarts as Debian, Libreoffice (in the U.S.) > and PostgreSQL.Org > > > > On Wed, May 19, 2021 at 7:24 AM 'Jonathan Vanasco' via pylons-discuss < > pylons-...@googlegroups.com <mailto:pylons-...@googlegroups.com>> wrote: > > >

[pylons-discuss] Replacing Freenode?

2021-05-19 Thread 'Jonathan Vanasco' via pylons-discuss
Are there any plans to replace Freenode, in light of the recent developments? See: https://boingboing.net/2021/05/19/freenode-irc-staff-quit-after-new-owner-seizes-control.html https://libera.chat/ -- You received this message because you are subscribed to the Google Groups

Re: [pylons-discuss] Problem between Pyramid's CSRF protection and Deform

2021-05-12 Thread 'Jonathan Vanasco' via pylons-discuss
They're not the same at all. The difference is on purpose. Janzert is correct, though his description may not necessarily be clear. The following might make more sense: The two functions do the following: pyramid.csrf.get_csrf_token(request) discern active ICSRFStoragePolicy invoke

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

2021-05-12 Thread 'Jonathan Vanasco' via pylons-discuss
Extending and hoping to clarify Steve's example above, Pyramid users typically leverage the "predicates" to handle this mapping. by using the `request_method` predicate to map "GET" to "view", "POST" to "create", etc. On Monday, May 10, 2021 at 4:27:09 PM UTC-4 grc...@gmail.com wrote: > >

[pylons-discuss] pyramid_session_redis 1.6.0 released

2021-03-30 Thread 'Jonathan Vanasco' via pylons-discuss
pyramid_session_redis 1.6.0 is now released on Github and PyPi. Notable changes: * Pyramid2 is now supported. * Pyramid1.x and Python2 are still fully supported. * The Session object has two new methods: * Session.adjust_cookie_expires * Session.adjust_cookie_max_age * These

[pylons-discuss] debugging JSON encoder issues

2021-03-15 Thread 'Jonathan Vanasco' via pylons-discuss
I've run into this same problem a few times in unittest. I'm hoping someone else has a better solution. 1. The test harness uses webtest.TestApp to mount the Pyramid application 2. A route has a payload with an object that can not be rendered into json 3. The traceback looks like the item

Re: [pylons-discuss] generating docs for views

2021-03-12 Thread 'Jonathan Vanasco' via pylons-discuss
and only). > > https://pyramid-realworld.herokuapp.com/api > > --steve > > > On 3/12/21 1:36 PM, 'Jonathan Vanasco' via pylons-discuss wrote: > > I had a small Pyramid project which has grown into a much larger one. > > > > Many Views service multiple Routes (mult

[pylons-discuss] generating docs for views

2021-03-12 Thread 'Jonathan Vanasco' via pylons-discuss
I had a small Pyramid project which has grown into a much larger one. Many Views service multiple Routes (multiple calls to `@view_config()`), typically offering a default HTML version on a "bare" url, and a JSON version with a ".json" suffix to the url. Documenting these routes has become

Re: [pylons-discuss] Pyramid 2.0 released

2021-03-11 Thread 'Jonathan Vanasco' via pylons-discuss
For those that need 2.0 support with pyramid_session_redis, I have pushed a Pyramid2 compatible branch of pyramid_session_redis to https://github.com/jvanasco/pyramid_session_redis/tree/1.6-branch-concept_a This branch is NOT likely to mature to an actual release, and is basically offered as

Re: [pylons-discuss] Pyramid 2.0b1 released

2021-02-24 Thread 'Jonathan Vanasco' via pylons-discuss
> I'd just say though that if you need the request and don't have it, > it's often an indication that the program's structure is wrong. I authored this change, and you are absolutely correct. This technique is not ideal, but it is designed to stop several anti-patterns that happen with great

Re: [pylons-discuss] Pyramid packaging

2021-01-26 Thread 'Jonathan Vanasco' via pylons-discuss
FWIW, Based on the stacktrace, I do not think this is the cause -- but it could be. There have been a few related bugs in setuptools and pip regarding the version parser and tag_build directives; the errors I've seen were not like this - but I saw 3 completely different errors from these over

[pylons-discuss] Re: Pyramid maintenance mode

2021-01-07 Thread 'Jonathan Vanasco' via pylons-discuss
to change the routing on nginx. while the existence of the file is checked on every request, due to the way nginx and operating system cache the information this is negligible and essentially handled in memory. On Thursday, January 7, 2021 at 12:43:46 PM UTC-5 Jonathan Vanasco wrote: > I typica

[pylons-discuss] Re: Pyramid maintenance mode

2021-01-07 Thread 'Jonathan Vanasco' via pylons-discuss
I typically handle this on nginx which sites in front of Pyramid. if you wanted to do everything in python, you could probably use WSGI middleware to route to a separate maintenance application or html file. On Thursday, January 7, 2021 at 10:09:34 AM UTC-5 C J wrote: > Hi everybody, > > I am

Re: [pylons-discuss] Creating sub-processes from Pyramid application

2021-01-06 Thread 'Jonathan Vanasco' via pylons-discuss
ble!) of my own developments... >> >> Best regards, >> Thierry >> -- >> https://www.ulthar.net -- http://pyams.readthedocs.io >> >> Le mar. 5 janv. 2021 à 22:18, 'Jonathan Vanasco' via pylons-discuss < >> pylons-...@googlegroups.com> a écrit : >

Re: [pylons-discuss] Re: Creating sub-processes from Pyramid application

2021-01-05 Thread 'Jonathan Vanasco' via pylons-discuss
> access to main Pyramid's registry from my sub-process and it's threads, and > I don't really understand why I get a pointer to > ZCA global registry... :( > > Best regards, > Thierry > -- > https://www.ulthar.net -- http://pyams.readthedocs.io > > Le lun. 4 janv. 2021

[pylons-discuss] Re: Creating sub-processes from Pyramid application

2021-01-04 Thread 'Jonathan Vanasco' via pylons-discuss
Have you considered using Celery for this? I started offloading everything related to subprocesses and message queues to it a while back, and have been much happier. On Monday, January 4, 2021 at 11:20:46 AM UTC-5 tfl...@gmail.com wrote: > Hi, > > I need to create custom sub-processes from my

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

2020-11-12 Thread 'Jonathan Vanasco' via pylons-discuss
I don't know about "correct", but I use `add_request_method` to attach a custom object(s) with `reify=True,` and then store all the information in those objects. IIRC, the narrative documentation and tutorials use it for similar purposes.

[pylons-discuss] Re: Appengine Logging with Pyramid, need to get current request

2020-11-10 Thread 'Jonathan Vanasco' via pylons-discuss
I don't use Google's platform, but from what I can tell: 1. Their platform adds in the header "X_CLOUD_TRACE_CONTEXT" 2. There are middleware tools for aggregating logs based on that 3. I don't know if the software you linked is using the middleware, but the popular libraries seem to be: *

Re: [pylons-discuss] Issues migrating dynamic CSV to Python3

2020-10-19 Thread Jonathan Vanasco
at 11:59:05 AM UTC-4 Jonathan Vanasco wrote: > Actually, just using `body=csvfile.read()` works on Python2 & Python3 ! > > > On Monday, October 19, 2020 at 11:32:48 AM UTC-4 the...@luhn.com wrote: > >> Since you’re just dumping the entire file into BytesIO anyways, wouldn

[pylons-discuss] Re: Serving an S3 file

2020-10-19 Thread Jonathan Vanasco
> What is 'wsgi.file_wrapper' anyway? It's a WSGI hook defined in PEP 333 and (https://www.python.org/dev/peps/pep-/#optional-platform-specific-file-handling) It basically lets your application defer to an iterator defined in middleware file responses. In the Pyramid code, you'll see

Re: [pylons-discuss] Issues migrating dynamic CSV to Python3

2020-10-19 Thread Jonathan Vanasco
ip BytesIO? > > On Oct 18, 2020, at 3:33 PM, Jonathan Vanasco wrote: > > Thanks so much, Bert. That should have been obvious! > > As an interim solution, I'm just wrapping the inputs: > > if six.PY3: > csvfile = BytesIO(csvfile.read().encode("utf-8"

Re: [pylons-discuss] Issues migrating dynamic CSV to Python3

2020-10-18 Thread Jonathan Vanasco
our body_file is not bytes, but str. You need to make sure that what you > pass to body_file returns bytes. > > On Oct 16, 2020, at 15:03, Jonathan Vanasco wrote: > > I discovered an issue with our code when generating dynamic CSVs under > Python3. I'm hoping someone can poin

[pylons-discuss] Issues migrating dynamic CSV to Python3

2020-10-16 Thread Jonathan Vanasco
I discovered an issue with our code when generating dynamic CSVs under Python3. I'm hoping someone can point me in the right direction. I couldn't find the appropriate migration/changelog information. This works fine under Python2. The generic way we create/serve the CSV and check it in

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

2020-10-12 Thread 'Jonathan Vanasco' via pylons-discuss
lementing pyramid.interfaces.IResponse (the > expected return value from the app's configured IResponseFactory). This is, > of course, slightly more general than pyramid.response.Response. > > - Michael > > On Oct 12, 2020, at 13:48, 'Jonathan Vanasco' via pylons-discuss < > p

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

2020-10-12 Thread 'Jonathan Vanasco' via pylons-discuss
I've looked at the code and am pretty sure the answer is no, but a bunch of subclasses are used here, so I think it's best to ask -- Will render_to_response ever return something that is not `pyramid.response.Response`? I have a small library that will act on the output of

Re: [pylons-discuss] migrating away from formencode?

2020-10-12 Thread 'Jonathan Vanasco' via pylons-discuss
se. Now that Formencode 2 is out > I'll upgrade to it. > > On Mon, Oct 5, 2020 at 7:34 AM 'Jonathan Vanasco' via pylons-discuss > wrote: > > > > Talk about timing. Several hours after I posted this, Formencode merged > the Python3 fix(es) and did a 2.0 release. I guess

Re: [pylons-discuss] migrating away from formencode?

2020-10-05 Thread 'Jonathan Vanasco' via pylons-discuss
a examples for each Deform widget that you want. >> If you don't see something, ask! >> >> --steve >> >> >> On 10/2/20 1:00 PM, 'Jonathan Vanasco' via pylons-discuss wrote: >> > Thanks, Stev! >> > >> > Deform is high on the list; I sho

Re: [pylons-discuss] migrating away from formencode?

2020-10-02 Thread 'Jonathan Vanasco' via pylons-discuss
to keep all those apps running under Python2.. On Friday, October 2, 2020 at 3:40:22 PM UTC-4 Steve Piercy wrote: > On 10/2/20 10:06 AM, 'Jonathan Vanasco' via pylons-discuss wrote: > > Does anyone have tips/advice for migrating away from Formencode? > > For server side ren

[pylons-discuss] migrating away from formencode?

2020-10-02 Thread 'Jonathan Vanasco' via pylons-discuss
Does anyone have tips/advice for migrating away from Formencode? I have a lot of apps using Formencode and will likely need to move off it. It's no longer maintained, and needs to a patch/fork to run under Python3. That's been fine for internal apps, but it's a pain for open sourced efforts.

[pylons-discuss] Re: Pyramid docs copyright

2020-09-21 Thread Jonathan Vanasco
I am not a package maintainer, but if I recall correctly, this is a benefit and not a desire. I believe one of (several) reasons for this licensing decision was to stop third-party groups from monetizing the documentation at the expense of the project. IIRC, several commercial sites had

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

2020-09-20 Thread Jonathan Vanasco
On Saturday, September 19, 2020 at 12:00:28 PM UTC-4 mmer...@gmail.com wrote: > It could support changing the max_age when you invoke > `adjust_timeout_for_session` but it apparently is not. > I'm the package author. `adjust_timeout_for_session` doesn't affect `max_age` because that defect

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

2020-08-31 Thread 'Jonathan Vanasco' via pylons-discuss
I've done a handful of side-by-side migrations or deployments. I think you already identified the generally best approach IMHO: > Conceptually the simplest would be to have a auth cookie that is valid in both, it could be set to only be created in one and honoured in the other. However I

Re: [pylons-discuss] externally hosted static files

2020-07-23 Thread 'Jonathan Vanasco' via pylons-discuss
This is a very simplified version of my approach: I typically handle this by injecting a `cdn` variable into the default rendering environment, and then just having the templates reference href="${cdn}/path/to/file" I specify the `cdn` var in the `.ini` file for the application. on

[pylons-discuss] docs down?

2020-04-23 Thread Jonathan Vanasco
I'm getting 403 errors from cloudflare on all the https://docs.pylonsproject.org urls. i tried accessing from several networks in the usa to ensure it wasn't a local routing or blacklist issue -- You received this message because you are subscribed to the Google Groups "pylons-discuss"

[pylons-discuss] Re: strategies for marking test coverage of routes?

2020-04-15 Thread Jonathan Vanasco
I ended up doing a quick proof of concept that works pretty well: _ROUTES_TESTED = {} def tests_routes(*args): """ `@tests_routes` is a decorator when writing/editing a test, declare what routes the test covers, like such: @tests_routes(("foo", "bar")) def

[pylons-discuss] strategies for marking test coverage of routes?

2020-04-13 Thread Jonathan Vanasco
I'd like to ensure 100% test coverage of every route. Has anyone worked on a solution to ensuring/reporting this? I assume it might involve a decorator on my tests stating the routes covered, and then a command to match that against what is registered into the Pyramid app via @view_config or

[pylons-discuss] proper way to stash an object into the application registry?

2020-03-30 Thread Jonathan Vanasco
I am decoupling some code from Pyramid and am creating a dict-like object to live alongside the traditional application "settings" object available as `config.registry.settings` and `request.registry.settings`. I am basically moving the non-Pyramid-centric application settings out of the

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

2020-03-25 Thread Jonathan Vanasco
Stuff like this often happens because Python has a compiled/cached version. Under Python2, `.pyc` files were in the same directory as the `.py` file ; under Python3 they are in a `__pycache__` directory and versioned to the interpreter. you probably had a

[pylons-discuss] Re: pyramid_beaker, pyramid_redis_sessions, pyramid_session_redis

2020-02-10 Thread Jonathan Vanasco
Mike- I maintain `pyramid_session_redis`. The package allows for session data to be serialized with `pickle`. I don't necessarily recommend it and prefer for `msgpack` myself, but it supports `pickle` and `pickle` is the default. A recent-ish release dropped another usage of `pickle` in the

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

2020-02-07 Thread Jonathan Vanasco
> > `request.tm.commit()`, `request.tm.abort()` and `request.tm.begin()` > instead of `request.dbsession.commit()`. Thanks, Michael. This obvious answer is what I'll use. I am very familiar with Celery and task runners, and have a few app using it with Pyramid. In this particular

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

2020-02-06 Thread Jonathan Vanasco
one of my apps uses pyramid_tm, but has reached a point where one (possibly two) views (out of dozens) need to make explicit commits with the SqlAlchemy session. does anyone know if it's currently possible to handle this? i have a few apps that only integrate pyramid_tm on a small subset of

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

2020-02-05 Thread Jonathan Vanasco
On Wednesday, February 5, 2020 at 1:15:23 PM UTC-5, Michael Merickel wrote: > > If you're opening files you should use the context manager - for example: > > with request.POST['file'] as field: > data = field.file.read() > Thanks, Michael. My application code did that... but somewhere in the

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

2020-02-04 Thread Jonathan Vanasco
After even more testing (half my day!)... My app needed an `add_finished_callback` to close any `webob.compat.cgi_FieldStorage` objects in forms. -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop

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

2020-02-04 Thread Jonathan Vanasco
I keep encountering a particular `ResourceWarning: unclosed file <_io.BufferedRandom` in my test suite that I can not track down. I'm hoping someone else may have an idea: * In a suite of 10+ test classes, it only happens when 2 particular classes are run consecutively and in a particular

Re: [pylons-discuss] is it possible to 'nest' a pyramid application within a larger library?

2020-01-28 Thread Jonathan Vanasco
thank you! On Monday, January 27, 2020 at 5:41:42 PM UTC-5, Theron Luhn wrote: > > Your setup.py is correct. > > In the ini file, `use` points not to a module but an entry point. > -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To

Re: [pylons-discuss] is it possible to 'nest' a pyramid application within a larger library?

2020-01-27 Thread Jonathan Vanasco
I don’t think there’s any > assumptions made about where the application lives. What particular > troubles you’re having? > > — Theron > > > > On Jan 27, 2020, at 12:37 PM, Jonathan Vanasco > wrote: > > does anyone know if it possible to nest a pyramid application

[pylons-discuss] is it possible to 'nest' a pyramid application within a larger library?

2020-01-27 Thread Jonathan Vanasco
does anyone know if it possible to nest a pyramid application within a larger library? for example, I would like a Pyramid application's root to be `myapp.web`, instead of `myapp`. I don't think this is possible, which is fine - I can just split the pyramid app into a separate package. --

[pylons-discuss] Re: 'samesite' cookie attribute and Chrome changes

2020-01-22 Thread Jonathan Vanasco
1. Bert, thank you! 2. Mike, this stuff is generally a mess: There are now 4 valid options for a cookie: Python Value | Cookie Value (all strings) None | "None" | None< this is the new "experimental" one that google has forced "Strict" | Strict "Lax"| Lax You

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

2020-01-13 Thread Jonathan Vanasco
Not Heroku, but in general... On Friday, January 10, 2020 at 9:21:36 PM UTC-5, Peter Lada wrote: > > > If anyone has a good insight on how to enable further request logging > (beyond the path that heroku already gives me) that would be great. > You could write a simple tween, modeled after

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

2020-01-09 Thread Jonathan Vanasco
On Thursday, January 9, 2020 at 5:16:12 PM UTC-5, Jonathan Vanasco wrote: > > Is there a reason why you're both using `1.4.2` and not `1.4.9` ? > Nevermind, just realized you're talking about waitress which just pushed a 1.4.2 and not Pyramid. -- You received this message be

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

2020-01-09 Thread Jonathan Vanasco
Is there a reason why you're both using `1.4.2` and not `1.4.9` ? -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to pylons-discuss+unsubscr...@googlegroups.com.

Re: [pylons-discuss] Confused accessing db sessions

2020-01-07 Thread Jonathan Vanasco
On Monday, January 6, 2020 at 4:03:19 PM UTC-5, Kate Boelhauf wrote: > > This is insanely helpful - thank you Michael. I'm going to pass the > dbsession into the class method for now but look into a service layer. > A few years ago I adopted the pattern of passing Pyramid's `request` object

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

2019-12-19 Thread Jonathan Vanasco
On Thursday, December 19, 2019 at 12:26:34 PM UTC-5, Michael Merickel wrote: > > 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 >

  1   2   3   4   5   6   7   8   9   10   >