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 >

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

2019-12-18 Thread Jonathan Vanasco
I hope someone here can suggest a good way of handling this situation. We have an application that supports a given user profile view via two or more possible URL patterns: "/users/{username_regex}" "/users/{userid_regex}" To handle this within one route declaration, a `factory` is used:

Re: [pylons-discuss] most performant way to run WSGI app as single process

2019-09-18 Thread Jonathan Vanasco
On Monday, September 16, 2019 at 8:37:17 PM UTC-4, hynek wrote: - HAProxy kicks nginx’s and Apache’s behinds in almost every regard. This > is my hill. I like my hill. I will retire on this hill. > I really like HAProxy and Varnish. They were both keystones to some high traffic sites I

Re: [pylons-discuss] most performant way to run WSGI app as single process

2019-09-18 Thread Jonathan Vanasco
On Wednesday, September 18, 2019 at 1:34:57 AM UTC-4, hynek wrote: > > > This means "recycle after 4096 +/- 128 requests” (The jitter is so they > don’t recycle all at once; although it’s unlikely to happen at the same > time over the whole cluster. The option is more useful when you have more

Re: [pylons-discuss] most performant way to run WSGI app as single process

2019-09-17 Thread Jonathan Vanasco
On Monday, September 16, 2019 at 8:37:17 PM UTC-4, hynek wrote: > - I don’t know whether it’s me, my Python DB driver (sqlanydb ), or the > underlying libs: there’s stuff leaking all the time so I wouldn’t use a > WSGI container that doesn’t do worker recycling after a configurable amount

Re: [pylons-discuss] most performant way to run WSGI app as single process

2019-09-12 Thread Jonathan Vanasco
On Thursday, September 12, 2019 at 1:54:53 PM UTC-4, Theron Luhn wrote: > > Usually you put an HTTP server like nginx or HAProxy in front of your WSGI > server, which are very good at handling high-volume HTTP requests, so that > your WSGI server isn't subjected to whatever the internet might

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

2019-07-26 Thread Jonathan Vanasco
On Friday, July 26, 2019 at 1:14:08 PM UTC-4, Jens Troeger wrote: > > > Regarding Pyramid and OAuth2, there are a few projects, e.g. > pyramid_oauth2_provider > (last updated > Jun 2017), pyramid_oauth2_client >

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

2019-07-19 Thread Jonathan Vanasco
On Thursday, July 18, 2019 at 6:52:23 PM UTC-4, Michael Merickel wrote: > > processes != threads > ack! yes! sorry! -- 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

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

2019-07-18 Thread Jonathan Vanasco
You could have configured the process to only use 1 thread. You could also be checking in the same thread, not a dispatched thread. There are other possibilities too. It's not really possible to answer a question like this without seeing code that reproduces this. -- You received this

[pylons-discuss] Re: How to integrate spatialite in pyramid?

2019-07-09 Thread Jonathan Vanasco
1. A quick online search shows this tutorial on spatialiate with sqlalchemy: https://geoalchemy-2.readthedocs.io/en/latest/spatialite_tutorial.html the author is using a SqlAlchemy event to load the spatialate extension into the engine/connection/pool. 2. You are going to have a small

Re: [pylons-discuss] Is there a projected or likely Pyramid 2.0 release date yet?

2019-06-27 Thread Jonathan Vanasco
On Thursday, June 27, 2019 at 3:33:42 PM UTC-4, Steve Piercy wrote: > > No date, but progress is being made. Check the issue tracker. We use > milestones. > Thanks Steve. I knew about that, but some of those items are very large - especially the "possible 2.0 list". Perhaps I should have

[pylons-discuss] Is there a projected or likely Pyramid 2.0 release date yet?

2019-06-27 Thread Jonathan Vanasco
I couldn't find anything in the docs or issue tracker. I'm wondering how much time I have to create 2.0 compatible versions of some libraries. -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop

Re: [pylons-discuss] Authenticating with Oauth2/OpenID Connect

2019-06-24 Thread Jonathan Vanasco
On Friday, June 21, 2019 at 8:43:32 PM UTC-4, Mike Orr wrote: > > But if I want to contribute to the enterprise's Single Sign-In, do I need > to > tell the server the user is still logged into my application so it > doesn't expire the SSO account? That is up to your upstream identity

[pylons-discuss] Re: How to handle SQLA autoflush failures during Request commit?

2019-06-24 Thread Jonathan Vanasco
This generally happens because of an issue in your exception handling or because you are trying to share a database connection across process boundaries. The first thing to do is to check if you are connecting to the database before gunicorn forked. If so, this will likely go away if you

[pylons-discuss] Re: How to get an input's ID and value in Deform sequence of mapping widget with jQuery?

2019-06-17 Thread Jonathan Vanasco
I don't know Deform, but have done some similar things in the past so may be able to offer a hint or two. 1. You can grab the container that all the form elements are in in jquery - var dom_container = $("#item-deformField1"); 2. then, within that node, you can grab each group...

Re: [pylons-discuss] Authenticating with Oauth2/OpenID Connect

2019-05-30 Thread Jonathan Vanasco
Many of the things you mentioned are specific to Keycloak. I can't answer those. I can take a deeper look at the oauth details tomorrow. the following are things that just popped at me. On Thursday, May 30, 2019 at 8:57:28 PM UTC-4, Mike Orr wrote: > > - What should I do if there's a state

Re: [pylons-discuss] RFC: Pyramid showcase of RealWorld.io

2019-05-28 Thread Jonathan Vanasco
On Sunday, May 26, 2019 at 6:17:53 AM UTC-4, hynek wrote: > > > t I’ve started putting separate features into separate sub-packages and it > made my maintenance experience much more pleasant thanks to the locality of > common contexts. As for tests, I just mirror the structure in my global >

Re: [pylons-discuss] Authenticating with Oauth2/OpenID Connect

2019-05-21 Thread Jonathan Vanasco
On Tuesday, May 21, 2019 at 8:13:11 PM UTC-4, Mike Orr wrote: > > > I want it to do username/password checking and give me the user > metadata including the list of roles. Then I can do authorization from > the roles. By "no authorization" I mean the role/view ACLs would > remain in Pyramid;

Re: [pylons-discuss] Authenticating with Oauth2/OpenID Connect

2019-05-21 Thread Jonathan Vanasco
Thanks for the kind words. This was actually pretty fast to do. I think it took 2-3 days to build oAuth into our apps and almost everything was repackaged into this within that same week. This has been sitting in a private repo for a year or so, because it required some updates to oauthlib

Re: [pylons-discuss] Authenticating with Oauth2/OpenID Connect

2019-05-20 Thread Jonathan Vanasco
mike- if you haven't figured it out yet, hopefully my examples can help: https://github.com/jvanasco/pyramid_oauthlib_lowlevel i've been meaning to release this for a while now, thanks for giving me a reason to. in the tests, you can see a full flow of interacting with clients and servers:

Re: [pylons-discuss] Authenticating with Oauth2/OpenID Connect

2019-05-20 Thread Jonathan Vanasco
I have a project that I've been meaning to Open Source. I'll try to make time tomorrow to repackage it... it's called pyramid_oauthlib_lowlevel and is a VERY LOWLEVEL integration tool for oauthlib against Pyramid, it was somewhat inspired by flask-oauthlib and there are example oauth1 and

Re: [pylons-discuss] Pyramid 1.10.4 released

2019-05-13 Thread Jonathan Vanasco
On Monday, May 13, 2019 at 4:17:05 AM UTC-4, Steve Piercy wrote: > > Done! > > https://pylonsproject.org/community-support.html > https://trypyramid.com/documentation.html > > Thank you for bringing up the questions. > > I think it would make sense to put a formal policy in place requesting

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

2019-05-01 Thread Jonathan Vanasco
> As I understand each worker needs it's own engine instance, don't they? I think the gunicorn behaviour is good, but I'm puzzled by the pserve/Waitress behaviour. Is this by design? Just to expand on Michael's comment on there usually only being one engine but multiple connections...

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

2019-04-29 Thread Jonathan Vanasco
On Saturday, April 27, 2019 at 11:43:33 PM UTC-4, Mike Orr wrote: > 'session.execute()' executes SQL like 'engine.execute()' does, so you > can get the advantages of a request transaction without using ORM > queries. > in addition to Mike's comments - make sure to read the zope.sqlalchemy

[pylons-discuss] pyramid_csrf_multi_scheme v0.0.7 released; feedback welcome

2019-04-17 Thread Jonathan Vanasco
I updated pyramid_csrf_multi_scheme to work with the 1.10 line of pyramid on github (https://github.com/jvanasco/pyramid_csrf_multi_scheme ) and pypi (pyramid_csrf_multi_scheme) the package is designed for people who need to support csrf in a mixed scheme environment, and offers

[pylons-discuss] Re: Pyramid 1.10.3 released

2019-04-12 Thread Jonathan Vanasco
On Friday, April 12, 2019 at 1:30:21 AM UTC-4, Michael Merickel wrote: > > 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. > WOO HOO! thank you! -- You received this message because you are

Re: [pylons-discuss] `reload` detecting changes to mako templates (again)

2019-04-01 Thread Jonathan Vanasco
On Friday, March 29, 2019 at 8:24:27 PM UTC-4, Bert JW Regeer wrote: > > Mako templates are compiled and imported, when that file is updated the > reloader likely sees it, unless it is detecting the file changing on disk. > > For the former: I am not sure how to necessarily stop that from >

[pylons-discuss] `reload` detecting changes to mako templates (again)

2019-03-29 Thread Jonathan Vanasco
This happens every so often, but on a large project is making editing the HTML incredibly tedious. Does anyone have a good strategy for tracking down which component is breaking this and effectively whitelisting the /data directory -- You received this message because you are subscribed to

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

2019-03-21 Thread Jonathan Vanasco
On Thursday, March 21, 2019 at 12:57:36 PM UTC-4, Mike Orr wrote: > > If the reason you want to know whether you're running under bootstrap > is to determine whether logging has been configured, > We log every startup/invocation of the app/scripts to a centralized database. There's a table

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

2019-03-20 Thread Jonathan Vanasco
On Wednesday, March 20, 2019 at 2:22:12 PM UTC-4, Michael Merickel wrote: > > The hackiest option possible is to just set a global variable somewhere > when you use bootstrap. Otherwise you could use a custom setting. > Oh, I can think of hackier ways! One thing I considered was overriding

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

2019-03-20 Thread Jonathan Vanasco
Thanks for the quick reply, Michael. I'll have to ponder a solution to this problem for 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

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

2019-03-13 Thread Jonathan Vanasco
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`? i'm trying to sketch out a (public) plugin that can log application startups and invocations. -- You received this message because you are

Re: [pylons-discuss] Pylons Project Assimilation team meeting minutes from 2019-02-25

2019-03-01 Thread Jonathan Vanasco
Thanks for the heads up. This all makes perfect sense. It was just weird seeing "minutes" posted with no previous announcements by this. i thought I missed something and couldn't figure out how! -- You received this message because you are subscribed to the Google Groups "pylons-discuss"

[pylons-discuss] Re: Pylons Project Assimilation team meeting minutes from 2019-02-25

2019-02-28 Thread Jonathan Vanasco
can you share anything on this migration/etc? there have only been two posts about this as minutes, but no other announcements that I could find. -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop

[pylons-discuss] Re: Testing Pyramid Traversal App with ZODB

2019-02-27 Thread Jonathan Vanasco
We use SqlAlchemy but perhaps this will still help: We test anything dealing with transactions via Functional Tests or sometimes Integrated Tests, not Unit Tests. For Functional Tests, look for examples in the docs that are based on `from webtest import TestApp`. I think I have an open source

[pylons-discuss] Re: GSOC 2019

2019-01-17 Thread Jonathan Vanasco
there are some GSOC brainstorming/operations/etc docs from other years that can help you get started: https://github.com/pylons/pyramid/wiki -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop receiving

[pylons-discuss] Re: Convert Response to HTTP, and a JSON error response

2019-01-11 Thread Jonathan Vanasco
To accomplish something similar, i use a mix of custom exceptions and pyramid's exception handling. I have a class in my exceptions.py like this... class ViewExceptionJsonForm(Exception): def __init__(self, ... ): ... setup with args, which might contain the Form, a Wrapped

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

2019-01-10 Thread Jonathan Vanasco
On Thursday, January 10, 2019 at 8:27:35 AM UTC-5, Zsolt Ero wrote: > > So I guess the simplest possible solution is Celery + Redis (since I'm > already using Redis for sessions), I guess? > > Yes. The performance you want requires a secondary process to handle the event logging. Celery is

[pylons-discuss] Re: Waitress 1.2.0 beta 1

2019-01-07 Thread Jonathan Vanasco
On Monday, January 7, 2019 at 5:00:43 PM UTC-5, Jonathan Vanasco wrote: > > > It would be nice if that functionality could be implemented as middleware > when not running the waitress server. > This release broke our dev systems from the wsgi manipulation. The issue was this li

[pylons-discuss] Re: Waitress 1.2.0 beta 1

2019-01-07 Thread Jonathan Vanasco
On Monday, December 31, 2018 at 4:12:10 PM UTC-5, Bert JW Regeer wrote: > > > Please note that in the future Waitress is going to be more secure by > default, and will strip known proxy headers before forwarding them on in > the WSGI environ to help protect WSGI applications from accidentally

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

2018-12-09 Thread Jonathan Vanasco
I may have missed something, but it looks like the 'secure' bit of the cookie is in the settings, but not the value. >From a pyramid standpoint, this would be a step backwards - as the default policy is a signed cookie. My 2¢: your package should implement signed cookies by default... and

[pylons-discuss] in search of: pattern for integrated testing that pyramid handles certain exceptions/errors correctly

2018-11-20 Thread Jonathan Vanasco
we have a suite of tests to ensure that a Pyramid app 'breaks' correctly. for example: if connectivity with Redis or a SqlAlchemy server is lost, there is some specific error processing and results handled via exception views; some other potential issues are handled via tweens. the current

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

2018-11-15 Thread Jonathan Vanasco
On Thursday, November 15, 2018 at 5:43:56 PM UTC-5, Brian Herman wrote: > > Oh cool there is sorry for the spam > https://docs.pylonsproject.org/projects/pyramid-cookbook/en/latest/deployment/forked_threaded_servers.html > > it depends on the container you run pyramid in - they each have a

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

2018-11-15 Thread Jonathan Vanasco
A few things that jump out at me: 1. it looks like your `PN` class is creating 10 different `Client` objects which each start a persistent(?) connection to the SOAP server when created. that's a huge factor in overloading the connections. 2. I'm not familiar with your SOAP library. are these

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

2018-10-09 Thread Jonathan Vanasco
On Tuesday, October 9, 2018 at 12:08:35 PM UTC-4, Bert JW Regeer wrote: > > I would disagree, heavily. You want to create your globals once, then > fork. This way the memory used by said global can be shared between all of > the processes. +1 -- You received this message because you are

Re: [pylons-discuss] Ethical Ads on Pylons Project documentation

2018-09-19 Thread Jonathan Vanasco
Sure. -- 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. To post to this group, send email to

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

2018-09-03 Thread Jonathan Vanasco
+1 on being explicit by passing around the request (or something similar). there are way too many edge cases when you try to compute the current request/transaction, and it's incredibly hard (a nightmare) to write tests that work correctly when you rely on the derived/computed methods. -- You

[pylons-discuss] creating a simple pyramid application for a test suite?

2018-08-14 Thread Jonathan Vanasco
another testing question! I'm in the process of splitting out our oauthlib integration for pyramid (it's much more lowlevel than the existing app) after some design changes to make the integrated testing work better (which was my last question). Now I'm trying to figure out the best way to

[pylons-discuss] triggering failures during integrated tests?

2018-08-10 Thread Jonathan Vanasco
One of my applications provides both an oAuth1 server for authentication and client for requesting authorization. Unit tests are fine, but I'd like to trigger failure on certain phases during the integrated tests, and could use some advice. The types of things I'm hoping to test, are basically

Re: [pylons-discuss] Re: New Package for Integrating Mongodb

2018-08-01 Thread Jonathan Vanasco
On Wednesday, August 1, 2018 at 3:41:39 AM UTC-4, Jonathan Mackenzie wrote: > > I've updated the package now, > > https://github.com/jonnoFTW/pyramid_mongodb2 > > Everything is integrated into a single package. And now you can alias > database names to make testing easier. > >> wow, the

[pylons-discuss] Re: New Package for Integrating Mongodb

2018-07-28 Thread Jonathan Vanasco
On Saturday, July 28, 2018 at 2:05:05 AM UTC-4, Jonathan Mackenzie wrote: > > Lack of thought I guess, I should probably merge them and use a config > variable to turn debugging on.. > IMHO I really like the idea of Pyramid packages that ship with a built-in debug_toolbar support. -- You

[pylons-discuss] Re: What types of resources are appropriate to store in a NoSQL database?

2018-07-27 Thread Jonathan Vanasco
On Thursday, July 26, 2018 at 2:30:31 PM UTC-4, Benjamin Polen wrote: > what web resources should I store there. None. On Thursday, July 26, 2018 at 2:30:31 PM UTC-4, Benjamin Polen wrote: > For example, should html files, jinja2 templates, javascript files images, > css be stored in my

[pylons-discuss] Re: New Package for Integrating Mongodb

2018-07-27 Thread Jonathan Vanasco
any reason why you decided to split the toolbar into a separate package, instead of including it? -- 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] feedback needed for new/rebranded package - g_analytics_writer

2018-07-25 Thread Jonathan Vanasco
i've replaced an earlier package that writes for the "ga.js" library with `g_analytics_writer` - a unified way to generate *simple* tracking analytics for "Google Analytics" in Pyramid apps. It offers a unified API for 'telling the package what to track', then will generate optimized analytics

Re: [pylons-discuss] some waitress design questions

2018-07-17 Thread Jonathan Vanasco
On Tuesday, July 17, 2018 at 7:46:59 PM UTC-4, Bert JW Regeer wrote: > > The threads that run the WSGI app are pre-spawned, they wait on a new > request to be added to a queue, peel one off, pass it down the WSGI app, > and then back. > ... > What are you trying to do with a "max requests"? >

[pylons-discuss] some waitress design questions

2018-07-17 Thread Jonathan Vanasco
does anyone know if the workers in waitress are spawned as-needed for each request, or if they are pre-spawned and answer requests when available? I think it is the latter. if so, is there a reasonable chance of having a max-requests feature implemented (or would this be possible to kludge

Re: [pylons-discuss] Re: noob question about redirections

2018-07-17 Thread Jonathan Vanasco
On Tuesday, July 17, 2018 at 12:45:26 AM UTC-4, jg...@live.com.mx wrote: > so, to make this clear to me: the POST made from javascript is not > equivalent to a POST made in html, the hmtl POST automatically refreshs > page or something like that? > This may sound confusing... but their

[pylons-discuss] Re: noob question about redirections

2018-07-17 Thread Jonathan Vanasco
the issue is in your javascript; the browser will never render the template on this setup. when you view /test via GET (or missing one or more required POST items), templates/jg.pt is rendered. when you view /test via POST with both variables present, the response is a redirect (HTTPFound)

[pylons-discuss] new release/branch of pyramid_formencode_classic

2018-07-11 Thread Jonathan Vanasco
i released the 0.2.x branch of `pyramid_formencode_classic` yesterday, and just updated it to `0.2.2` with some packaging fixes and built-in debugtoolbar support. the package is an adaptation of the pylons' formencode integration into pyramid. it does not work exactly the same (no pylons style

Re: [pylons-discuss] WebTest 2.0.30 has been released.

2018-06-25 Thread Jonathan Vanasco
clarification: oAuth2 supports some other flows/tokens too - but the Bearer concept is vert common. -- 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

Re: [pylons-discuss] WebTest 2.0.30 has been released.

2018-06-25 Thread Jonathan Vanasco
On Saturday, June 23, 2018 at 2:26:55 PM UTC-4, Gael Pasgrimaud wrote: > > It's like basic auth but use tokens in the Authorization headers instead > of base64(user:pass). It's a bit more secure... JWT token may also > contains > some extra data (user infos, api scope, etc.) but those are

[pylons-discuss] pyramid_mailer and html email

2018-06-22 Thread Jonathan Vanasco
I've been lazy and just implemeted html email via pyramid_mailer as quoted-printable email_html = Attachment(data=email_html, disposition='inline', transfer_encoding='quoted-printable') i realized the pyramid_mailer encoders don't implement any of the email quirks for old RFCs and

Re: [pylons-discuss] redis debugging?

2018-06-22 Thread Jonathan Vanasco
great! i'll try to split some of my test stuff out and put it on github. -- 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] redis debugging?

2018-06-19 Thread Jonathan Vanasco
i've been toying with a debugtoolbar for redis connections. the big issue is that python's redis doesn't have any sort of logging or callback facility as a workaround, i've been using a proxy class as a logger... which requires manually wrapping/replacing the redis client objects. because of

Re: [pylons-discuss] WebOb 1.8.2 has been released

2018-06-06 Thread Jonathan Vanasco
On Wednesday, June 6, 2018 at 2:04:20 PM UTC-4, Bert JW Regeer wrote: > > Recently some changes were made to remove any last references to `key`, so > that things would error if you did try to use it, but those are on master > only and have not been back ported to 1.8-branch (yet, I may still

[pylons-discuss] Re: WebOb 1.8.2 has been released

2018-06-06 Thread Jonathan Vanasco
I believe this is also the first release that no longer accepts the kwarg "key". it's functionality was deprecated years ago, and it was officially removed a few years back too. a kwarg that does nothing was left in a few spots though. if anyone experiences errors from this, their code was

[pylons-discuss] Re: is it possible to execute code at a certain point in accessing a view?

2018-05-06 Thread Jonathan Vanasco
Thanks a ton, Bert! This is exactly the sort of functionality I was hoping for. I had seen the L114-L139 reference you

[pylons-discuss] is it possible to execute code at a certain point in accessing a view?

2018-05-06 Thread Jonathan Vanasco
I'm doing some housekeeping on an app that has been a bit too lax on keeping to it's own coding standards. There have been a bunch of updates over the past few years to the views systems, so I'm hoping something may work for our needs... In a handful of sections, it utilize class based views

[pylons-discuss] Re: Suggested way to issue requests from inside a view callable

2018-05-01 Thread Jonathan Vanasco
On Tuesday, May 1, 2018 at 5:34:15 PM UTC-4, jens.t...@gmail.com wrote: > > > Jonathan, funny you mention Celery. I have used it for a while but the > experience has been horrible—the thing is ridden with bugs and problems, > barely maintained, and the list of issues on Github grows daily.

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

2018-05-01 Thread Jonathan Vanasco
On Tuesday, May 1, 2018 at 1:17:31 AM UTC-4, jens.t...@gmail.com wrote: > I’ve followed the suggested cookie cutter code exactly: > https://github.com/Pylons/pyramid-cookiecutter-alchemy, which uses > pyramid_tm and adds the SQLA session to that transaction manager. > Are you passing in

[pylons-discuss] Re: Suggested way to issue requests from inside a view callable

2018-05-01 Thread Jonathan Vanasco
It depends on what you're communicating with, and why. If your synchronous tasks are done "quickly" or must be "blocking" -- like doing some oAuth or hitting an external API that is guaranteed to return a request within a second or two, I would just use `requests` from within Pyramid. If

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

2018-04-29 Thread Jonathan Vanasco
On Saturday, April 28, 2018 at 5:45:23 AM UTC-4, jens.t...@gmail.com wrote: > > From within the view function (i.e. handling the incoming request) I issue > 5 subrequests one after the other. Doing so I noticed that the number of > subrequests was bound by the pool_size + max_overflow, hence

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

2018-04-26 Thread Jonathan Vanasco
I'm confused by wording on this, or perhaps the functionality in Pyramid. > When I set the pool_size of the engine to *N* and max_overflow

Re: [pylons-discuss] API file upload

2018-04-19 Thread Jonathan Vanasco
On Wednesday, April 18, 2018 at 4:54:41 PM UTC-4, Bert JW Regeer wrote: > > Using request.body_file is actually better than using body_file_raw. The > raw reads directly from the underlying wsgi.input, which means if you are > using wsgiref or some other server that doesn't correctly input

[pylons-discuss] Re: API file upload

2018-04-18 Thread Jonathan Vanasco
I was confused on this years ago. The problem is in naming... `curl` is concerned with the HTTP method `POST`. Let's call that `HTTP POST`. If you look at the `curl` documents for the difference on the various `--data-` options. Those options will `HTTP POST` data in different formats

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

2018-04-10 Thread Jonathan Vanasco
On Monday, April 9, 2018 at 8:45:45 AM UTC-4, Tres Seaver wrote: > > > Somewhere after there, i believe. It depends on the server. uwsgi and > > unicorn do it in different places. i think waitress essentially does it > > too. > > Waitress is not a forking implementation: it uses threads.

[pylons-discuss] Re: Linode sponsors Pylons Project web hosting for 3 years

2018-04-04 Thread Jonathan Vanasco
I've been using linode for several years. They're great. -- 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. To post

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

2018-04-02 Thread Jonathan Vanasco
I confirmed with mike @ sqlalchemy. calling `dispose()` will not explicitly `close()` connections that are already checked out. It just gets rid of the the connection pool instance, so you have fresh connections in the child processes-- the pre-fork connections themselves will be garbage

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

2018-04-02 Thread Jonathan Vanasco
On Monday, April 2, 2018 at 12:09:26 PM UTC-4, Zsolt Ero wrote: > So if I understand right, the engine in a gunicorn / process worker > Pyramid app is global / shared between all processes, right? And at > the time of forking, there should be no dbsessions being active and no > connections

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

2018-04-02 Thread Jonathan Vanasco
On Monday, April 2, 2018 at 12:07:14 PM UTC-4, Bert JW Regeer wrote: > > > This is only required if you are not using pyramid_tm. If you are using > pyramid_tm which is what the sqlalchemy cookie cutter does, you do NOT need > to add this. > Thanks, Bert. I stand corrected. pyarmid_tm has a

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

2018-04-02 Thread Jonathan Vanasco
On Sunday, April 1, 2018 at 8:18:39 PM UTC-4, Zsolt Ero wrote: > > Hi Jonathan, > > I'm not 100% sure I understand when are you talking about the > "standard" Pyramid way of the cookiecutter template's get_tm_session's > implementation and when are you talking about my special addition of >

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

2018-04-01 Thread Jonathan Vanasco
Pyramid isn't opening the database connection, the SqlAlchemy pool is. On first glance, you're connecting to the database in your main(). This is guaranteed to create issues with SqlAlchemy's connection pool when you involve multiple workers/threads/processes. In some situations the

[pylons-discuss] Re: Help converting Pylons {name}{.format} style routes to Pyramid

2018-03-22 Thread Jonathan Vanasco
There's also some pyramid docs on predicates and route factory under URL dispatch. I think that might be what you need - there are some threads in this group on those topics. I also wrote a library `pyramid_route_7` (https://github.com/jvanasco/pyramid_route_7) that extends the config to

Re: [pylons-discuss] Re: CSRF token implementation

2017-12-12 Thread Jonathan Vanasco
you're absolutely correct. i used a very bad choice of words and should have been specific because I was thinking of something weird. i meant to refer to using the new storage policy to implement the "encrypted token pattern", which basically bootstraps a micro session into a first dedicated

[pylons-discuss] Re: CSRF token implementation

2017-12-12 Thread Jonathan Vanasco
There's not enough here for me to guess why, but I wanted to note in Pyramid 1.9.x you can store the CSRF in a cookie (instead of in the session). It may be worth upgrading to use the new storage policy (and compare two cookies) before fixing this. -- You received this message because you

Re: [pylons-discuss] is there an easy way to handle a unique http and https CSRF tokens ?

2017-12-06 Thread Jonathan Vanasco
I ended up writing a small utility with debugtoolbar support for this https://github.com/jvanasco/pyramid_csrf_multi_scheme I'm not entirely sure it's needed, but leaned towards "better safe than sorry". -- You received this message because you are subscribed to the Google Groups

Re: [pylons-discuss] is there an easy way to handle a unique http and https CSRF tokens ?

2017-12-04 Thread Jonathan Vanasco
On Monday, December 4, 2017 at 3:31:19 PM UTC-5, Michael Merickel wrote: > > > I'm in the process of migrating to the new cookie based csrf policy, > and it doesn't seem like there is an easy way to run different tokens on > HTTP vs HTTPS short of writing a new ICSRFStoragePolicy utility and

[pylons-discuss] is there an easy way to handle a unique http and https CSRF tokens ?

2017-12-04 Thread Jonathan Vanasco
We strive for 100% HTTPS, but need to support some HTTP endpoints. Those endpoints have CSRF needs. I'm in the process of migrating to the new cookie based csrf policy, and it doesn't seem like there is an easy way to run different tokens on HTTP vs HTTPS short of writing a new

[pylons-discuss] Re: handling multiple "sessions"

2017-12-02 Thread Jonathan Vanasco
I cobbled together a first version this afternoon - https://github.com/jvanasco/pyramid_session_multi if anyone has suggestions, please share. -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop receiving

[pylons-discuss] handling multiple "sessions"

2017-12-01 Thread Jonathan Vanasco
Has anyone done work on this and can offer any learnings/gotchas? I need to handle multiple "session" containers each request object. One of our products is a platform with whitelabel functionality, so a request can happen on the platform domain OR a partner domain, and can be stored

[pylons-discuss] Re: How to handle DB transaction failures/request race conditions

2017-11-27 Thread Jonathan Vanasco
The sqlalchemy cookie cutter uses pyramid_tm to handle the transaction. The docs on that package should answer all your questions: https://docs.pylonsproject.org/projects/pyramid_tm/en/latest/ Basically what happens is this: * the actual transaction management is provided by zope's

[pylons-discuss] Re: Recommended way to modify view return value

2017-10-30 Thread Jonathan Vanasco
> > I considered building a custom renderer, but I can’t figure how I’d pass > the schema into it. I could also just use a vanilla decorator, but that covers up the view call > signature. I do similar stuff in a variety of ways. I almost-always augment the request object with an

Re: [pylons-discuss] Pyramid_tm reason for ROLLBACK

2017-10-06 Thread Jonathan Vanasco
The error is most likely in your Pyramid code. If SqlAlchemy failed, there would be a SqlAlchemy error logged. Your example shows SqlAlchemy completing an INSERT, but then being instructed to ROLLBACK by the transaction manager. You should increase your Pyramid logging levels. Between your

[pylons-discuss] Re: Distributing a REST API Pyramid project

2017-09-29 Thread Jonathan Vanasco
originally we did your approach, but now we use multiple discrete packages, and manage the virtualenv with fabric |python_packages/ | |app_pyramid/ | | |---setup.py | | |---app_pyramid/ | |app_core/ | | |---setup.py | |

[pylons-discuss] Re: Porting a ZOPE (2.13) application into PYRAMID

2017-09-20 Thread Jonathan Vanasco
+1 to the advice above on a gradual migration via failovers or "strangler" One method that once worked well for me in the past: viewing everything as a Service Oriented Architecture and extending the old system with new routes that enabled it to be the Auth/Login component for the new system.

[pylons-discuss] has anyone made a tween/middleware/etc to adapt status codes depending on http protocol?

2017-09-14 Thread Jonathan Vanasco
Hoping to not reinvent the wheel if possible... I'd like to write our code redirects as HTTP/1.1 when applicable (such as 303SeeOther on a successful post submission), but downgrade it to HTTP/1.0's 302 redirect if the client hasn't identified HTTP/1.1. Has anyone worked on this? -- You

[pylons-discuss] Re: Recommendation for a Python-based wiki

2017-09-04 Thread Jonathan Vanasco
A lot of the hosted commercial services are freemium. i think pbwiki gives you a handful of users on their free tier -- all you really need are 2 users (one set of credentials for you, another one for your clients) -- You received this message because you are subscribed to the Google Groups

[pylons-discuss] odd edge-case that I can't re-create

2017-09-01 Thread Jonathan Vanasco
one of our login forms had an error on it. we log python exceptions to sql in a tween (pretty much using the same logic as in pyramid_exclog) under pyramid 1.8.3 here's the edge case: the broken form got hit by a botnet, and the nonstop errors ate up all the space on the dedicated postgreql

Re: [pylons-discuss] Minor encoding problem

2017-07-06 Thread Jonathan Vanasco
On Thursday, July 6, 2017 at 4:56:13 AM UTC-4, Steve Piercy wrote: > > I would suspect one of your Apache's not setting the character set to > UTF-8, but something less robust or not at all. I read the question above wrong, and thought the issue was in reading a file - not serving it.

<    1   2   3   4   5   6   7   8   9   10   >