[pylons-discuss] Pyramid + ZODB persistent registry

2014-10-13 Thread Thierry Florac
Hi,

I'm actually starting to study Pyramid.
My main goal is to be able to upgrade several quite huge applications which 
are actually based on Zope 3 and heavily use the ZCA, without too much 
rewriting.

One of our main use case is to define site managers (or local component 
registries), to be able to define utilities whose definition, settings and 
registration are stored in the ZODB.
In Zope3, the process to get a given registered utility (with 
getUtility/queryUtility) is then straightforward and automatic, as 
utilities lookup is done in context local registry before the global 
registry.

So I just have a simple question : is there an easy way with Pyramid to 
make such a behaviour simple and automatic?
I already know how to create a local site manager, but how can I make 
lookups as in Zope3 ??

Thanks for any help...

Best regards,
Thierry

-- 
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 pylons-discuss@googlegroups.com.
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.


Re: [pylons-discuss] Pyramid + ZODB persistent registry

2014-10-14 Thread Thierry Florac
Hi,

For your information, this is the code I've produced to use local
components registry:

@subscriber(ContextFound)
def onContextFound(event):
context = event.request.context
if ISite.providedBy(context):
pyramid.threadlocal.manager.push({'registry':
context.getSiteManager(),
  'request': event.request})

So simple!
After that, the only difference with common Zope3 code is when calling for
a utility or adapter, because I have to use:

util = get_current_registry().queryUtility(IUtility)

I tried to use zope.component.hooks.setSite() function into subscriber
code, but it doesn't seem to do anything in a Pyramid application...

Any better idea?

Best regards,
Thierry


2014-10-14 7:49 GMT+02:00 Wichert Akkerman wich...@wiggy.net:


  On 14 Oct 2014, at 04:25, Tres Seaver tsea...@palladion.com wrote:
 
  -BEGIN PGP SIGNED MESSAGE-
  Hash: SHA1
 
  On 10/13/2014 09:54 PM, Chris Rossi wrote:
  My naive first take is just write a utility method:
 
  def find_sitemanager(context):  Find nearest site manager, walking
  back up the tree from 'context'. 
 
  Then, don't use the global API, but call getUtility and queryUtility
  on the local registry that you find with your utility method.
 
  (Totally untested) You could subscribe to the IContextFound event, and
  set the sitemanager based on context from within it:  the global APIs
  would Just Work at that point.

 I bet you can also (and perhaps must?) update request.registry to the
 closest found registry at that point.

 Wichert.

 --
 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 pylons-discuss@googlegroups.com.
 Visit this group at http://groups.google.com/group/pylons-discuss.
 For more options, visit https://groups.google.com/d/optout.




-- 
http://www.imagesdusport.com -- http://www.ztfy.org

-- 
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 pylons-discuss@googlegroups.com.
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.


[pylons-discuss] Pyramid and namespaces

2014-10-15 Thread Thierry Florac
Hi,

Always on the road to adapting a Zope 3 application to Pyramid...

Another of my problems is that Zope3 is handling namespace traversers;
for example, you can use URLs like /++skin++MySkin/...,
/++etc++site/..., or anything else by defining custom namespaces.
In my use case, the goal of such namespaces is generally to get a resource
throught an adapter. For example: myimage/++display++500x500.png will use
an adapter to get a thumbnail of 500x500 px of an image.

My question is simple: what is the best way with Pyramid to handle such
case? Should I have to write a custom traverser? Use a router ??
Maybe it looks like an hybrid URL, but where traversing should be used
before routing...?

Thanks for any advise,
Thierry
-- 
http://www.imagesdusport.com -- http://www.ztfy.org

-- 
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 pylons-discuss@googlegroups.com.
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.


Re: [pylons-discuss] Re: Pyramid and namespaces

2014-10-16 Thread Thierry Florac
Hi,

That looks quite elegant!
But the namespace has sometimes been recorded into resources __name__
attribute, so is actually present into their URLs, and I'll probably have
to keep it for compatibility reasons... :-/
I've already implemented a first version of a custom enhanced traverser
based on default Pyramid traverser and it seems to work quite well.
But your solution may be more elegant for future use cases...

Best regards,
Thierry


2014-10-16 7:42 GMT+02:00 Laurence Rowe laurencer...@gmail.com:



 On Wednesday, 15 October 2014 05:35:19 UTC-7, Thierry Florac wrote:

 Hi,

 Always on the road to adapting a Zope 3 application to Pyramid...

 Another of my problems is that Zope3 is handling namespace traversers;
 for example, you can use URLs like /++skin++MySkin/...,
 /++etc++site/..., or anything else by defining custom namespaces.
 In my use case, the goal of such namespaces is generally to get a
 resource throught an adapter. For example: myimage/++display++500x500.png
 will use an adapter to get a thumbnail of 500x500 px of an image.

 My question is simple: what is the best way with Pyramid to handle such
 case? Should I have to write a custom traverser? Use a router ??
 Maybe it looks like an hybrid URL, but where traversing should be used
 before routing...?


 If you are only using namespace traversers at the end of the url, consider
 replacing them with a view addressed like myimage/@@display/500x500.png

 In that view you can access the request.subpath == ['500x500.png']

 Laurence

 --
 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 pylons-discuss@googlegroups.com.
 Visit this group at http://groups.google.com/group/pylons-discuss.
 For more options, visit https://groups.google.com/d/optout.




-- 
http://www.imagesdusport.com -- http://www.ztfy.org

-- 
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 pylons-discuss@googlegroups.com.
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.


[pylons-discuss] Pyramid and zope.pluggableauth / zope.securitypolicy

2014-10-21 Thread Thierry Florac
Hi,

Always trying to move from Zope3 to Pyramid...
After implementing traversal namespaces, I now need to convert other
important packages which are zope.pluggableauth and zope.securitypolicy.
Most of my applications security policy is actually based on these
packages, so I'm asking if anyone has any experience in a migration, or in
using these packages natively with Pyramid ?

Best regards,
Thierry
-- 
http://www.imagesdusport.com -- http://www.ztfy.org

-- 
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 pylons-discuss@googlegroups.com.
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.


Re: [pylons-discuss] Re: Pyramid fulltext catalog

2015-01-18 Thread Thierry Florac
Thanks for the link.
Do you know of any fulltext indexing solution?

Best regards,
Thierry

2015-01-18 17:43 GMT+01:00 Tres Seaver tsea...@palladion.com:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 On 01/17/2015 07:28 PM, Thierry Florac wrote:
  Hi,
 
  I've written many Zope applications using zope.catalog package, along
  with zopyx.txng3 for fulltext indexing. I actually need to rewrite
  these applications for Pyramid with Python 3.4, but the later one
  doesn't seem to support Python 3... So what is actually the best way
  to manage indexing, including fulltext indexing, with
  Pyramid/Python3.4 ??

 SubstanceD uses hypatia:

  https://pypi.python.org/pypi/hypatia

 which was forked from zope.catalog and zope.index.



 Tres.
 - --
 ===
 Tres Seaver  +1 540-429-0999  tsea...@palladion.com
 Palladion Software   Excellence by Designhttp://palladion.com
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.11 (GNU/Linux)

 iEYEARECAAYFAlS74qAACgkQ+gerLs4ltQ5gegCgvq/f37c1bBe9tpBXr0kAP2f8
 9hwAn1o+szn+TP/4B1F6iGEV9Qy3kWRf
 =deoc
 -END PGP SIGNATURE-

 --
 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 pylons-discuss@googlegroups.com.
 Visit this group at http://groups.google.com/group/pylons-discuss.
 For more options, visit https://groups.google.com/d/optout.




-- 
http://www.imagesdusport.com -- http://www.ztfy.org

-- 
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 pylons-discuss@googlegroups.com.
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.


Re: [pylons-discuss] Re: Pyramid fulltext catalog

2015-01-18 Thread Thierry Florac
Thanks ;-)
Thierry

2015-01-18 23:39 GMT+01:00 Tres Seaver tsea...@palladion.com:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 On 01/18/2015 05:31 PM, Thierry Florac wrote:
  Thanks for the link. Do you know of any fulltext indexing solution?

 Hypatia ships with a text index, derived from the one in 'zope.index'
 (and the Zope2 'ZCTextIndex' before that):

  https://github.com/Pylons/hypatia/tree/master/hypatia/text



 Tres.
 - --
 ===
 Tres Seaver  +1 540-429-0999  tsea...@palladion.com
 Palladion Software   Excellence by Designhttp://palladion.com
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.11 (GNU/Linux)

 iEYEARECAAYFAlS8NhwACgkQ+gerLs4ltQ7M/wCgx0sLNK2kQh2NuheY4dm5EWm3
 nXMAn3NR4maiah1IFEY1FE37mNJMed+h
 =quG3
 -END PGP SIGNATURE-

 --
 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 pylons-discuss@googlegroups.com.
 Visit this group at http://groups.google.com/group/pylons-discuss.
 For more options, visit https://groups.google.com/d/optout.




-- 
http://www.imagesdusport.com -- http://www.ztfy.org

-- 
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 pylons-discuss@googlegroups.com.
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.


[pylons-discuss] Writing custom Chameleon expression

2015-01-27 Thread Thierry Florac
Hi,

Based on Chameleon documentation, I'm trying to write a custom provider:
TALES expression which will allow to load another content provider
template, based on a registered named adapter.
The code is as follow:

class ProviderExpression(object):
provider: TALES expression

def __init__(self, expression):
self.expression = expression

def __call__(self, target, engine):
request = get_current_request()
registry = request.registry
provider = registry.queryMultiAdapter((request.context, request,
request.annotations['view']),
  IContentProvider,
name=self.expression)
if provider is None:
raise ContentProviderLookupError(self.expression)
provider.update()
value = ast.Str(provider.render())
return [ast.Assign(targets=[target], value=value)]

PageTemplateFile.expression_types['provider'] = ProviderExpression

My problem with this is simple: when the main template is loaded for the
first time, everything is OK. But afterwards, the output of the content
provider is cached and the dynamic elements are not executed anymore!
What is the way to handle this?

Best regards,
Thierry
-- 
http://www.imagesdusport.com -- http://www.ztfy.org

-- 
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 pylons-discuss@googlegroups.com.
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.


[pylons-discuss] Can't register TALES expression

2015-01-25 Thread Thierry Florac
Hi,
On the model of zope.contentprovider provider: TALES expression, I'm
trying to register a new custom expression for Chameleon.
My code is very simple and tries to follow Chamelon documentation:

from chameleon import PageTemplate

def provider_expression(string):
def compiler(target, engine):
return 'provider expression...'
return compiler

PageTemplate.expression_types['provider'] = provider_expression

The view is as simple:

@view_config(name=page.html, context=MyApplication, renderer='page.pt')
def main_page(request):
return {}

And the template:

div tal:replace=provider:testManagertest/div

When the page is loaded, I always receive a LookupError: Unknown
expression type: 'provider'..

Any idea?

Best regards,
Thierry

-- 
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 pylons-discuss@googlegroups.com.
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.


[pylons-discuss] Re: Can't register TALES expression

2015-01-25 Thread Thierry Florac
Probably found!
I had to use PageTemplateFile.expression_types...

Regards,
Thierry

2015-01-25 13:36 GMT+01:00 Thierry Florac tflo...@gmail.com:

 Hi,
 On the model of zope.contentprovider provider: TALES expression, I'm
 trying to register a new custom expression for Chameleon.
 My code is very simple and tries to follow Chamelon documentation:

 from chameleon import PageTemplate

 def provider_expression(string):
 def compiler(target, engine):
 return 'provider expression...'
 return compiler

 PageTemplate.expression_types['provider'] = provider_expression

 The view is as simple:

 @view_config(name=page.html, context=MyApplication, renderer='page.pt')
 def main_page(request):
 return {}

 And the template:

 div tal:replace=provider:testManagertest/div

 When the page is loaded, I always receive a LookupError: Unknown
 expression type: 'provider'..

 Any idea?

 Best regards,
 Thierry




-- 
http://www.imagesdusport.com -- http://www.ztfy.org

-- 
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 pylons-discuss@googlegroups.com.
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.


[pylons-discuss] Request property in testing code

2015-01-24 Thread Thierry Florac
Hi,

I slowly discover Pyramid...
I'm trying to write testing code in a Pyramid package using custom request
properties.
For example :

 from pyramid.testing import setUp, tearDown, DummyRequest
 config = setUp()
 config.add_request_method(get_annotations, 'annotations',
reify=True)
 request = DummyRequest()
 request.annotations

AttributeError: 'Request' object has no attribute 'annotations'

I also tried using Request.blank() to create a new request, with the same
result.

Any help?

Thanks,
Thierry
-- 
http://www.imagesdusport.com -- http://www.ztfy.org

-- 
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 pylons-discuss@googlegroups.com.
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.


Re: [pylons-discuss] Extracting Translation string from .py files.

2015-03-30 Thread Thierry Florac
Hi,
Did you tried using the TranslationStringFactory instead?

from pyramid.i18n import TranslationStringFactory_ =
TranslationStringFactory('eventbroker')
...

error_notaicalfile = _(The given Address didn't return...)

request.localizer.translate(error_notaicalfile)

I use this method with lingua and it works perfectly...

Best regards,
Thierry

2015-03-30 9:27 GMT+02:00 Gerhard Schmidt esta...@augusta.de:

 Hi,

 i developing a pyramid application with i18n support. I've setup pyramid
 to use lingua and as far as I user i18n tag in chameleon templates
 pot-create extracting them correctly.

 But translation strings from python code is not extracted.

 I am following the documentation at
 http://docs.pylonsproject.org/docs/pyramid/en/latest/narr/i18n.html


 error_notaicalfile = TranslationString(The given Address didn't return
 a calendar file, domain='eventbroker')

 and in the view i use

 request.localizer.translate(error_notaicalfile)

 Am I doing something wrong.

 Regards
Estartu


 --
 ---
 Gerhard Schmidt| http://www.augusta.de/~estartu |
 Fischbachweg 3 || PGP Public Key
 86856 Hiltenfingen | JabberID: esta...@augusta.de   | on request
 Germany||


 --
 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 pylons-discuss@googlegroups.com.
 Visit this group at http://groups.google.com/group/pylons-discuss.
 For more options, visit https://groups.google.com/d/optout.




-- 
http://www.imagesdusport.com -- http://www.ztfy.org

-- 
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 pylons-discuss@googlegroups.com.
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.


Re: [pylons-discuss] Pyramid + authentication via Facebook, Twitter, ...

2015-04-15 Thread Thierry Florac
Hi,

I use Authomatic and I'm happy with it...  ;-)

Best regards,
Thierry
Le 15 avr. 2015 21:54, Achim Domma do...@procoders.net a écrit :

 Hi,

 I'm starting a small just-for-fun app, where I require users to login. I
 don't want to implement user management on my own, so I would like to allow
 only authentication via Facebook, Twitter, ... or any OAuth provider. I
 looked around, but it's hard to get a clear picture what's the way to go.
 For example Velruse seems to be quite feature complete, but has not been
 changed for quite some time. Sure, there is probably not much to change,
 but ... So I thought I might ask here: If you start a new Pyramid app and
 would like to have easy external user authentication, what would your way
 to go?

 cheers,
 Achim

 --
 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 pylons-discuss@googlegroups.com.
 Visit this group at http://groups.google.com/group/pylons-discuss.
 For more options, visit https://groups.google.com/d/optout.


-- 
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 pylons-discuss@googlegroups.com.
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.


Re: [pylons-discuss] why is the debug toolbar not shown

2015-06-18 Thread Thierry Florac
Is your application deployed on local host?
By default the toolbar is only displayed for localhost...
Otherwise you can set your IP address in main section of your
development.ini:

debugtoolbar.hosts = 127.0.0.1 ::1

Regards,
Thierry


2015-06-18 13:09 GMT+02:00 r/ Wobben wobbe...@gmail.com:

 Hello,

 I have this code : https://github.com/rwobben/test_pyramid

 and according to chapter 4 of thr quick tutorial a toolbar schould be seen.

 But on my box no toolbar to be seen.

 Someone a idea why this happens and how to make this work ?

 Roelof

  --
 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 pylons-discuss@googlegroups.com.
 Visit this group at http://groups.google.com/group/pylons-discuss.
 For more options, visit https://groups.google.com/d/optout.




-- 
http://www.imagesdusport.com -- http://www.ztfy.org

-- 
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 pylons-discuss@googlegroups.com.
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.


Re: [pylons-discuss] manage.py equivalent?

2015-06-01 Thread Thierry Florac
Hi,
Do you want to create new management commands or do you just want to get
access to the shell?

Regards,
Thierry

2015-06-01 8:56 GMT+02:00 Chris Withers ch...@simplistix.co.uk:

 Hi All,

 Trying to get back into Pyramid, got a number of projects I want to use it
 for, so expect plenty of silly questions, please feel free to punt me at
 urls...

 First up: does Pyramid have a management command framework like Django's
 manage.py?

 I couldn't see anything in a quick scan of the PDF docs, but I'm sure I
 remember there being a pyramid shell. Where should I be looking for docs
 on that?

 cheers,

 Chris

 --
 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 pylons-discuss@googlegroups.com.
 Visit this group at http://groups.google.com/group/pylons-discuss.
 For more options, visit https://groups.google.com/d/optout.




-- 
http://www.imagesdusport.com -- http://www.ztfy.org

-- 
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 pylons-discuss@googlegroups.com.
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.


Re: [pylons-discuss] Re: zca registration questions

2015-07-16 Thread Thierry Florac
Hi Iain,
I've build a new set of utility fonctions to declare adapters or utilities
in the same Pyramid's way that is used to declare views (but without using
ZCML, of course).
This package is not public yet but I can share this code with you if you
need it...

Best regards,
Thierry

2015-07-16 22:39 GMT+02:00 Iain Duncan iainduncanli...@gmail.com:

 Thanks Vincent, that basically looks like a facade around ZCA lookup, but
 does not seem to do ZCA style adapter lookup. Anyone more up on this able
 to comment on that?

 iain


 On Thu, Jul 16, 2015 at 1:27 PM, Vincent Catalano 
 vinc...@vincentcatalano.com wrote:

 I'm not too familiar with the zca registry, but if you are looking for a
 good system for registering services and components, I highly recommend
 https://github.com/mmerickel/pyramid_services.

 On Thu, Jul 16, 2015 at 1:20 PM, Iain Duncan iainduncanli...@gmail.com
 wrote:

 I should say that we are also open to not using the ZCA, if there is
 another option that I don't know about that solves the same problems
 elegantly, IE a very flexible registration system that we can use to get
 adapters and components based of aspects of the adapted object(s). What I'm
 really after is the pluggable and flexible component aspect.

 thanks!
 iain

 On Thu, Jul 16, 2015 at 1:07 PM, Iain Duncan iainduncanli...@gmail.com
 wrote:

 Hi all, for a new set of projects, we will be using the zca registry
 heavily, but do not want to use pyramid_zcml on account of xml-allergies
 for some team members. =)

 I've been out of the pyramid loop for a while now, have some questions
 about this:

 - what is the recommended way to make zca registrations imperatively?
 Through the configurator? or get the configurators registry and use the zca
 api?

 - is there some decent way when doing imperative registration to
 simulate  what I used to use with pyramid_zcml where client packages used a
 base set of registrations and then just add their own ( old zcml include
 config style)

 - is it feasible and/or wise to share one registry among multiple apps
 that will be running as cooperating micro-services or would it make more
 sense to keep those separate?

 as always, opinions, tips, and horror stories greatly appreciated!
 iain


  --
 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 pylons-discuss@googlegroups.com.
 Visit this group at http://groups.google.com/group/pylons-discuss.
 For more options, visit https://groups.google.com/d/optout.




 --
 Vincent Catalano
 Software Engineer and Web Developer,
 (520).603.8944

 --
 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 pylons-discuss@googlegroups.com.
 Visit this group at http://groups.google.com/group/pylons-discuss.
 For more options, visit https://groups.google.com/d/optout.


  --
 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 pylons-discuss@googlegroups.com.
 Visit this group at http://groups.google.com/group/pylons-discuss.
 For more options, visit https://groups.google.com/d/optout.




-- 
http://www.imagesdusport.com -- http://www.ztfy.org

-- 
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 pylons-discuss@googlegroups.com.
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.


Re: [pylons-discuss] Anyone have examples of custom authentication policies?

2015-07-20 Thread Thierry Florac
Hi Iain,
I wrote a custom authentication policy which you can find here :
http://hg.ztfy.org/pyams/pyams_security/file/58599ce9e36e/src/pyams_security/utility.py
This policy is based on a registered Security manager utility, which is
mainly inspired by Zope3 authentication utility and can manage several
authentication plug-ins. Actually, several plug-ins are available to handle
:
 - a single (auto-created) administration plug-in
 - a local users folder
 - a local groups folder
 - LDAP authentication.
An SQLAlchemy authentication plug-in may be written in a short delay.
Credentials can be extracted from Pyramid's authentication cookie or from
HTTP headers (for Basic authentication).

Hope this can help...

Best regards,
Thierry

2015-07-18 17:49 GMT+02:00 Iain Duncan iainduncanli...@gmail.com:

 That pretty much says it, would love to look at some to wrap my head
 around this stuff better.

 thanks!

 --
 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 pylons-discuss@googlegroups.com.
 Visit this group at http://groups.google.com/group/pylons-discuss.
 For more options, visit https://groups.google.com/d/optout.




-- 
http://www.imagesdusport.com -- http://www.ztfy.org

-- 
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 pylons-discuss@googlegroups.com.
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.


Re: [pylons-discuss] Identity management in Pyramid

2016-05-26 Thread Thierry Florac
Hi Andreas,

Actually there is only my own "private" Mercurial repository to manage my
code. You can find it here : http://hg.ztfy.org/pyams
Please kind in mind that all this stuff is built for the needs of an
internal professional project, and is actually provided "as is"; I share as
much as I can. It's far from finished, and not yet documented.
Many aspects of this framework are inspired by some Zope 3 concepts and
Zope/Z3c packages, including:
 - ZODB usage
 - pluggable authentication (actually including "local" users and groups,
LDAP directory and social authentication; an SQLAlchemy connector is
planned), also managing roles
 - extensible users metadata through principal annotations
 - and many others...

Hope this can help!
Just ask if you have any question.
All remarks are welcome...  ;-)

Best regards,
Thierry

2016-05-25 18:02 GMT+02:00 Andreas Jung <li...@zopyx.com>:

>
>
>
> On 23 May 2016, at 9:26, Thierry Florac wrote:
>
> > Hi Andreas,
> >
> > I'm actually working on a Pyramid application framework (called "PyAMS")
> > including a pluggable authentication system (including an Authomatic
> > module).
>
> Is there a public repo für PyAMS? Google did not give me anything.
>
> Andreas
>
> --
> 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 pylons-discuss@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/732F75E0-5DD2-4B33-97FA-4FC5908FC599%40zopyx.com
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
http://www.imagesdusport.com -- http://www.ztfy.org

-- 
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 pylons-discuss@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWBtO5coR-h6z%3DCYth3BticzH2cW0qAR_fcTcN3EQpX5MQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [pylons-discuss] Identity management in Pyramid

2016-05-23 Thread Thierry Florac
Hi Andreas,

I'm actually working on a Pyramid application framework (called "PyAMS")
including a pluggable authentication system (including an Authomatic
module).
It provides some of the features you need but sadly it's actually far from
finished...  :-/

Best regards,
Thierry

2016-05-22 20:58 GMT+02:00 Steve Piercy :

> For a list of Pyramid integrations for authentication and authorization,
> filter by those categories.
> https://trypyramid.com/resources-extending-pyramid.html
>
> I think the pickings there are not what you seek.  Alternatively there is
> authomatic, which might get you closer to your goal.
> http://peterhudec.github.io/authomatic/
>
> Lastly, although US-based, Stormpath offers a private AWS deployment,
> which could be in Frankfurt, for the Enterprise level.
> https://stormpath.com/pricing
>
> HTH.
>
> --steve
>
>
>
> On 5/22/16 at 10:47 AM, li...@zopyx.com (Andreas Jung) pronounced:
>
>
> Hi there,
>>
>> I am currently checking for identity management solutions - either
>> cloud-based or
>> self-hosted (preferred on Python technology). Any pointers to
>> integrations with
>> Pyramid that could be re-used without reinventing the wheel?
>>
>> Requirements are as
>>
>> - MUST
>> - extensible metadata for user records
>> - user registration, password reset,
>> - user approval workflow (new accounts must be verified (optionally)
>> - user management interface
>> - embedding of login form, password reset form and all other forms into
>> the look & feel of our website
>> - no branding
>> - notifications (user registered, password reset, user account
>> deactivated etc).
>> - must support German as language for forms, notification emails etc.
>> - operate in accordance with EU/DE privacy laws
>> - any data should be stored within the EU/DE
>> - service should be located in EU/DE for performance reasons
>> - OPTIONAL
>> - user accounts can be assigned to groups („free“ vs. „premium“, „member“
>> vs. „admin“ etc.)
>> - social media login
>> - multi-factor authentication
>> - configurable password policies
>> - password expiration
>> - abuse protection (tracking of login trial, mechanisms for protecting
>> the site from bots or automatic password hacker scripts etc)
>>
>> Andreas
>>
>>
> 
> Steve Piercy, Soquel, CA
>
> --
> 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 pylons-discuss@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/r471Ps-1085i-D00E25A79EBF4DACBC48815D39719ADE%40stevepi-mbp.local
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
http://www.imagesdusport.com -- http://www.ztfy.org

-- 
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 pylons-discuss@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWCdkwhRkoTZF43nWg44NsKoYwxJ1q3Rs8odJryag1q%3Dag%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [pylons-discuss] ZODB, maintaining referential integrity

2016-04-21 Thread Thierry Florac
Hi !

I often use internal IDs (via an IIntIds utility) to store objects
references.
The drawback of this method is that you have an indirection and you always
have to check that the reference target is still available before using it!
So even in this use case I use an event listener to remove the reference
when the target is removed...

Best regards,
Thierry

2016-04-21 16:10 GMT+02:00 Chris Rossi :

> The other approach would be to only store objects in one canonical place,
> and use references that just store the path to the object or the oid.
>
> Chris
>
> On Thu, Apr 21, 2016 at 3:36 AM, Joe Steeve  wrote:
>
>> How to maintain "referential integrity" in a ZODB. Simply put: When an
>> object-A is removed from a container, the references to object-A, in
>> other objects should go invalid.
>>
>> I tried holding a persistent.WeakRef whenever a reference was required.
>> However, the WeakRef seems to go invalid only after a GC on the db
>> (correct me if I am wrong).
>>
>> The other approach seems to be to use IObjectWillBeRemovedEvent at the
>> site of the referencing object, to act accordingly.
>>
>> How do other people deal with this?
>>
>> --
>> Joe Steeve
>> HiPro IT Solutions Private Limited
>> http://hipro.co.in/
>>
>> --
>> 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 pylons-discuss@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/pylons-discuss/1461224218.20052.19.camel%40hipro.co.in
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> 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 pylons-discuss@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/CAGZ7LV9-rkNSO2eAVu0uEJEHgJY6_A7PSW8isCqjV2K_THyCXQ%40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
http://www.imagesdusport.com -- http://www.ztfy.org

-- 
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 pylons-discuss@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWCMyL8ER75_7Dng45Y4wKk%2BiNYcMoAsPk%2BDCkmZ1E5S%2BQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [pylons-discuss] ZODB, maintaining referential integrity

2016-04-21 Thread Thierry Florac
Hi,

Actually I handle this use case using IObjectRemovedEvent subscribers.
Can't see any other simple way...  :-/

Best regards,
Thierry


2016-04-21 9:36 GMT+02:00 Joe Steeve :

> How to maintain "referential integrity" in a ZODB. Simply put: When an
> object-A is removed from a container, the references to object-A, in
> other objects should go invalid.
>
> I tried holding a persistent.WeakRef whenever a reference was required.
> However, the WeakRef seems to go invalid only after a GC on the db
> (correct me if I am wrong).
>
> The other approach seems to be to use IObjectWillBeRemovedEvent at the
> site of the referencing object, to act accordingly.
>
> How do other people deal with this?
>
> --
> Joe Steeve
> HiPro IT Solutions Private Limited
> http://hipro.co.in/
>
> --
> 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 pylons-discuss@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/1461224218.20052.19.camel%40hipro.co.in
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
http://www.imagesdusport.com -- http://www.ztfy.org

-- 
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 pylons-discuss@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWD3hAh1Kx9PP9b6EoDo7p11JCxikn1YLJQgJ1xcUTdmXg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [pylons-discuss] pyramid_tm custom data mangers for a transaction

2017-01-23 Thread Thierry Florac
Did you had a look at "pyramid_es" package?
It provides a custom data manager for ElasticSearch...

Regards,
Thierry

2017-01-23 20:19 GMT+01:00 Kai Groner :

> I found the data manager interface somewhat convoluted, so I wrote some
> adapters that allow you to write datamanagers as generator functions
> (similar to contextlib.contextmanager).
>
> @datamanager
> def transactionally_do_something():
> try:
> # BEGIN
> yield
> # VOTE
> yield
> except Exception:
> # ABORT
> raise
> else:
> # FINISH
>
> There's also a @commitmanager version which skips the BEGIN phase if you
> have nothing to put there, and there are inline flavors of both for
> attaching a one-off datamanager to the current transaction.
>
> https://gist.github.com/groner/ae63a62ded7d6dbdfb3397f264300b16
>
>
>
> Kai
>
> --
> 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 pylons-discuss@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/pylons-discuss/CALiRuxkN_HqTAyLv-TThmc4WU4Fvh_5X%3D5T6KmEJ_
> BHFUE%2B44w%40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
http://www.imagesdusport.com -- http://www.ztfy.org

-- 
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 pylons-discuss@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWCB2878w7YPDvAYnh9JFBMz%3DHfQ54p4k%3DFPv0%2BssTwm9g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [pylons-discuss] What is your development environment setup?

2017-02-23 Thread Thierry Florac
Currently using Debian, Awesome WM, and PyCharm as IDE with Mercurial as
DVCS.
Development as well as testing and production environments are built using
Buildout.
No issue...  ;)

Regards,
Thierry

2017-02-23 19:42 GMT+01:00 Oliver :

> My IDE consists of ubuntu, awesome wm, bash+ag+pyenv+virtualenv, git,
> neovim+fzf+deoplete/jedi+neomake/pylama/pylint/pep8, pytest/xdist,
> ansible, lxd, docker.
>
> The key to have a distinct, reproducible setup and deployment is to use
> pyenv/virtualenv, where pyenv is able to let you
> run the python version you have in production. Try to freeze all used
> python library versions. After dev staging create
> artifacts e.g. wheels and use them for CI staging, test them and release
> them to prod.
>
> I consider lxd more suitable than docker to deploy a stack of
> (micro)services for dev staging and first integration
> tests, just use ansible/lxd_container to setup and deploy a nearly
> production like scenario.
>
>
> cheers,
> Oliver
>
> On 23.02.2017 13:55, Jaime Sangcap wrote:
> > Im just starting out with python and pyramid and Im wondering what do
> you guys use?
> >
> > Are you using the host without VM? Vagrant? Docker?
> >
> > I came from PHP and usually develop using vagrant.
> >
> > --
> > 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  unsubscr...@googlegroups.com>.
> > To post to this group, send email to pylons-discuss@googlegroups.com
> .
> > To view this discussion on the web visit
> > https://groups.google.com/d/msgid/pylons-discuss/46abd0c7-
> 0b7c-40dd-a33c-8584b5ba76ce%40googlegroups.com
> >  0b7c-40dd-a33c-8584b5ba76ce%40googlegroups.com?utm_medium=
> email_source=footer>.
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> 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 pylons-discuss@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/pylons-discuss/85881760-5908-afe4-9032-4433b4704b52%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
http://www.imagesdusport.com -- http://www.ztfy.org

-- 
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 pylons-discuss@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWBX9w-uOuX07LSmFs7XaonqSwKA6bJSgDsbBBJs9PaTeg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [pylons-discuss] Deform forms select2 and ajax

2016-09-12 Thread Thierry Florac
Hi,

I think "select2" is a perfect candidate for your needs.
I use it in my Pyramid applications but with z3c.form package and it works
perfectly with AJAX calls.
The simplest way is probably to create a JSON view which returns a list of
objects containing "id" and "text" attributes matching text you started to
enter.
I can help you concerning the required HTML, AJAX and Javascript
integration, but I don't know "deform" package requirements...

Regards,
Thierry

2016-09-11 23:30 GMT+02:00 Jo G :

> Hi, I have a pyramid based application using substanced and deform. I am
> using a select2 drop down pre-populated with a list of items. The list is
> very long and takes forever to load. Looking at select2 I should be able to
> use an Ajax call to a pyramid view to return a subset of the data.
> Deform uses an old version of select2 and I'm finding it hard to get it
> and substanced to play nicely together.
> My approach would be:
> Define a view that returns a subset of data
> Create my own widget based on the select2 widget
> Write a new template for the widget
> Make the form use Ajax
>
> Anybody done this or can help?
>
> Is there any reason I couldn't use an updated version of select2 jquery?
>
> Is there a better widget I could use? I need to display a text value and
> return an associated integer ID.
>
> Thanks in advance.
>
> --
> 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 pylons-discuss@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/pylons-discuss/474fc6cd-87d6-4066-8dab-03d00958f035%
> 40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
http://www.imagesdusport.com -- http://www.ztfy.org

-- 
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 pylons-discuss@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWC%3DX2d8aTkCdXmGhK7DLGKC9BrGVssb_crDEzp-LWuZaQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [pylons-discuss] [off-topic] The Case Against Python 3

2016-11-24 Thread Thierry Florac
Here is another feedback about Zed's article:
https://eev.ee/blog/2016/11/23/a-rebuttal-for-python-3/

Regards,
Thierry


2016-11-24 20:54 GMT+01:00 Mike Orr :

> It also reminds me of the switch to the metric system. The reason
> Americans are adverse to it is that it was taught in school in the
> 1970s as a bunch of obscure conversion functions. A meter is 39
> inches. A kilometer is 5/6 of a mile. A centimeter is tiny compared to
> an inch; look at a ruler. A liter is a bit more than a quart. To
> convert from Fahrenheit to Celsius, divide by 2 and add 32. People's
> math homework was all these tedious conversions.
>
> But that's not how people in metric countries use the metric system.
> They just move the decimal point left and right and change the unit.
> They follow metric recipes. They compare 500 milliliters to 1 liter.
> They have an intuitive feeling of how warm 20 degrees Celsius is, and
> how warm 30 degrees Celsius is. The only time they use the tedious
> conversions is when they have to compare it to something in English
> units, which is rare. Even Americans, if they start in metric such as
> the secondary number on a food can, or the other side of the ruler, or
> their speedometer when they're in Canada, can easily compare it to
> other metric units and remain in metric for the entire situation. And
> they do sometimes use millimeters rather than inches because it's a
> conveniently short unit for short or precise things.
>
> So it's like going from Python 2 to 3. Converting programs is hard,
> but after that it's easy, and you get access to more features
> (analogous to just moving the decimal point left and right, or having
> freezing and boiling at 0 and 100). Once you are in 3, you rarely have
> to deal with 2, unless you encounter an old program or library.
>
> --
> 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 pylons-discuss@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/pylons-discuss/CAH9f%3Dura5LPgW9Xp9MM_UzT8G6pZqQyEohk7P%
> 2B28wwcEtRUJ4Q%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 pylons-discuss@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWB270G-wV7D6e8gi6uMewL8Yasg9vWRQ9CPDM%2BSt4RRsA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [pylons-discuss] [off-topic] The Case Against Python 3

2016-11-24 Thread Thierry Florac
Perfectly agree with previous comments!
I can't estimate the theory behind Turing machines and so on. But on a
practical point of view, I worked for a long time with Python 2 and Zope 3
and had to upgrade all my private packages to use them with Python 3
(starting with Python 3.) and Pyramid: the result is according to me much
cleaner and simpler than it was before, especially for many strings
management concerns!
Finally I prefer using Python 3 today, and as all major libraries have now
been ported to it, compatibility is no more a major concern with it.

Regards,
Thierry

2016-11-24 13:03 GMT+01:00 Christoph Zwerschke :

> Has the same taste as the recent election campaign. Start with
> extraordinary and alarming, but totally false and uneducated claims
> ("Python 3 is not Turing complete", "you can't run Python 2 and Python 3
> along with each other" etc.) and conclude that we should revert everything
> and do things in the old ways. Same spirit as "climate change is a hoax,
> let's continue to burn fossil fuel" or "who needs diversity, let's continue
> to make politics for straight white male people only as we did in the good
> old 1950s."
>
> My personal experiences with Python 3 are very positive, I do not perceive
> things as "broken", but moving into the right direction. Many mistakes that
> have been made in the beginning of the transition have already been fixed.
> And I see Python 3.6 as another great step forward. Evolution is good,
> don't worry, don't be stagnant.
>
> -- Christoph
>
>
> Am 24.11.2016 um 12:03 schrieb Vinicius Assef:
>
>> Hey guys.
>>
>> As Pyramid was the first framework supporting Python 3, what do you
>> think about this position?
>>
>> https://learnpythonthehardway.org/book/nopython3.html
>>
>> What are your experiences regarding Python 3 as broken?
>>
>> --
>> Vinicius Assef
>>
>
> --
> 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 pylons-discuss@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/ms
> gid/pylons-discuss/cce59e52-512c-9fcd-cbb9-832113a6b2c0%40online.de.
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
http://www.imagesdusport.com -- http://www.ztfy.org

-- 
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 pylons-discuss@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWAnt%3DGuuS2Vnyh_mybhXb-pscyQqXX9mcJ4ANGfzsShdQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[pylons-discuss] WSGI WebSockets AsyncIO server for Pyramid

2017-05-19 Thread Thierry Florac
Hi,

I need to build an AsyncIO based WSGI WebSockets server for Pyramid.
Until now I was using a stack made of GUnicorn, Pyramid and AIOPyramid and
it was working very well, but these packages seems to be un maintained and
last aiohttp package (used by AIOPyramid's GUnicorn worker) doesn't provide
a WSGI protocol handler...  :/

Any idea?
I need this stack for Python3 (3.4 at least...)...

Best regards,
Thierry

-- 
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 pylons-discuss@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWCSzCjHar6mxbVh-kyWET-PQPV6zWzxe1CD_6PWi8BSeA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [pylons-discuss] Implementing basic authentication with persistence

2017-09-04 Thread Thierry Florac
Hi Julian,
I've build a "security package" for my own framework (called "PyAMS") which
includes a pluggable "security manager"' utility in which you can "plug"
extensions allowing you to use several authentication plug-ins; these
actually include "local users" (stored into ZODB), Authomatic connections
or an (optional) LDAP directory; authentication from SQL database is planed
but not done yet...
Work on the whole framework is far from finished, packaging and
documentation is not done yet but you can have a look to my source code
from my repository (http://hg.ztfy.org/pyams).

Best regards,
Thierry

2017-08-31 18:55 GMT+02:00 Julian Sanchez :

> Thanks Mikko.  I'll take a look at the code.  We won't be using SQLAlchemy
> though so I'll see how much I can reuse
>
> On Thursday, August 31, 2017 at 11:45:45 AM UTC-5, Mikko Ohtamaa wrote:
>>
>> Hi Julian,
>>
>> Websauna implements basic sign in and sign up for you using SQLAlchemy
>> persistency and Redis for sessions:
>>
>> https://websauna.org/docs/narrative/user/index.html
>>
>> It also supports Facebook, Twitter and Google OAuth and various others.
>>
>> Best regards,
>> Mikko
>>
>>
>>
>> On 31 August 2017 at 19:42, Julian Sanchez  wrote:
>>
>>> I'm getting my feet wet with Pyramid and going through the different
>>> tutorials, applying the concepts to the project I'm working on.  At the
>>> present time I'm interested in having basic authentication and storing the
>>> username and (securely hashed) password on a database table.
>>>
>>> Is there something already 'pre-made' that I could reuse so I don't have
>>> to write all the code from scratch?  I saw the tutorial on SQLAlchemy
>>> 
>>> showing the registration code but we will not be using SQLAlchemy.  The 
>>> other
>>> tutorial
>>> 
>>> gives a flavor for checking the validity of a password but doesn't seem to
>>> work with a repository of any kind (particularly a user registering into a
>>> site).  I've seen packages like Authomatic but they seem to provide OAuth
>>> stuff.  Maybe someone has made an extension to Authomatic for basic
>>> authentication?  How are you guys implementing authentication?
>>>
>>> Thanks,
>>> Julian
>>>
>>> --
>>> 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-discus...@googlegroups.com.
>>> To post to this group, send email to pylons-...@googlegroups.com.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/pylons-discuss/59dd2c83-b286-4d85-a506-beeaca013322%40go
>>> oglegroups.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Mikko Ohtamaa
>> http://opensourcehacker.com
>> http://twitter.com/moo9000
>>
>> --
> 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 pylons-discuss@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/pylons-discuss/107c600c-d8ce-4836-ad9e-33991e619fc9%
> 40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
http://www.imagesdusport.com -- http://www.ztfy.org

-- 
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 pylons-discuss@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWDL9Wx1yU1p3bQGb25dz9Gcf_3Jcz9ZYOvd1R--koK-eA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [pylons-discuss] CSRF token implementation

2017-12-14 Thread Thierry Florac
OK, I switched to Pyramid 1.9.1 (using CookieCSRFStoragePolicy, and
settings default CSRF options with require_csrf=True) and everything seems
to be OK!
Just added javascript code to always add my token (received as cookie) as
"X-CSRF-Token" header to every POST request...

Best regards,
Thierry

2017-12-12 23:43 GMT+01:00 Bert JW Regeer :

> I’m trying to follow what you are saying… and none of it is making any
> sense.
>
>
> On Dec 12, 2017, at 12:15, Jonathan Vanasco  wrote:
>
> 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
> csrf cookie, then programmatically constructing a request with a second
> cookie set by the client.
>
> --
> 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 pylons-discuss@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/pylons-discuss/49f94c31-af2a-43ba-8305-cf75f3092b36%
> 40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> 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 pylons-discuss@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/pylons-discuss/844BFC4E-C910-4070-9AA7-F1758986CC88%400x58.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
http://www.imagesdusport.com -- http://www.ztfy.org

-- 
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 pylons-discuss@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWAnLBWm-YkYo5N_hbKkXW2JiJTHM6zH56XDPsg%2BstftNw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[pylons-discuss] CSRF token implementation

2017-12-11 Thread Thierry Florac
Hi,

I'm using Pyramid 1.84 and trying to implement a CSRF token cookie
verification for any POST or AJAX request.
My code is as follow:


CSRF_TOKEN_COOKIE_NAME = 'csrf_token'

@subscriber(INewRequest)
def handle_new_request(event):
"""Handle any request with CSRF token cookie"""
request = event.request
if (request.method == 'POST') or request.is_xhr:
check_csrf_origin(request)
post_token = request.cookies.get(CSRF_TOKEN_COOKIE_NAME)
session_token = request.session.get_csrf_token()
if (not post_token) or strings_differ(post_token, session_token):
raise BadCSRFToken('Invalid CSRF token')

@subscriber(INewResponse)
def handle_new_response(event):
"""Handle new response to manage CSRF token cookie"""
request = event.request
if not request.path.startswith('/--static--/'):
token = request.session.get_csrf_token()
event.response.set_cookie(CSRF_TOKEN_COOKIE_NAME, token,
  secure=request.scheme == 'https',
  httponly=True)


Everything seems to be OK, except on one point : on first submit (which
generally comes from the login page), the CSRF token is refused! On second
submit and afterwards, everything is OK!

Any idea about how to avoid this?

Best regards,
Thierry

-- 
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 pylons-discuss@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWCf7u_bsreg7Z-1U6RSjcEH_8TV5auOM9Bsk0_fyP-Ajw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [pylons-discuss] Re: How to send task-message after request.tm has committed?

2018-06-01 Thread Thierry Florac
Hi,
Maybe you should have a look at the "DataManager" component interface
provided by the "transaction" package.
This kind of component allows you to include your hook in a "two-phase
commit" transaction safely.
Several implementations are available, for example in the "repoze.sendmail"
package...

Best regards,
Thierry

Le ven. 1 juin 2018 à 05:48,  a écrit :

> Poking around the documentation some more, it seems that using an
> after-commit-hook
> 
> may work: i.e. when a task needs to be scheduled by the view function, then
> find the request’s transaction (from `request.tm`?) and install the hook
> function and and its arguments (i.e. which task needs to be scheduled and
> the task’s args).
>
> But still, what is the official and recommended way of solving this? 樂
>
> Cheers!
>
> --
> 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 pylons-discuss@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/25d30da3-5079-46f7-b15a-2ffe3d44c06e%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
http://www.imagesdusport.com -- http://www.ztfy.org

-- 
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 pylons-discuss@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWAKO1FD-0crdtJxvJveP0v8ag%3D%2BGs3A7pdY4tjez4s6rA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [pylons-discuss] redis debugging?

2018-06-19 Thread Thierry Florac
Hi Jonathan!
For sure I would be interested by such a debug toolbar extension which
could provide the same kind of information that we have for SQLAlchemy.
Of course if I can help or collaborate in coding or testing, just ask!  ;)
Best regards,
Thierry

Le mer. 20 juin 2018 à 00:20, Jonathan Vanasco  a
écrit :

> 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 that, i'm not inclined to build anything for a public release
> myself.  it's just all wonky stuff.
>
> does anyone else have a need for this and interested in collaborating? if
> so, i'll try to pull stuff out to a public repo.
>
> --
> 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 pylons-discuss@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/e74e7337-97c7-4fe6-8235-6402287fc5bc%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
http://www.imagesdusport.com -- http://www.ztfy.org

-- 
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 pylons-discuss@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWCUGCqOLe8LaNGHJFoLscpBLQthZn4bgkGqTZdPGKjUHQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[pylons-discuss] Best way to handle a redirection plan?

2018-05-02 Thread Thierry Florac
Hi,
I'm actually working on the implementation of a new website, moving from
Zope 3 to Pyramid (using ZODB).
When the new site will be ready, old contents will be gradually
reorganized, rewritten and moved from the old site to the new one; both
sites will be handled by different physical platforms using different
domain names.
In this context, a "redirection plan" has to be implemented, and I'm
wondering about the best efficient way to implement it with Pyramid, given
the following elements:
- all input requests will be handled by Pyramid, which will check if the
requested content has to be handled internally (if the requested page is a
new one), by sending a proxy request to the old site (if a redirection is
defined for requested URL), by sending an HTTP redirect or by sending an
HTTP "NotFound";
- the number of redirection rules may be quite large! Some will match a
whole subtree, some only one page;
- the configuration of the redirection plan has to be available to a
webmaster which is not a system administrator (so defining it at the Apache
level doesn't seems to be an option), so typically into the CMS;
- the Pyramid's website will be deployed into a cluster configuration (with
at least three servers).

I suppose that the redirection has to be handled "as soon as possible"
during request lifetime, so could using tweens be an option (database
access has to be opened during this process)?

Any advise would be greatly appreciated!  ;)

Best regards,
Thierry

-- 
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 pylons-discuss@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWCP3LTfRKzxeB%3Dv8EEuoLZJNYJo6A7758f2vW1%3D5jU_mQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [pylons-discuss] Overriding view declaration

2018-03-01 Thread Thierry Florac
Many thanks, it works perfectly !!

Best regards,
Thierry

2018-02-28 17:42 GMT+01:00 Michael Merickel <mmeri...@gmail.com>:

> 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 include_orig(config):
> config.scan('.orig_pkg')
>
> def include_override(config):
> config.include(include_orig)
> config.scan('.override_pkg')
>
> def main(...):
> # do not config.include(include_orig) here, instead include the
> override
> # otherwise they would be siblings and thus no clear chain
>
> config.include(include_override)
>
> Now pyramid will have a chain that says specifically that the override is
> "closer" to your main than orig and thus its directives should win.
>
> - Michael
>
>
> On Wed, Feb 28, 2018 at 4:50 AM, Thierry Florac <tflo...@gmail.com> wrote:
>
>> Hi,
>> I created a view in a first package.
>> In another package (which is an optional extension of the first one), I
>> need to create another view but with the same name and the same settings as
>> the previous one but with another class which inherits from the first one.
>> By default, this raises a "pyramid.exceptions.ConfigurationConflictError"
>> exception: Conflicting configuration actions!
>> So how can I "override" or "replace" a view declaration? Eventually, can
>> I "unregister" a view declaration before registering the new one?
>>
>> Best regards,
>> T. Florac
>>
>> --
>> 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 pylons-discuss@googlegroups.com.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/pylons-discuss/CAPX_VWDmDJKT5g3j8%3Dx7BW9mWuiYk1Z1rz9BTw
>> zGxKy8Fxz2kA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWDmDJKT5g3j8%3Dx7BW9mWuiYk1Z1rz9BTwzGxKy8Fxz2kA%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> 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 pylons-discuss@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/pylons-discuss/CAKdhhwHenweaeWuw-U6cpk4AQWCDGFZGgzAhE_AkHg_-
> nhtPiA%40mail.gmail.com
> <https://groups.google.com/d/msgid/pylons-discuss/CAKdhhwHenweaeWuw-U6cpk4AQWCDGFZGgzAhE_AkHg_-nhtPiA%40mail.gmail.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
http://www.imagesdusport.com -- http://www.ztfy.org

-- 
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 pylons-discuss@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWAQJBYvPJmOVCt%3DE6pgiJD_Cc0htJ6Tq%3D8Z%3DwKT6b_3fA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[pylons-discuss] Overriding view declaration

2018-02-28 Thread Thierry Florac
Hi,
I created a view in a first package.
In another package (which is an optional extension of the first one), I
need to create another view but with the same name and the same settings as
the previous one but with another class which inherits from the first one.
By default, this raises a "pyramid.exceptions.ConfigurationConflictError"
exception: Conflicting configuration actions!
So how can I "override" or "replace" a view declaration? Eventually, can I
"unregister" a view declaration before registering the new one?

Best regards,
T. Florac

-- 
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 pylons-discuss@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWDmDJKT5g3j8%3Dx7BW9mWuiYk1Z1rz9BTwzGxKy8Fxz2kA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[pylons-discuss] [venusian] Question about multiple decorators

2018-06-21 Thread Thierry Florac
Hi,
I created two new Python decorators in a Pyramid's project using Venusian
to define custom views and add functionalities to them.
I can have several decorators for the same view:

@page_config(name='myview.html', ...)
@ajax_config(...)
class MyViewClass(object):
"""My custon view class"""

My questions are :

   - how can I define decorators order? Actually, whatever order I use,
   "ajax_config" decorator is always called before "page_config"...
   - in this example, "page_config" and "ajax_config" share some arguments
   (which are mainly predicates); to avoid duplicates, is it possible in a
   decorator to get arguments defined in the previous decorator?

Best regards,
Thierry
-- 
http://pyams.readthedocs.io

-- 
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 pylons-discuss@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWA5qBD6Jp4c0DUUJ%3DoQuffFfgb%2BzzE%3DW3Qr5T9Ww991jg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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

2018-11-11 Thread Thierry Florac
I have several use cases where a request generates long operations (for
example, for doing conversion of an uploaded video file) but I want that
the end user receives the response as soon as possible (here, before
conversion ends).
In these cases, if the long operation is not impacted by the status of my
current transaction, and as I don't want to be dependent of a client-side
call, my choice was to:
- start a 0MQ listening process on application startup
- when a given request is received, just start a new thread to send the
required arguments to the listening 0MQ process, and send response
immediately! If this step is just dependent of current transaction status,
just be use to use an after-commit hook or a transaction data-manager...

Thierry

Le sam. 10 nov. 2018 à 23:25, Zsolt Ero  a écrit :

> On a fairly classic Pyramid app (sync, gunicorn, SQLAlchemy / Postgresql,
> like the starter template), I am storing analytics-like events in a table
> for some of my views.
>
> Like this skeleton:
>
> @view_config(route_name='test', request_method='POST', renderer='json')
> def test(request):
> # body of the view
> map_id = request.json_body.get('map_id')
> data = {...}
>
> event_data = {'action': 'viewed'}
> event = MapEvent(user=request.user, action=event_data, map_id=map_id)
> request.dbsession.add(event)
>
> return data
>
>
>
> My problem is that while 99% of the views make read-only requests to the
> database, and thus are very fast, the analytics event is a writing and can
> be slow occasionally.
>
> Would it be possible to somehow send the request to the client and still
> keep processing the view? Like a send() + end() method or something
> similar, without returning?
>
> // Adding to a tasks queue is not an option as it'd be an overkill and an
> overcomplicated solution, which wouldn't work for hundreds of thousands of
> events per day.
>
>
> --
> 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 pylons-discuss@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/c44e1af6-8c30-478e-9baf-d7fd8c93e0b5%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
http://www.imagesdusport.com -- http://pyams.readthedocs.io

-- 
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 pylons-discuss@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWAeAHv_MHFHN0VM5WAXJ7XarUm5eAfaDJhEk71BqyNT%2Bg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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

2018-10-09 Thread Thierry Florac
And how do you handle such use case when working in a
multi-process/multi-hosts cluster configuration?

Le lun. 8 oct. 2018 à 19:10, Michael Merickel  a écrit :

> If you are doing loading of data at "first run of the function" then you
> have introduced a race condition in your app where unless you do
> appropriate locking, two threads (most wsgi servers serve a request per
> thread) may both consider themselves the first run and load the data. The
> only way to do this without locks is to do things at config-time like I
> suggested before. There are hacks that you can do because it's Python with
> a GIL in which you can do locking in more lightweight ways in the "first
> run of the function" case but I do not recommend relying on that behavior.
>
> 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 Merickel wrote:
>>>
>>> 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 this in pyramid addons and things like the dbsession_factory
>>> in the alchemy cookiecutter.
>>>
>>
>> Thank you.
>>
>> I decided to add it at 1st run of the function:
>> try:
>> if not request.registry.mycontract:
>> request.registry.mycontract = Contract()
>> mycontract=copy.copy(request.registry.mycontract)
>> ...
>> #rest of the code:
>> mycontract.add_user()
>> mycontract.update_terms()
>>
>> *Sidenote:*
>> Is there a way to force this object to be "read only" or now allow
>> modification, to prevent somebody else in some other sections of the code
>> accidently modifies request.registry.mycontract?
>>
>> **update run at 0.42755 sec now.
>>
>> Thanks
>> Lucas
>>
>>
>>
>>
>>
>>> On Sat, Oct 6, 2018 at 5:00 PM Lukasz Szybalski 
>>> wrote:
>>>
 Hello,
 I have an enterprise system that is creating a class but it takes a
 long time to initiate. About 2 sec, 90K _setitem from pickle. Nothing to
 profile, since OS cashes the file its as fast as it gets.

 I'm trying to find a way in pyramid where I can:

 #store below at start, of the process, let it initiate,
 #then somehow make it read only,
 #so that a process can use it later and modify its own copy

 from enterprise import Contract
 my= Contract()


 #rest of the program
 my2 = copy my (or copy on write, similar how qcow format works)
 my2.find_contract('abc')
 my2.add_name('Lucas')
 return (my2.stuff)

 I don't seem to be finding the right terminology, or technique to do
 this, and where to place it in pyramid?

 Thanks
 Lucas

 --
 http://lucasmanual.com/ 

 --
 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-discus...@googlegroups.com.
 To post to this group, send email to pylons-...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/pylons-discuss/CAKkTUv3qgT%2BUk0-uvLB1owZEA3W%3D-7XA-wkiyZbteWHPAcO6vg%40mail.gmail.com
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>> --
>> 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 pylons-discuss@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/pylons-discuss/6590645a-7af6-480a-a866-ab1af78e0d42%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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 pylons-discuss@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/CAKdhhwEJbH1qNNZ2-O8D2ie243nAAXj0knXhf8kXskLYfWYqqA%40mail.gmail.com
> 

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

2019-01-16 Thread Thierry Florac
Hi,
My use case implies that I don't want to create a custom new request but a
clone of the initial request!
I investigated a little more and found that "request.copy()" duplicates
most of the initial query attributes, including properties added via
"add_request_method()" (reifyed or not), except "root" and "registry".
So finally I use a function like this:

def copy_request(request):
"""Create clone of given request, keeping registry and root as well"""
root = request.root
request = request.copy()
if not hasattr(request, 'registry'):
registry = get_current_registry()
if registry is None:
registry = get_global_registry()
request.registry = registry
request.root = root
return request


Any advise is still welcome!  ;)

Best regards,
Thierry


Le mar. 15 janv. 2019 à 21:22, Bobby  a écrit :

> The following works for me whenever celery needs a dup request:
>
> import plaster
> from pyramid.request import Request, apply_request_extensions
>
> def make_request():
> loader = plaster.get_loader('development.ini', protocols=['wsgi'])
> app = loader.get_wsgi_app()
> r = Request.blank('/localhost:6543')
> r.registry = app.registry
>     apply_request_extensions(r)
> return r
>
>
>
> On Tuesday, January 15, 2019 at 5:09:18 AM UTC-5, Thierry Florac wrote:
>>
>> Hi,
>> Simple question: I have a use case where I need to create an exact copy
>> (a clone) of a request, to update it's properties and make "simulations"
>> (actually by providing custom marker interfaces) without modifying the
>> original request.
>> Is there a good way to do this?
>> Actually I just tried to do a "request.copy()", but then I get errors
>> like "AttributeError: 'Request' object has no attribute 'root'" when trying
>> to get access to "root" attribute...
>>
>> Thanks for any help,
>> Thierry
>>
>> --
> 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 pylons-discuss@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/feac8d1c-4f07-46a6-af06-dc94eb1b2d69%40googlegroups.com
> <https://groups.google.com/d/msgid/pylons-discuss/feac8d1c-4f07-46a6-af06-dc94eb1b2d69%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
  http://pyams.readthedocs.io

-- 
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 pylons-discuss@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWCJ6E13CL3wuDJmXmcUp%3DSNSTEtegJ%3D1JP61Wuvw%2Biq9w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[pylons-discuss] Creating a request copy?

2019-01-15 Thread Thierry Florac
Hi,
Simple question: I have a use case where I need to create an exact copy (a
clone) of a request, to update it's properties and make "simulations"
(actually by providing custom marker interfaces) without modifying the
original request.
Is there a good way to do this?
Actually I just tried to do a "request.copy()", but then I get errors like
"AttributeError: 'Request' object has no attribute 'root'" when trying to
get access to "root" attribute...

Thanks for any help,
Thierry

-- 
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 pylons-discuss@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWAWwAbA6MAWHP_2C-3PxfKiXktt1mecJHp5aokeZVOwdA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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

2019-01-10 Thread Thierry Florac
Hi,

After-commit hooks don't work in async mode!
They allow to declare callbacks which will be called after transaction
commit, but server is waiting for these callbacks to be finished (in
synchronous mode) before sending response to client.
If you need async mode, you have (at least) to start another thread which
will handle your asynchronous tasks.

Regards,
Thierry


Le jeu. 10 janv. 2019 à 13:37, Zsolt Ero  a écrit :

> Actually, it doesn't result in async-like behaviour, the client is
> still waiting for the function inside the commit hook. I guess I don't
> understand the concept then.
>
> On Thu, 10 Jan 2019 at 13:15, Zsolt Ero  wrote:
> >
> > I'm just now implementing this. Are you saying that basically, by using
> addAfterCommitHook, I can replace put relatively fast (say, <10 seconds),
> functions into async-like behaviour, without requiring any external queue
> service?
> >
> > old:
> >
> > # send email was an async function, via a decorator (using Huey)
> > send_email(
> > to_email=user.email,
> > subject='account activation',
> > text=email_text,
> > )
> >
> >
> >
> >
> >
> > new:
> >
> > request.tm.get().addAfterCommitHook(send_email_hook, kws=dict(
> > to_email=user.email,
> > subject='account activation',
> > text=email_text,
> > ))
> >
> >
> > + a helper function:
> >
> >
> > def send_email_hook(success, **kwargs):
> > if success:
> > send_email(**kwargs)
> >
> > I have two questions regarding this:
> > 1. When does success == False?
> > 2. What does the warning on transaction's doc page mean?
> >
> >> Hook functions which do raise or propagate exceptions will leave the
> application in an undefined state.
> >
> >
> > Practically speaking, should I put the send_email function into a
> try-except block?
> >
> > --
> > You received this message because you are subscribed to a topic in the
> Google Groups "pylons-discuss" group.
> > To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/pylons-discuss/tf5kKsnZRTc/unsubscribe.
> > To unsubscribe from this group and all its topics, send an email to
> pylons-discuss+unsubscr...@googlegroups.com.
> > To post to this group, send email to pylons-discuss@googlegroups.com.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/6831e434-6e85-4c41-9797-82c71ad7f2b3%40googlegroups.com
> .
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> 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 pylons-discuss@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/CAKw-smAukCYyjhg7wp2PoP4cUCJ0JuchNqYG0LLHpVGGL%2B84mA%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
http://www.imagesdusport.com -- http://pyams.readthedocs.io

-- 
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 pylons-discuss@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWCt_SfPDmYsVSK%2Bwt74j5%2BSFj8vb40LrN9PRBPY2%2Bb7Gg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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

2019-02-24 Thread Thierry Florac
Hi,
Don't know for the testing environment...
But why don't you use PersistentList / PersistentMapping classes instead of
classis list/dict for your inner properties?
Regards,
Thierry
-- 
  https://www.ulthar.net -- http://pyams.readthedocs.io


Le dim. 24 févr. 2019 à 08:49, Gerhard Schmidt  a
écrit :

> Hi,
>
> I'm writing a pyramid app using  traversal and ZODB. Right now i writing
> unit tests and try to test if the _p_changed attribute is set after a
> method that changes a persistent object.
>
> The problem is that _p_changed is always False when running in the
> testrunner. Even after I do obj._p_changed = True obj._p_changed is
> still False.
>
> In running environment everything works fine. But I often forget the
> self._p_changed = True after modifying lists or dicts inside a
> persistent object. So i really like to test if it's get set.
>
> Is there a way to test if a persistent object would be saved when the
> transaction is committed.
>
> Regards
>Estartu
>
> --
> 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 pylons-discuss@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/5b2f3caa-0c8e-dabb-bee0-d16868229771%40augusta.de
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 pylons-discuss@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWBv%2B0R9V5%3DWrrECWpJAxuBCM9ryxcCoK_7r5fuufb9vYA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[pylons-discuss] New websites powered by Pyramid

2019-02-20 Thread Thierry Florac
Hi everyone!

Just a small message to announce the birth of two new websites powered by
Pyramid!
I'm working for the french national forestry office and to manage it's new
website, I have built a new CMS called "Pyramid AMS" (shortened as
"PyAMS"); along with Python 3 and the Pyramid framework, it's using
additional components like Redis and Elasticsearch and is based on a ZODB
using RelStorage.

Most of developed components will be published soon as free software, but
some documentation is still to be written...; I will make another announce
when it will be available.

You can have access to this new website here: https://www.onf.fr
Of course any feedback is welcome!!

Moreover, I have built a "personal" website using the same framework and
components. Dedicated to H.P.Lovecraft, you can view it here to see default
provided "theme": https://www.ulthar.net

Best regards,
Thierry
-- 
  https://www.ulthar.net

-- 
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 pylons-discuss@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWC%2BiRUsksyZ5OZm%3D3U9oC4yO%2BZKcMRSmPLbr5b7mhfCsQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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

2019-07-25 Thread Thierry Florac
Hi,
In an application using ZODB traversal, I need to create a view whose
required permission depends on the state of the "context" object to which
the view is applied.
Can I just create an "un-protected" view (without static permission) and
check the permission in the view initialization code (and raise an
HTTPForbidden exception if the required permission is missing), or is there
a more elegant way to handle such a use case?
Best regards,
Thierry
-- 
  https://www.ulthar.net -- http://pyams.readthedocs.io

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWAChxFOKJrLUs8L%3DRUz6r6u9xQn2fwCFSqZTBA1ehK%2BAQ%40mail.gmail.com.


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

2019-07-25 Thread Thierry Florac
Thanks Michael!
Actually the permission may change because the view (a form) applies to a
an object whose permissions depends to it's own parent's status, and I
don't want to make these objects inter-dependant (the "child" doesn't have
to know the class of it's parent!); I also use a quite complex ACL factory
integrated with my security policy (using permissions, roles, groups and
more...) which I don't really want to override for this use case.
I've finally made the view "un-protected" in the "view_config" declaration,
and included some code in the view based on a generic interface and it
works perfectly!

Best regards,
Thierry
-- 
  https://www.ulthar.net -- http://pyams.readthedocs.io


Le jeu. 25 juil. 2019 à 17:06, Michael Merickel  a
écrit :

> 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 Thu, Jul 25, 2019 at 8:37 AM Thierry Florac  wrote:
>
>> Hi,
>> In an application using ZODB traversal, I need to create a view whose
>> required permission depends on the state of the "context" object to which
>> the view is applied.
>> Can I just create an "un-protected" view (without static permission) and
>> check the permission in the view initialization code (and raise an
>> HTTPForbidden exception if the required permission is missing), or is there
>> a more elegant way to handle such a use case?
>> Best regards,
>> Thierry
>> --
>>   https://www.ulthar.net -- http://pyams.readthedocs.io
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWAChxFOKJrLUs8L%3DRUz6r6u9xQn2fwCFSqZTBA1ehK%2BAQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWAChxFOKJrLUs8L%3DRUz6r6u9xQn2fwCFSqZTBA1ehK%2BAQ%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
>
>
> --
>
> Michael
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/CAKdhhwHTU4H2nKSm7b3j4SNA2T1bG8AT4Yhnx%2BjcQACA_HHb3g%40mail.gmail.com
> <https://groups.google.com/d/msgid/pylons-discuss/CAKdhhwHTU4H2nKSm7b3j4SNA2T1bG8AT4Yhnx%2BjcQACA_HHb3g%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWBse%2BJkURfbEgqi%2BubF4sg%3DAR8%2Beq%2Be7Owx2znRcxpQ_g%40mail.gmail.com.


[pylons-discuss] RelStorage transaction description

2019-11-13 Thread Thierry Florac
Hi,

Transaction API (ITransaction interface) allows to store user and 
description (at least the matching request URL) into a given transaction 
properties.
These properties are then visible using, for example, ZODBBrowser.
But I'm actually using RelStorage (2.1, actually testing new 3.0, with 
history-free storage) and can't see these attributes anymore!
Is there any way to get them back?
I'm actually using Pyramid 1.9.4...

Best regards,
Thierry

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/98ddb2af-6f57-43a5-9a9a-ed8063fa8648%40googlegroups.com.


Re: [pylons-discuss] RelStorage transaction description

2019-11-13 Thread Thierry Florac
Hi Jason,

Many thanks for your message!
The fact is that I realize that I can access to transaction information in 
other environments still using ZEO with FileStorage, not RelStorage!
For RelStorage I'm not planning to switch to history-mode any way...  ;)

Best regards,
Thierry

Le mercredi 13 novembre 2019 13:39:54 UTC+1, Jason Madden a écrit :
>
> Hi, 
>
> RelStorage in history-free mode has never stored transaction information 
> (description, user, extension). That's part of how it reduces the amount of 
> time and storage space needed. RelStorage only preserves those details in 
> history-preserving mode. 
>
> Note that it's not possible to simply switch between history-free and 
> history-preserving modes in an existing RDBMS schema; the data must be 
> copied into a new schema with the alternate configuration using zodbconvert 
> first (https://relstorage.readthedocs.io/en/latest/zodbconvert.html). 
>
> We have an open issue about improving the documentation for this at 
> https://github.com/zodb/relstorage/issues/112 
>
> Jason 
>
> > On Nov 13, 2019, at 06:02, Thierry Florac  > wrote: 
> > 
> > Hi, 
> > 
> > Transaction API (ITransaction interface) allows to store user and 
> description (at least the matching request URL) into a given transaction 
> properties. 
> > These properties are then visible using, for example, ZODBBrowser. 
> > But I'm actually using RelStorage (2.1, actually testing new 3.0, with 
> history-free storage) and can't see these attributes anymore! 
> > Is there any way to get them back? 
> > I'm actually using Pyramid 1.9.4... 
> > 
> > Best regards, 
> > Thierry 
>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/e0c4edad-c8a2-492e-8646-b09256962696%40googlegroups.com.


Re: [pylons-discuss] Re: Adding Websocket elements to existing Pyramid app

2019-12-08 Thread Thierry Florac
Hi Andrew,
I'm rally sorry but I have very much work actually and I have forgotten
your request!  :(
I'll come back with links to my packages ASAP, but I have to add a few
comments because the documentation is far for complete (but I'm looking for
contributors if anyone is interested!  :D :D ).
Best regards,
Thierry
-- 
  https://www.ulthar.net -- http://pyams.readthedocs.io


Le mar. 26 nov. 2019 à 01:30, Andrew Martin  a écrit :

> Yeah, I'm very interested in seeing as many different approaches to
> solving this as possible. Please do share if you don't mind.
>
> On Sunday, November 24, 2019 at 3:56:57 AM UTC-6, Thierry Florac wrote:
>>
>> Hi Andrew,
>>
>> I've built a notification mecanism using websockets in a Pyramid
>> application.
>> This is based on a second application process using gunicorn, while the
>> main application process is using classic WSGI (with Apache).
>> The two processes also communicate using websockets; I handle client
>> redirections between classic requests and websockets in Apache (using
>> mod_ws_tunnel).
>> I can share experience if you're interested with this project...
>>
>> Best regards,
>> Thierry
>> --
>>   https://www.ulthar.net -- http://pyams.readthedocs.io
>>
>>
>> Le dim. 24 nov. 2019 à 08:47, Andrew Martin  a écrit :
>>
>>> One thing I figured out almost immediately is that I can do what I want
>>> with ${ request.resource_url(resource, host=api_url) }
>>>
>>> Where the api_url is configured at runtime. That might be the simplest
>>> way to do things. But I will look into aiopyramid as mentioned.
>>>
>>> Thanks!
>>>
>>> On Sunday, November 24, 2019 at 12:40:02 AM UTC-6, Andrew Martin wrote:
>>>>
>>>> Hi there,
>>>>
>>>> I'd like to add a few real-time features to an existing pyramid app.
>>>> Notifications when queued tasks are complete and some real-time dashboards,
>>>> and chat.
>>>>
>>>> I'm thinking of an implementation that doesn't seem like it would be
>>>> super invasive, but I though I would check here and see if some of you more
>>>> experienced used see any obvious major problems first.
>>>>
>>>> Basically, I want to farm out the realtime elements to a websocket api
>>>> server. FastAPI seems like a good framework to do this. But I'd like to be
>>>> able to use the traversal machinery in pyramid to hit those endpoints in my
>>>> mako templates. So my javascript for opening the websocket can use
>>>> the request.resource_url() pattern and I don't have to do a ton of work to
>>>> figure out where in the external API I should be connecting.
>>>>
>>>> So for example if in my web app I'm at mywebsite.com/users/123456,
>>>> then I can have my websocket enpoint constructed by calling ${
>>>> request.resource_url(request.api, 'users', '123456') } and it would
>>>> generate a URL as api.mywebsite.com/api/v1/users/123456 where "
>>>> api.mywebsite.com/api/v1" is configured in the .ini file.
>>>>
>>>> To make that work I'd create a resource factory that adds the api
>>>> property to the Root object with the value set in the .ini file.
>>>>
>>>> The pyramid view would continue to provide the current values from a db
>>>> query, so there's a sane default to fall back on in case the websocket
>>>> can't connect. For authentication and authorization, I'd server the redis
>>>> instance I'm already using for server side sessions and just have the
>>>> FastAPI server check that session for whether or not the user is
>>>> authenticated/authorized or not.
>>>>
>>>> I think it should be relatively easy to share the SQLAlchemy models
>>>> between the two frameworks as well.
>>>>
>>>> Is this totally insane? Is there a better way to do this? Am I setting
>>>> myself for a world of pain that I'm not able to see right now? Just
>>>> wondering if anyone can offer any guidance before I buckle down and
>>>> implement this?
>>>>
>>>> I realize some of this is totally out of scope for this mailing list,
>>>> and I"m not asking anyone to comment on whether this is a good idea from
>>>> the FastAPI end of things. Just pretend that all just works. I'm really
>>>> just curious about the Pyramid implementation.
>>>>
>>>> thanks!
>>>>
>>>> -andrew
>>>

[pylons-discuss] Using Venusian with doctest decorator?

2019-11-25 Thread Thierry Florac


Hi,
I'm trying to test a Pyramid class decorator using Venusian in a simple 
doctest!
Is there any way with Venusian to scan and "activate" such decorator?

Best regards,
Thierry

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/5ce4e328-d1a4-4d23-9af1-85f1e8e8d9bc%40googlegroups.com.


Re: [pylons-discuss] Re: Adding Websocket elements to existing Pyramid app

2019-11-24 Thread Thierry Florac
Hi Andrew,

I've built a notification mecanism using websockets in a Pyramid
application.
This is based on a second application process using gunicorn, while the
main application process is using classic WSGI (with Apache).
The two processes also communicate using websockets; I handle client
redirections between classic requests and websockets in Apache (using
mod_ws_tunnel).
I can share experience if you're interested with this project...

Best regards,
Thierry
-- 
  https://www.ulthar.net -- http://pyams.readthedocs.io


Le dim. 24 nov. 2019 à 08:47, Andrew Martin  a écrit :

> One thing I figured out almost immediately is that I can do what I want
> with ${ request.resource_url(resource, host=api_url) }
>
> Where the api_url is configured at runtime. That might be the simplest way
> to do things. But I will look into aiopyramid as mentioned.
>
> Thanks!
>
> On Sunday, November 24, 2019 at 12:40:02 AM UTC-6, Andrew Martin wrote:
>>
>> Hi there,
>>
>> I'd like to add a few real-time features to an existing pyramid app.
>> Notifications when queued tasks are complete and some real-time dashboards,
>> and chat.
>>
>> I'm thinking of an implementation that doesn't seem like it would be
>> super invasive, but I though I would check here and see if some of you more
>> experienced used see any obvious major problems first.
>>
>> Basically, I want to farm out the realtime elements to a websocket api
>> server. FastAPI seems like a good framework to do this. But I'd like to be
>> able to use the traversal machinery in pyramid to hit those endpoints in my
>> mako templates. So my javascript for opening the websocket can use
>> the request.resource_url() pattern and I don't have to do a ton of work to
>> figure out where in the external API I should be connecting.
>>
>> So for example if in my web app I'm at mywebsite.com/users/123456, then
>> I can have my websocket enpoint constructed by calling ${
>> request.resource_url(request.api, 'users', '123456') } and it would
>> generate a URL as api.mywebsite.com/api/v1/users/123456 where "
>> api.mywebsite.com/api/v1" is configured in the .ini file.
>>
>> To make that work I'd create a resource factory that adds the api
>> property to the Root object with the value set in the .ini file.
>>
>> The pyramid view would continue to provide the current values from a db
>> query, so there's a sane default to fall back on in case the websocket
>> can't connect. For authentication and authorization, I'd server the redis
>> instance I'm already using for server side sessions and just have the
>> FastAPI server check that session for whether or not the user is
>> authenticated/authorized or not.
>>
>> I think it should be relatively easy to share the SQLAlchemy models
>> between the two frameworks as well.
>>
>> Is this totally insane? Is there a better way to do this? Am I setting
>> myself for a world of pain that I'm not able to see right now? Just
>> wondering if anyone can offer any guidance before I buckle down and
>> implement this?
>>
>> I realize some of this is totally out of scope for this mailing list, and
>> I"m not asking anyone to comment on whether this is a good idea from the
>> FastAPI end of things. Just pretend that all just works. I'm really just
>> curious about the Pyramid implementation.
>>
>> thanks!
>>
>> -andrew
>>
>>
>> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/2deaba67-cca3-4cb5-8ef1-5b11a59c4087%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWDvDh5S6hGfjiw-tSqh-t4R09wz7E43692Ezhe4SN_gDg%40mail.gmail.com.


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

2021-01-06 Thread Thierry Florac
I also have to be able to schedule tasks, so I actually include the
APScheduler package in my projects to make this scheduling.
Can pyramid-tasks be used also in this context?


Le mer. 6 janv. 2021 à 19:44, 'Jonathan Vanasco' via pylons-discuss <
pylons-discuss@googlegroups.com> a écrit :

> pyramid_tasks looks very promising! thanks for sharing this.  i may use it
> in the future.  i'll have to see if it is compatible with our setup.
>
> our celery app is mostly tasks that have been migrated from a twisted
> daemon.  we already ran web spiders and social-media-account importers
> through twisted, so all the resizing stuff was originally pyramid creating
> database entries (messages) for twisted to process.  although we still use
> twisted for those tasks (and more!) migrating to celery for these simpler
> functions has been really productive and timesaving.  the code is cleaner
> and easier to maintain, and troubleshooting/bugfixing is so much simpler.
> On Wednesday, January 6, 2021 at 12:51:37 PM UTC-5 the...@luhn.com wrote:
>
>> Seems like a good time to plug my new project:
>> https://pypi.org/project/pyramid-tasks/
>>
>> Pyramid and Celery are so dramatically different it’s a pain to integrate
>> them, and any code shared between them can’t access anything
>> Pyramid-specific.  Got tired of trying to make a square peg fit in a round
>> hole, so I brought my entire Pyramid application over to my Celery worker.
>> Having a request object available in a Celery task is incredibly
>> convenient, and my code is much tidier not having to tiptoe around the
>> differences in environments.
>>
>> On Jan 6, 2021, at 2:14 AM, Adam Groszer  wrote:
>>
>> Hi,
>>
>> Yeah celery is the way to go.
>> There's https://github.com/sontek/pyramid_celery to check out.
>> Some things to keep in mind is, you'll need a shared DB, good-old ZODB
>> with filestorage is not enough, because more processes will need to have
>> access.
>> Do not store valuable data in the celery queue, consider it ephemeral, go
>> through a real DB.
>>
>> On Tuesday, January 5, 2021 at 10:31:15 PM UTC+1 tfl...@gmail.com wrote:
>>
>>> Hi Jonathan,
>>>
>>> Thank you for this description of Celery!
>>> I'll try to have a look at it if I can get a little time, it seems to be
>>> a good replacement (probably more reliable!) 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 :
>>>
 Thierry,

 That is what I mostly use Celery for (it's also used for generating
 Reports, ACME SSL Certificates and a few other things). A Pyramid Request
 will defer a job(s) to Celery via the "Transport Backend" and receive a
 task/messaging ID.  Subsequent requests will poll the Celery "Result
 Backend"  for the status of that job, based on the ID.  This way we show
 the "Still processing!" message to users.

 Celery is run as a worker with multiple processes. The Celery task
 manager grabs a task off the queue, then does the resizing, uploads to S3,
 and notifies the Result Backend when complete.  I use Redis for Result and
 Transport.  I think there was once a ZeroMQ integration; there is
 definitely RabbitMQ integration, it's one of the more popular options.

 On Monday, January 4, 2021 at 12:25:44 PM UTC-5 tfl...@gmail.com wrote:

> Hi Jonathan,
>
> I didn't have a look at Celery yet, maybe it could work...
> My goal is to be able to start long-running tasks (medias files
> conversions for example) whose definition is stored in database and 
> managed
> by end users from my main Pyramid application; for this, I create a
> dedicated sub-process which is "managed" using ZeroMQ messages (I use this
> because it's also used for other non-Python/Pyramid applications).
> Tasks are then started using dedicated threads.
>
> Everything is OK until now... My only requirement now is to be able to
> get 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 à 17:51, 'Jonathan Vanasco' via pylons-discuss <
> pylons-...@googlegroups.com> a écrit :
>
>> 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 main Pyramid
>>> application; these processes are used to handle "commands" received from
>>> ZeroMQ 

Re: [pylons-discuss] Re: Pyramid maintenance mode

2021-01-07 Thread Thierry Florac
I've built a custom Pyramid tween to handle this and redirect requests
while application is up!
It can handle redirects (based on regular expressions) before or after the
request is handled by Pyramid application, to be able to set the site in
"maintenance mode", or to handle custom redirects in case of NotFound
exceptions...
All configuration is done through our Pyramid CMS.

Best regards,
Thierry
-- 
  https://www.ulthar.net -- http://pyams.readthedocs.io


Le jeu. 7 janv. 2021 à 18:43, 'Jonathan Vanasco' via pylons-discuss <
pylons-discuss@googlegroups.com> a écrit :

> 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 looking for an easy way to temporarily redirect all the users of my
>> pyramid website to a maintenance vue without having to comment/delete, etc
>> my routes.
>> I would like to make it easy to re-activate the others routes when the
>> maintenance is done.
>> I found this :
>> https://pypi.org/project/pyramid_maintenance/
>> but  I always get :
>>
>> in renderer
>> raise ValueError('No such renderer factory %s' % str(self.type))
>> ValueError: No such renderer factory .jinja2"
>>
>> with my browser displaying :
>> "Internal Server Error The server encountered an unexpected internal
>> server error (generated by waitress)"
>>
>> I am new to Pyramid so please give me the necessary details step by step.
>>
>> Best regards.
>> Cedric J.
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/98a779a5-5bcc-4971-a271-a202cc49f732n%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWBO5j0im6r0RRKEf%3D%3DzXyx5y_Qp%3DUJ5bntEGQtdiDejKQ%40mail.gmail.com.


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

2020-11-13 Thread Thierry Florac
Very clear!  :)
Many thanks !!

Thierry
-- 
  https://www.ulthar.net -- http://pyams.readthedocs.io


Le jeu. 12 nov. 2020 à 21:30, Michael Merickel  a
écrit :

> 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
> lifecycle and can be shared with middleware etc that is not Pyramid.
>
> The recommendation is to almost always store data on the request unless
> you have a really good reason not to.
>
> - Michael
>
> On Nov 12, 2020, at 14:10, 'Jonathan Vanasco' via pylons-discuss <
> pylons-discuss@googlegroups.com> wrote:
>
> 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.
>
>
> https://docs.pylonsproject.org/projects/pyramid/en/latest/api/config.html#pyramid.config.Configurator.add_request_method
>
>
> On Thursday, November 12, 2020 at 8:57:58 AM UTC-5 tfl...@gmail.com wrote:
>
>> Hi,
>> When we have to store custom information about current request, we can
>> use it's properties, attributes or environment (or even annotations).
>> What is the correct usage of each of them, and is there any benefit of
>> using one of them against the others?
>>
>> Best regards,
>> Thierry
>> --
>>   https://www.ulthar.net -- http://pyams.readthedocs.io
>>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/344da45e-9eef-436a-9eb9-66e40dda0e56n%40googlegroups.com
> 
> .
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/47DF611C-D487-4AED-80BA-47F75A1888A4%40gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWAJvBF4PYfjwijsNT8GHdnQs%2BnzRiaAJ9cpOKX1WvXS4w%40mail.gmail.com.


[pylons-discuss] Request attributes vs request environment

2020-11-12 Thread Thierry Florac
Hi,
When we have to store custom information about current request, we can use
it's properties, attributes or environment (or even annotations).
What is the correct usage of each of them, and is there any benefit of
using one of them against the others?

Best regards,
Thierry
-- 
  https://www.ulthar.net -- http://pyams.readthedocs.io

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWCxE500%2Bkc46J5czPv-7ATAZV7MrXuoqW%2B8c57i1Uy7pw%40mail.gmail.com.


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

2021-01-05 Thread Thierry Florac
Hi Jonathan,

Thank you for this description of Celery!
I'll try to have a look at it if I can get a little time, it seems to be a
good replacement (probably more reliable!) 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-discuss@googlegroups.com> a écrit :

> Thierry,
>
> That is what I mostly use Celery for (it's also used for generating
> Reports, ACME SSL Certificates and a few other things). A Pyramid Request
> will defer a job(s) to Celery via the "Transport Backend" and receive a
> task/messaging ID.  Subsequent requests will poll the Celery "Result
> Backend"  for the status of that job, based on the ID.  This way we show
> the "Still processing!" message to users.
>
> Celery is run as a worker with multiple processes. The Celery task manager
> grabs a task off the queue, then does the resizing, uploads to S3, and
> notifies the Result Backend when complete.  I use Redis for Result and
> Transport.  I think there was once a ZeroMQ integration; there is
> definitely RabbitMQ integration, it's one of the more popular options.
>
> On Monday, January 4, 2021 at 12:25:44 PM UTC-5 tfl...@gmail.com wrote:
>
>> Hi Jonathan,
>>
>> I didn't have a look at Celery yet, maybe it could work...
>> My goal is to be able to start long-running tasks (medias files
>> conversions for example) whose definition is stored in database and managed
>> by end users from my main Pyramid application; for this, I create a
>> dedicated sub-process which is "managed" using ZeroMQ messages (I use this
>> because it's also used for other non-Python/Pyramid applications).
>> Tasks are then started using dedicated threads.
>>
>> Everything is OK until now... My only requirement now is to be able to
>> get 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 à 17:51, 'Jonathan Vanasco' via pylons-discuss <
>> pylons-...@googlegroups.com> a écrit :
>>
>>> 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 main Pyramid application;
 these processes are used to handle "commands" received from ZeroMQ 
 messages.
 If I use the components registry to register adapters and utilities
 which are also required in these processes, is there a way to start these
 processes so that they can "inherit" from the main application registry ?

 I'm actually using Pyramid 1.10.5, and I generally do a
 "config.hook_zca()" on application startup before doing
 the "config.setup_registry()" and "config.scan()".
 I tried to do the same operations in my sub-process "run" method, but I
 always get the "global" registry instead of my "webapp" registry which was
 configured in my main application...

 Best regards,
 Thierry
 --
   https://www.ulthar.net -- http://pyams.readthedocs.io

>>> --
>>> 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-discus...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/pylons-discuss/9a3e8a04-1a29-4f18-885e-dc3ac1c759b3n%40googlegroups.com
>>> 
>>> .
>>>
>> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/5ac83ff1-747f-4df9-994c-ffa48f339013n%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWC46yjf55pcMEYKmjv3%3DpwBP8%2BvTs%2B_vdn5uBySpLHNsg%40mail.gmail.com.


Re: [pylons-discuss] Re: Pyramid maintenance mode

2021-01-08 Thread Thierry Florac
te from the documentation.
>>>>
>>>>
>>>> https://pyramid.readthedocs.io/en/latest/narr/hooks.html#registering-tweens
>>>>
>>>> I adapted the code for your use case (untested). Your module would have
>>>> something like this:
>>>>
>>>> # Module 'myapp.lib.mytween'
>>>>
>>>> def includeme(config):
>>>> # Calculate the dotted name of the factory function.
>>>> # E.g., "myapp.lib.mytween.my_tween_factory".
>>>> factory_name = __name__ + ".my_tween_factory"
>>>> config.add_tween(factory_name)
>>>> # You can wrap app this in an 'if' to conditionally enable it; e.g.,
>>>> # ``if
>>>> pyramid.settings.asbool(config.registry.settings.get("myoption", True))``
>>>>
>>>> def my_tween_factory(handler, registry):
>>>> # Return a tween callable.
>>>> # 'handler' is the next tween or the WSGI application.
>>>> # Deployment settings are in 'registry.settings'.
>>>> def my_tween(handler, request):
>>>> if is_maintenance_mode:   # Could limit it to certain
>>>> request.path's.
>>>> # Return an error response, bypassing the application.
>>>> return
>>>> pyramid.response.HTTPServiceUnavailable(maintenance_message)
>>>> else:
>>>> # Call next tween/application and return its response
>>>> unchanged.
>>>> return handler(request)
>>>>
>>>> Then list your module in 'pyramid.includes' in the config file. E.g.,
>>>> "myapp.lib.mytween".
>>>>
>>>> That 'if is_maintenance_mode' condition could check whether a specified
>>>> file exists. The file path could be in a config setting.
>>>>
>>>> On Thu, Jan 7, 2021 at 3:32 PM C J  wrote:
>>>>
>>>>>
>>>>> That's really interesting Thierry. Can you please show me how to do?
>>>>> I have tried to use tweens. I tried many things starting with
>>>>> *pyramid.tweens = pyramid_maintenance.tween_maintenance *and modifying
>>>>>  the *__init__.py* file, however, I do not understand what they are
>>>>> and how to use them despite hours spent reading the Pyramid
>>>>> documentation and different articles.
>>>>> Being working on a website that is already in production I also wonder
>>>>> how I would be able to implement your solution based on an external CMS.
>>>>>
>>>>>
>>>>> [image: Mailtrack]
>>>>> <https://mailtrack.io?utm_source=gmail_medium=signature_campaign=signaturevirality5;>
>>>>>  Sender
>>>>> notified by
>>>>> Mailtrack
>>>>> <https://mailtrack.io?utm_source=gmail_medium=signature_campaign=signaturevirality5;>
>>>>>  07/01/21
>>>>> à 21:59:31
>>>>>
>>>>> On Thu, Jan 7, 2021 at 9:22 PM Thierry Florac 
>>>>> wrote:
>>>>>
>>>>>> I've built a custom Pyramid tween to handle this and redirect
>>>>>> requests while application is up!
>>>>>> It can handle redirects (based on regular expressions) before or
>>>>>> after the request is handled by Pyramid application, to be able to set 
>>>>>> the
>>>>>> site in "maintenance mode", or to handle custom redirects in case of
>>>>>> NotFound exceptions...
>>>>>> All configuration is done through our Pyramid CMS.
>>>>>>
>>>>>> Best regards,
>>>>>> Thierry
>>>>>> --
>>>>>>   https://www.ulthar.net -- http://pyams.readthedocs.io
>>>>>>
>>>>>>
>>>>>> Le jeu. 7 janv. 2021 à 18:43, 'Jonathan Vanasco' via pylons-discuss <
>>>>>> pylons-...@googlegroups.com> a écrit :
>>>>>>
>>>>>>> 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,
&

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

2021-01-10 Thread Thierry Florac
Fine!
I'll have to take some time to have a look at Celery and at your package,
to see how I can adapt my own scheduler framework to it...
Best regards,
Thierry
-- 
  https://www.ulthar.net -- http://pyams.readthedocs.io


Le dim. 10 janv. 2021 à 03:09, Theron Luhn  a écrit :

> Hi Thierry,
>
> I’ve added support for periodic tasks in Pyramid Tasks.
> https://github.com/luhn/pyramid-tasks#periodic-tasks
>
> On Jan 6, 2021, at 11:46 PM, Adam Groszer  wrote:
>
> You can schedule any task with various options with celery:
>
>
> https://docs.celeryproject.org/en/stable/userguide/calling.html#eta-and-countdown
>
> On Wednesday, January 6, 2021 at 8:22:28 PM UTC+1 tfl...@gmail.com wrote:
>
>> I also have to be able to schedule tasks, so I actually include the
>> APScheduler package in my projects to make this scheduling.
>> Can pyramid-tasks be used also in this context?
>>
>>
>> Le mer. 6 janv. 2021 à 19:44, 'Jonathan Vanasco' via pylons-discuss <
>> pylons-...@googlegroups.com> a écrit :
>>
>>> pyramid_tasks looks very promising! thanks for sharing this.  i may use
>>> it in the future.  i'll have to see if it is compatible with our setup.
>>>
>>> our celery app is mostly tasks that have been migrated from a twisted
>>> daemon.  we already ran web spiders and social-media-account importers
>>> through twisted, so all the resizing stuff was originally pyramid creating
>>> database entries (messages) for twisted to process.  although we still use
>>> twisted for those tasks (and more!) migrating to celery for these simpler
>>> functions has been really productive and timesaving.  the code is cleaner
>>> and easier to maintain, and troubleshooting/bugfixing is so much simpler.
>>> On Wednesday, January 6, 2021 at 12:51:37 PM UTC-5 the...@luhn.com
>>> wrote:
>>>
 Seems like a good time to plug my new project:
 https://pypi.org/project/pyramid-tasks/

 Pyramid and Celery are so dramatically different it’s a pain to
 integrate them, and any code shared between them can’t access anything
 Pyramid-specific.  Got tired of trying to make a square peg fit in a round
 hole, so I brought my entire Pyramid application over to my Celery worker.
 Having a request object available in a Celery task is incredibly
 convenient, and my code is much tidier not having to tiptoe around the
 differences in environments.

 On Jan 6, 2021, at 2:14 AM, Adam Groszer  wrote:

 Hi,

 Yeah celery is the way to go.
 There's https://github.com/sontek/pyramid_celery to check out.
 Some things to keep in mind is, you'll need a shared DB, good-old ZODB
 with filestorage is not enough, because more processes will need to have
 access.
 Do not store valuable data in the celery queue, consider it ephemeral,
 go through a real DB.

 On Tuesday, January 5, 2021 at 10:31:15 PM UTC+1 tfl...@gmail.com
 wrote:

> Hi Jonathan,
>
> Thank you for this description of Celery!
> I'll try to have a look at it if I can get a little time, it seems to
> be a good replacement (probably more reliable!) 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 :
>
>> Thierry,
>>
>> That is what I mostly use Celery for (it's also used for generating
>> Reports, ACME SSL Certificates and a few other things). A Pyramid Request
>> will defer a job(s) to Celery via the "Transport Backend" and receive a
>> task/messaging ID.  Subsequent requests will poll the Celery "Result
>> Backend"  for the status of that job, based on the ID.  This way we show
>> the "Still processing!" message to users.
>>
>> Celery is run as a worker with multiple processes. The Celery task
>> manager grabs a task off the queue, then does the resizing, uploads to 
>> S3,
>> and notifies the Result Backend when complete.  I use Redis for Result 
>> and
>> Transport.  I think there was once a ZeroMQ integration; there is
>> definitely RabbitMQ integration, it's one of the more popular options.
>>
>> On Monday, January 4, 2021 at 12:25:44 PM UTC-5 tfl...@gmail.com
>> wrote:
>>
>>> Hi Jonathan,
>>>
>>> I didn't have a look at Celery yet, maybe it could work...
>>> My goal is to be able to start long-running tasks (medias files
>>> conversions for example) whose definition is stored in database and 
>>> managed
>>> by end users from my main Pyramid application; for this, I create a
>>> dedicated sub-process which is "managed" using ZeroMQ messages (I use 
>>> this
>>> because it's also used for other non-Python/Pyramid applications).
>>> Tasks are then started using dedicated threads.
>>>
>>> Everything is OK until now... My only requirement now is 

[pylons-discuss] Pyramid packaging

2021-01-26 Thread Thierry Florac
Hi,

Sorry if this is not a real Pyramid topic, but I'm looking for a few
advices...

I'm using zc.buildout for a very long time, with zc.recipe.egg, to build
all my Python packages and also to handle all my deployment environments,
and I've always been very happy with it!  :)
But since a few days, I can't install zc.recipe.egg with any Python 3.6 or
higher version, only with Python 3.5! Here is a traceback from a Gitlab-CI
job with Python 3.7:

52
$
./bin/buildout
65 Setting
socket time out to 3 seconds.
66 Develop:
'/builds/pyams/pyams-security/.'
67 warning:
no files found matching '*.txt'
68 warning:
no previously-included files matching '*.pyc' found anywhere in distribution
69 warning:
no previously-included files matching '*.*~' found anywhere in distribution
70 Couldn't
develop '/builds/pyams/pyams-security/../ext/lingua' (not found)
71 Couldn't
develop '/builds/pyams/pyams-security/../pyams_catalog' (not found)
72 Couldn't
develop '/builds/pyams/pyams-security/../pyams_file' (not found)
73 Couldn't
develop '/builds/pyams/pyams-security/../pyams_i18n' (not found)
74 Couldn't
develop '/builds/pyams/pyams-security/../pyams_mail' (not found)
75 Couldn't
develop '/builds/pyams/pyams-security/../pyams_site' (not found)
76 Couldn't
develop '/builds/pyams/pyams-security/../pyams_utils' (not found)
77 Getting
distribution for 'zc.recipe.egg==2.0.7'.
78 Traceback
(most recent call last):
79  File
"", line 1, in 
80 ImportError:
cannot import name 'main' from 'setuptools.command.easy_install'
(/usr/local/lib/python3.7/site-packages/setuptools/command/easy_install.py)
81 An error
occurred when trying to install
/tmp/tmpfpwsm7_5get_dist/zc.recipe.egg-2.0.7.tar.gz. Look above this
message for any errors that were output by easy_install.
82 While:
83 
Installing.
84  Getting
section package.
85 
Initializing section package.
86 
Installing recipe zc.recipe.egg.
87  Getting
distribution for 'zc.recipe.egg==2.0.7'.
88 An
internal error occurred due to a bug in either zc.buildout or in a
89 recipe
being used:
90 Traceback
(most recent call last):
91  File
"/builds/pyams/pyams-security/eggs/zc.buildout-2.13.3-py3.7.egg/zc/buildout/buildout.py",
line 2174, in main
92 
getattr(buildout, command)(args)
93  File
"/builds/pyams/pyams-security/eggs/zc.buildout-2.13.3-py3.7.egg/zc/buildout/buildout.py",
line 701, in install
94 
[self[part]['recipe'] for part in install_parts]
95  File
"/builds/pyams/pyams-security/eggs/zc.buildout-2.13.3-py3.7.egg/zc/buildout/buildout.py",
line 701, in 
96 
[self[part]['recipe'] for part in install_parts]
97  File
"/builds/pyams/pyams-security/eggs/zc.buildout-2.13.3-py3.7.egg/zc/buildout/buildout.py",
line 1324, in __getitem__
98 
options._initialize()
99  File

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

2021-01-04 Thread Thierry Florac
Hi,

I need to create custom sub-processes from my main Pyramid application;
these processes are used to handle "commands" received from ZeroMQ messages.
If I use the components registry to register adapters and utilities which
are also required in these processes, is there a way to start these
processes so that they can "inherit" from the main application registry ?

I'm actually using Pyramid 1.10.5, and I generally do a "config.hook_zca()"
on application startup before doing the "config.setup_registry()" and
"config.scan()".
I tried to do the same operations in my sub-process "run" method, but I
always get the "global" registry instead of my "webapp" registry which was
configured in my main application...

Best regards,
Thierry
-- 
  https://www.ulthar.net -- http://pyams.readthedocs.io

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWD%2B65yeLUG2%3DSijVbTU5dJewnOJX%2BJ7bWSfW%3DjmNPCyLw%40mail.gmail.com.


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

2021-01-04 Thread Thierry Florac
Hi Jonathan,

I didn't have a look at Celery yet, maybe it could work...
My goal is to be able to start long-running tasks (medias files conversions
for example) whose definition is stored in database and managed by end
users from my main Pyramid application; for this, I create a dedicated
sub-process which is "managed" using ZeroMQ messages (I use this
because it's also used for other non-Python/Pyramid applications).
Tasks are then started using dedicated threads.

Everything is OK until now... My only requirement now is to be able to get
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 à 17:51, 'Jonathan Vanasco' via pylons-discuss <
pylons-discuss@googlegroups.com> a écrit :

> 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 main Pyramid application;
>> these processes are used to handle "commands" received from ZeroMQ messages.
>> If I use the components registry to register adapters and utilities which
>> are also required in these processes, is there a way to start these
>> processes so that they can "inherit" from the main application registry ?
>>
>> I'm actually using Pyramid 1.10.5, and I generally do a
>> "config.hook_zca()" on application startup before doing
>> the "config.setup_registry()" and "config.scan()".
>> I tried to do the same operations in my sub-process "run" method, but I
>> always get the "global" registry instead of my "webapp" registry which was
>> configured in my main application...
>>
>> Best regards,
>> Thierry
>> --
>>   https://www.ulthar.net -- http://pyams.readthedocs.io
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/9a3e8a04-1a29-4f18-885e-dc3ac1c759b3n%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWADs1fgqz2VRyEWupMsrv2hPA-JdD%2BsaB-7ZKekfuMwwg%40mail.gmail.com.


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

2021-01-04 Thread Thierry Florac
Hi (again)!

I think it's finally OK!
I forgot ZCA hook is based on Pyramid's "current registry", which is bound
to a thread-local variable, so that's why I have to push them on
threadlocal manager in my threads "run" methods (and not in the constructor
as I have tried before)!!
Maybe there is another better way to handle that anyway, so any advice is
always welcome!

Best regards,
Thierry
-- 
  https://www.ulthar.net -- http://pyams.readthedocs.io


Le lun. 4 janv. 2021 à 18:25, Thierry Florac  a écrit :

> Hi Jonathan,
>
> I didn't have a look at Celery yet, maybe it could work...
> My goal is to be able to start long-running tasks (medias files
> conversions for example) whose definition is stored in database and managed
> by end users from my main Pyramid application; for this, I create a
> dedicated sub-process which is "managed" using ZeroMQ messages (I use this
> because it's also used for other non-Python/Pyramid applications).
> Tasks are then started using dedicated threads.
>
> Everything is OK until now... My only requirement now is to be able to get
> 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 à 17:51, 'Jonathan Vanasco' via pylons-discuss <
> pylons-discuss@googlegroups.com> a écrit :
>
>> 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 main Pyramid application;
>>> these processes are used to handle "commands" received from ZeroMQ messages.
>>> If I use the components registry to register adapters and utilities
>>> which are also required in these processes, is there a way to start these
>>> processes so that they can "inherit" from the main application registry ?
>>>
>>> I'm actually using Pyramid 1.10.5, and I generally do a
>>> "config.hook_zca()" on application startup before doing
>>> the "config.setup_registry()" and "config.scan()".
>>> I tried to do the same operations in my sub-process "run" method, but I
>>> always get the "global" registry instead of my "webapp" registry which was
>>> configured in my main application...
>>>
>>> Best regards,
>>> Thierry
>>> --
>>>   https://www.ulthar.net -- http://pyams.readthedocs.io
>>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/pylons-discuss/9a3e8a04-1a29-4f18-885e-dc3ac1c759b3n%40googlegroups.com
>> <https://groups.google.com/d/msgid/pylons-discuss/9a3e8a04-1a29-4f18-885e-dc3ac1c759b3n%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWCL7mmiSOr1nLUgN2mMpqvsnCKsXghTDON0YpJMXen1Jw%40mail.gmail.com.


Re: [pylons-discuss] Pyramid packaging

2021-01-26 Thread Thierry Florac
Well...
It seems that the last release of zc.buildout is not compatible with the
last setuptools release!
I downgraded setuptools to 50.3.2 and everything seems OK...

Anyway, my initial question is still open: what packaging and deployment
tools do you use to have a full and easy control of a package and all its
dependencies?

Best regards,
Thierry
-- 
  https://www.ulthar.net -- http://pyams.readthedocs.io


Le mar. 26 janv. 2021 à 11:27, Thierry Florac  a écrit :

> Hi Steve,
> I know that Python 3.5 is outdated, but I still have old production
> environments which can't be upgraded before several months...
> Anyway, I tried to create another Gitlab-CI configuration with Python
> support starting from release 3.7, with installation of zc.recipe.egg from
> pip instead of zc.buildout§ That works are start, but is failing afterwards
> on installation of "pyramid_chameleon":
>
> 53
> <https://gitlab.onf.fr/onf/support/python/pyramid/pyams-v2/pyams-security/-/jobs/3162#L53>$
> pip --version
> 53
> <https://gitlab.onf.fr/onf/support/python/pyramid/pyams-v2/pyams-security/-/jobs/3162#L53>pip
> 21.0 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)
> 54
> <https://gitlab.onf.fr/onf/support/python/pyramid/pyams-v2/pyams-security/-/jobs/3162#L54>$
> pip install zc.buildout zc.recipe.egg
> 55
> <https://gitlab.onf.fr/onf/support/python/pyramid/pyams-v2/pyams-security/-/jobs/3162#L55>Collecting
> zc.buildout
> 56
> <https://gitlab.onf.fr/onf/support/python/pyramid/pyams-v2/pyams-security/-/jobs/3162#L56>
> Downloading zc.buildout-2.13.3-py2.py3-none-any.whl (153 kB)
> 57
> <https://gitlab.onf.fr/onf/support/python/pyramid/pyams-v2/pyams-security/-/jobs/3162#L57>Collecting
> zc.recipe.egg
> 58
> <https://gitlab.onf.fr/onf/support/python/pyramid/pyams-v2/pyams-security/-/jobs/3162#L58>
> Downloading zc.recipe.egg-2.0.7.tar.gz (39 kB)
> 59
> <https://gitlab.onf.fr/onf/support/python/pyramid/pyams-v2/pyams-security/-/jobs/3162#L59>Requirement
> already satisfied: setuptools>=8.0 in
> /usr/local/lib/python3.7/site-packages (from zc.buildout) (52.0.0)
> 60
> <https://gitlab.onf.fr/onf/support/python/pyramid/pyams-v2/pyams-security/-/jobs/3162#L60>Building
> wheels for collected packages: zc.recipe.egg
> 61
> <https://gitlab.onf.fr/onf/support/python/pyramid/pyams-v2/pyams-security/-/jobs/3162#L61>
> Building wheel for zc.recipe.egg (setup.py): started
> 62
> <https://gitlab.onf.fr/onf/support/python/pyramid/pyams-v2/pyams-security/-/jobs/3162#L62>
> Building wheel for zc.recipe.egg (setup.py): finished with status 'done'
> 63
> <https://gitlab.onf.fr/onf/support/python/pyramid/pyams-v2/pyams-security/-/jobs/3162#L63>
> Created wheel for zc.recipe.egg:
> filename=zc.recipe.egg-2.0.7-py2.py3-none-any.whl size=30630
> sha256=94a85f05da7e1bab3a4781df108d517b41cffd76fc23f8c13f0869a770de578b
> 64
> <https://gitlab.onf.fr/onf/support/python/pyramid/pyams-v2/pyams-security/-/jobs/3162#L64>
> Stored in directory:
> /root/.cache/pip/wheels/e2/5a/85/26e91f2a8af819f36960aed0be70c6ac36217f3162e8948030
> 65
> <https://gitlab.onf.fr/onf/support/python/pyramid/pyams-v2/pyams-security/-/jobs/3162#L65>Successfully
> built zc.recipe.egg
> 66
> <https://gitlab.onf.fr/onf/support/python/pyramid/pyams-v2/pyams-security/-/jobs/3162#L66>Installing
> collected packages: zc.buildout, zc.recipe.egg
> 67
> <https://gitlab.onf.fr/onf/support/python/pyramid/pyams-v2/pyams-security/-/jobs/3162#L67>Successfully
> installed zc.buildout-2.13.3 zc.recipe.egg-2.0.7
> 68
> <https://gitlab.onf.fr/onf/support/python/pyramid/pyams-v2/pyams-security/-/jobs/3162#L68>$
> buildout
> 69
> <https://gitlab.onf.fr/onf/support/python/pyramid/pyams-v2/pyams-security/-/jobs/3162#L69>Setting
> socket time out to 3 seconds.
> 70
> <https://gitlab.onf.fr/onf/support/python/pyramid/pyams-v2/pyams-security/-/jobs/3162#L70>Creating
> directory
> '/builds/G3v_6jyd/0/onf/support/python/pyramid/pyams-v2/pyams-security/develop-eggs'.
> 71
> <https://gitlab.onf.fr/onf/support/python/pyramid/pyams-v2/pyams-security/-/jobs/3162#L71>Develop:
> '/builds/G3v_6jyd/0/onf/support/python/pyramid/pyams-v2/pyams-security/.'
> 72
> <https://gitlab.onf.fr/onf/support/python/pyramid/pyams-v2/pyams-security/-/jobs/3162#L72>warning:
> no files found matching '*.txt'
> 73
> <https://gitlab.onf.fr/onf/support/python/pyramid/pyams-v2/pyams-security/-/jobs/3162#L73>warning:
> no previously-included files matching '*.pyc' found anywhere in distribution
> 74
> <https://gitlab.onf.fr/onf/support/python/pyramid/pyams-v2/pyams-security/-/jobs/3162#L74>warning:
> no previously-included files matching 

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

2021-05-09 Thread Thierry Florac
Hi,
Are you asking about the way to protect a view with a permission, or about
the way to grant this permission to a request?
Best regards,
Thierry
-- 
  https://www.ulthar.net -- http://pyams.readthedocs.io


Le dim. 9 mai 2021 à 19:00, pzzcc  a écrit :

> Hi,
>
> I am trying to wrap my head around some pyramid concepts and I am trying
> to figure out how does a view config know what a permission like (* view
> , edit , create *) is ?
>
> does it rely on the pyramid_tm r or the routes or what  ?
>
> I know how to use them but I need to wrap my head againts some concepts.
>
> thanks.
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/2b676239-b805-40d6-9ae2-1e4c60a9a7dcn%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWCYnWP_Rrbgk1ZBP1JBUN8KNztgj5%3DJ_Q_8%2B_uvAXAv_A%40mail.gmail.com.


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

2021-02-09 Thread Thierry Florac
Hi Michael,

I finally made my REST API service to accept both multipart/form-data and
JSON base64 encoded data...
Implementation is probably not "perfect" (I found that Colander is probably
lacking a few documentation about creating and registering custom types and
converters), but at least it works!  :)

Best regards,
Thierry
-- 
  https://www.ulthar.net -- http://pyams.readthedocs.io


Le mar. 9 févr. 2021 à 06:13, Michael Merickel  a
écrit :

> 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
> headers but I think there's very few cases where that's compelling.
> BASE64'd binary data into JSON is the least desirable but it really depends
> on the situation - I'm definitely guilty of using it in certain scenarios
> (if you just really really really want a JSON body cuz that's what's
> easiest on the client-side).
>
> It's worth noting that Deform has its own mechanism for storing the file
> upload on the server such that you can connect it up to the form data from
> a separate request. This is handy to avoid re-transferring the data when
> parts of the form fail to validate.
>
> The CGI FieldStorage object is basically a wrapper around the content,
> providing a file-like interface for messing with it as webob may have done
> you a solid and stored the data to disk instead of blowing out your memory.
> You can always just read the content in from there. You'll also want to
> pull the content-type from that object. After that validation is up to you.
>
> Finally, if the request got all the way to your WSGI app then it's almost
> guaranteed that it was already fully parsed/received from the client by
> your WSGI server or any middleware/API calls so it's (probably) too late at
> that point to really validate and reject based on the size. You'd want to
> do that upstream prior to the body being read if it's really large data
> you're worried about receiving.
>
> - Michael
>
> On Feb 7, 2021, at 09:06, Thierry Florac  wrote:
>
> Hi,
>
> I'm starting to use Cornice, Colander and Swagger and I'm trying to create
> a REST service which should allow users to upload file(s)...
>
> Until now I'm using "multipart/form-data" encoding and it seems OK, but :
>  - is it actually a good practice to handle file uploads in a REST API
> using this encoding? Should I prefer something like JSON with base64 string
> encoding (including for use cases with large data files)??
>  - how should I handle schema verification with Colander for file upload
> fields (what I actually receive using form-data encoding is a CGI
> FieldStorage object) ?
>
> Best regards for any advise,
> Thierry
> --
>   https://www.ulthar.net -- http://pyams.readthedocs.io
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWBv8Ufg-ezeHPqeRXjwuF2f-8iSE8VRy7k3_n9iRp-LqA%40mail.gmail.com
> <https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWBv8Ufg-ezeHPqeRXjwuF2f-8iSE8VRy7k3_n9iRp-LqA%40mail.gmail.com?utm_medium=email_source=footer>
> .
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/314E86A9-A36F-439F-AD01-3F581ED87B92%40gmail.com
> <https://groups.google.com/d/msgid/pylons-discuss/314E86A9-A36F-439F-AD01-3F581ED87B92%40gmail.com?utm_medium=email_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWAgVYT%2BCR%2B1ZpGXPvHahk2XiBQCg1MXCwP%2B9YxxErEjbg%40mail.gmail.com.


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

2021-02-07 Thread Thierry Florac
Hi,

I'm starting to use Cornice, Colander and Swagger and I'm trying to create
a REST service which should allow users to upload file(s)...

Until now I'm using "multipart/form-data" encoding and it seems OK, but :
 - is it actually a good practice to handle file uploads in a REST API
using this encoding? Should I prefer something like JSON with base64 string
encoding (including for use cases with large data files)??
 - how should I handle schema verification with Colander for file upload
fields (what I actually receive using form-data encoding is a CGI
FieldStorage object) ?

Best regards for any advise,
Thierry
-- 
  https://www.ulthar.net -- http://pyams.readthedocs.io

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWBv8Ufg-ezeHPqeRXjwuF2f-8iSE8VRy7k3_n9iRp-LqA%40mail.gmail.com.


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

2021-02-11 Thread Thierry Florac
Hi Steve,

My message is probably wrong!
As far as I can remember, the miss was not in Colander documentation, but
in Cornice Swagger extension documentation about types converters
registration; an issue is already open to add this to it's documentation...

Best regards,
Thierry
-- 
  https://www.ulthar.net -- http://pyams.readthedocs.io


Le mar. 9 févr. 2021 à 11:46, Steve Piercy  a
écrit :

> On 2/9/21 12:56 AM, Thierry Florac wrote:
>
> > I found that Colander is probably lacking a few documentation about
> creating and registering custom types and converters
> I'd like to improve the docs.  Would you please open an issue with what
> you think is missing from this section?
>
> https://docs.pylonsproject.org/projects/colander/en/latest/extending.html
>
> I'd be happy to collaborate to make them more helpful.
>
> --steve
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/aa88b42d-33a0-b3ad-cd6e-739ad81d3296%40gmail.com
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWBot_C9s%3DSmwty%3De2AoagWmUmM4z%2BabAY8r%2BaLVqgkvrQ%40mail.gmail.com.


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

2022-02-20 Thread Thierry Florac
Hi,
I've built a custom content management framework based on Pyramid; it's a
classic web application, based on ZODB and RelStorage with a PostgreSQL
backend, a Redis cache and an Elasticsearch index, and I'm actually looking
for the best production deployment option.
Until now, I always used Apache with mod_wsgi, and I'm actually quite happy
with it, but I'd like to know if there is a better option with better
performance!
In development mode, I already tried using "native" Waitress server, a
GUnicorn server, and I just tried using Pypy with Waitress or GUnicorn but
performances were quite "disappointing"!

Any advice?

Best regards,
Thierry
-- 
  https://www.ulthar.net -- http://pyams.readthedocs.io

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWB3jW_dJGuG72YgPHEMM88CUpcAHsRL7xHsbV-hhF0DPQ%40mail.gmail.com.


Re: [pylons-discuss] determinate if app object is the server or created from a console script

2023-10-13 Thread Thierry Florac
Don't you have any way to declare a variable into your process environment?

Regards,
Thierry
-- 
  https://www.ulthar.net -- http://pyams.readthedocs.io


Le ven. 13 oct. 2023 à 09:47, Gerhard Schmidt  a écrit :

> Hi Thierry,
>
> not really a good option. The background thread is not started from the
> main project, but from a additional package (used in multiple projects).
> So it has no knowledge about the names of the console scripts.
>
> I could check for pserver as command to determinate if it's the server,
> but changing the wsgi server would break this.
>
> Regards
> Estartu
>
> Am 13.10.23 um 08:18 schrieb Thierry Florac:
> > Hi Gerhard,
> >
> > Maybe it's not the best way to handle this, but I generally create
> > custom command-line scripts (using Buildout) and just check for
> sys.argv...
> >
> > Best regards,
> > Thierry
> > --
> > https://www.ulthar.net <https://www.ulthar.net> --
> > http://pyams.readthedocs.io <http://pyams.readthedocs.io>
> >
> >
> > Le ven. 13 oct. 2023 à 07:00, Gerhard Schmidt  > <mailto:esta...@augusta.de>> a écrit :
> >
> > Hi there,
> >
> > I'm often running into the problem to determinate if the current app
> is
> > running as a server to server http requests or created from a console
> > script to do specific things.
> >
> > Mostly it's to decide if a background thread should be started
> (needed
> > in the Server) or not (can cause problems in the console script) in
> the
> > ApplicationCreated event.
> >
> > I'm using pyramid.paster.bootstrap to set up the app for a console
> > script.
> >
> > The problem is, the ApplicationCreated is called before I have a
> chance
> > to set anything in the registry to pass information along.
> >
> > I there a clean way know from the app object passed to the event
> alone.
> > I tried to pass a custom Request to bootstrap but the request is not
> > passed to this event.
> >
> > Regards
> >   Estartu
> >
> >
> >
> >
> >
> > --
> > 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
> > <mailto:pylons-discuss%2bunsubscr...@googlegroups.com>.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/pylons-discuss/008829c9-1180-4365-9f69-d22d59a09ccd%40augusta.de
> <
> https://groups.google.com/d/msgid/pylons-discuss/008829c9-1180-4365-9f69-d22d59a09ccd%40augusta.de
> >.
> >
> > --
> > 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
> > <mailto:pylons-discuss+unsubscr...@googlegroups.com>.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWDw%2BMWKioj5F_OBpeeBSNJAS3JAoU8DZmNsZ3hRX-x%3DAg%40mail.gmail.com
> <
> https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWDw%2BMWKioj5F_OBpeeBSNJAS3JAoU8DZmNsZ3hRX-x%3DAg%40mail.gmail.com?utm_medium=email_source=footer
> >.
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/971cf4de-7235-47af-a92e-5da154230b18%40augusta.de
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWBKBWA3VeLZZ6j1PjNj4zZnQjp0dHRqdQv1TgbA1tOJ2A%40mail.gmail.com.


[pylons-discuss] Re: HTTP 503 with Apache/mod_wsgi

2023-10-18 Thread Thierry Florac
I forgot to mention that I'm still using Pyramid 1.10.8, with various
Python versions from 3.5 to 3.11...

Best regards,
Thierry
-- 
  https://www.ulthar.net -- http://pyams.readthedocs.io


Le mer. 18 oct. 2023 à 08:44, Thierry Florac  a écrit :

> Hi!
> I have a problem with a Pyramid application which is deployed in
> production with Apache 2.4 and mod_wsgi behind an HAProxy cluster.
> On a "regular basis" and after some time of correct behaviour, I start to
> receive HTTP 503 errors (service unavailable), but without any clear error
> message.
>
> The application is using a ZODB and when looking at the logs, the only
> error I can find (but I'm not sure if it is really related) is a
> ConnectionStateError:
>
>   ZODB.POSException.ConnectionStateError: Shouldn't load state for
> pyams_security.utility.SecurityManager 0x18 when the connection is closed
>
> I'm using a custom security policy which relies on specific plug-ins; is
> there a rule which may prevent accessing the ZODB from the security policy?
>
> Moreover:
> - I never receive these errors when I'm in development mode, but only in
> production with Apache and mod_wsgi;
> - it *seems* that this error occurs more frequently when requests are done
> by robots and web crawlers!
> What could be the origin of the problem?
>
> Any advice would be greatly appreciated...
>
> Best regards,
> Thierry
> --
>   https://www.ulthar.net -- http://pyams.readthedocs.io
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWDHqJoKFxkcAWrcxtVcW4yK5tb%3DQELjZtPMWvmXtxHmEw%40mail.gmail.com.


[pylons-discuss] HTTP 503 with Apache/mod_wsgi

2023-10-18 Thread Thierry Florac
Hi!
I have a problem with a Pyramid application which is deployed in production
with Apache 2.4 and mod_wsgi behind an HAProxy cluster.
On a "regular basis" and after some time of correct behaviour, I start to
receive HTTP 503 errors (service unavailable), but without any clear error
message.

The application is using a ZODB and when looking at the logs, the only
error I can find (but I'm not sure if it is really related) is a
ConnectionStateError:

  ZODB.POSException.ConnectionStateError: Shouldn't load state for
pyams_security.utility.SecurityManager 0x18 when the connection is closed

I'm using a custom security policy which relies on specific plug-ins; is
there a rule which may prevent accessing the ZODB from the security policy?

Moreover:
- I never receive these errors when I'm in development mode, but only in
production with Apache and mod_wsgi;
- it *seems* that this error occurs more frequently when requests are done
by robots and web crawlers!
What could be the origin of the problem?

Any advice would be greatly appreciated...

Best regards,
Thierry
-- 
  https://www.ulthar.net -- http://pyams.readthedocs.io

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWBZU_GyhqML%2BxS8a7NOVpsAixGPqqqtqeHHbEi2s8rpvQ%40mail.gmail.com.


Re: [pylons-discuss] determinate if app object is the server or created from a console script

2023-10-14 Thread Thierry Florac
Maybe I'm wrong, but I think that you can get access to the "global"
registry settings without the need of getting a request, no?

Regards,
Thierry
-- 
  https://www.ulthar.net -- http://pyams.readthedocs.io


Le sam. 14 oct. 2023 à 11:14, Gerhard Schmidt  a écrit :

> The ApplicationCreated doesn't get a request object. So no luck there.
>
> Regards
>Estartu
>
> Am 13.10.23 um 20:32 schrieb Mike Orr:
> > Maybe there's a variable in the WSGI environment that a real server
> > sets but an emulating script doesn't, or has a value that can be
> > distinguished as "real". For instance, a real request will have the
> > user agent set to a long string of version numbers and
> > backward-compatibility identifiers, while an emulated request may not
> > bother setting it or may set it to something simple like "wsgi" or
> > "python".
> >
> > On Thu, Oct 12, 2023 at 10:00 PM Gerhard Schmidt 
> wrote:
> >>
> >> Hi there,
> >>
> >> I'm often running into the problem to determinate if the current app is
> >> running as a server to server http requests or created from a console
> >> script to do specific things.
> >>
> >> Mostly it's to decide if a background thread should be started (needed
> >> in the Server) or not (can cause problems in the console script) in the
> >> ApplicationCreated event.
> >>
> >> I'm using pyramid.paster.bootstrap to set up the app for a console
> script.
> >>
> >> The problem is, the ApplicationCreated is called before I have a chance
> >> to set anything in the registry to pass information along.
> >>
> >> I there a clean way know from the app object passed to the event alone.
> >> I tried to pass a custom Request to bootstrap but the request is not
> >> passed to this event.
> >>
> >> Regards
> >>   Estartu
> >>
> >>
> >>
> >>
> >>
> >> --
> >> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/008829c9-1180-4365-9f69-d22d59a09ccd%40augusta.de
> .
> >
> >
> >
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/1a530488-65ba-4e45-9f55-c5a88258d268%40augusta.de
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWBHrkNrLc-LhSx9prW%2BjAdhu2maS33bqZmzQWWyQ_ofXg%40mail.gmail.com.


Re: [pylons-discuss] determinate if app object is the server or created from a console script

2023-10-13 Thread Thierry Florac
Hi Gerhard,

Maybe it's not the best way to handle this, but I generally create custom
command-line scripts (using Buildout) and just check for sys.argv...

Best regards,
Thierry
-- 
  https://www.ulthar.net -- http://pyams.readthedocs.io


Le ven. 13 oct. 2023 à 07:00, Gerhard Schmidt  a écrit :

> Hi there,
>
> I'm often running into the problem to determinate if the current app is
> running as a server to server http requests or created from a console
> script to do specific things.
>
> Mostly it's to decide if a background thread should be started (needed
> in the Server) or not (can cause problems in the console script) in the
> ApplicationCreated event.
>
> I'm using pyramid.paster.bootstrap to set up the app for a console script.
>
> The problem is, the ApplicationCreated is called before I have a chance
> to set anything in the registry to pass information along.
>
> I there a clean way know from the app object passed to the event alone.
> I tried to pass a custom Request to bootstrap but the request is not
> passed to this event.
>
> Regards
>  Estartu
>
>
>
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/008829c9-1180-4365-9f69-d22d59a09ccd%40augusta.de
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWDw%2BMWKioj5F_OBpeeBSNJAS3JAoU8DZmNsZ3hRX-x%3DAg%40mail.gmail.com.


Re: [pylons-discuss] Hypatia alternative?

2022-04-19 Thread Thierry Florac
Done!

Best regards,
Thierry
-- 
  https://www.ulthar.net -- http://pyams.readthedocs.io


Le lun. 18 avr. 2022 à 19:15, Chris McDonough  a écrit :

> > All green now on hypatia master (delta travis, which I forget how to
> use, but it doesn't matter, local tests and coverage pass), thanks for the
> patch! I'll try to remember how to make a release tonight. :)
>
> Ah, sorry, one other thing, could you make a PR adding your name to
> CONTRIBUTORS.rst?
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/xY4VdJVqf4rybEd9Hjt-5tUwKVZ1KIEcxG6MtuLc2KUv-4ghWhyglBW7XYvZ4kdyWtzX3mklRkBrnbYHp-lE-aSXp4X0a10C1QdVWhb2lEE%3D%40plope.com
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWB9KD1bKNQ2fpFHEZ5ZeDHjkat-AkPqrB6qxaG9w3QDjQ%40mail.gmail.com.


Re: [pylons-discuss] Re: Waitress and multiprocess pooling

2022-05-16 Thread Thierry Florac
I personally use Apache with mod_wsgi, in multi-processes mode (from 1 to
16, based on vCPU count).
I know it's probably not the most "modern" option, but I know it, it works
pretty well and I didn't notice any problem (I use a PostgreSQL ZODB with
RelStorage and SQLAlchemy together).
I also used GUnicorn for a while, but only for async-based applications...

Best regards,
Thierry
-- 
  https://www.ulthar.net -- http://pyams.readthedocs.io


Le ven. 13 mai 2022 à 00:14, Jonathan Vanasco  a écrit :

> - 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 cause issues with your current codebase due
> to the characteristics of copy-on-write memory optimization.  Usually the
> issues I've seen are with database connections and random seed generators.
> Most of the libraries you are probably using will support correcting this
> with specific calls to make after the process forks.  If you're using
> SqlAlchemy, look at Engine.dispose() and most crypto libraries have an
> `atfork` function.
>
> I just wanted to put that on your radar now, so you can audit your code
> for this stuff if you decide to switch your deployment.
>
> On Thursday, May 12, 2022 at 4:46:55 PM UTC-4 mi...@redinnovation.com
> wrote:
>
>> Hi,
>>
>> I am running a Pyramid based website and now traffic is picking up. I
>> feel I might bump the problems of Waitress scalability soon. As far as I
>> understand, Waitress does not offer multiple process pooling modes, only
>> threading. This, combined with Python GIL, might cause problems if requests
>> start to be more and more CPU bound.
>>
>> - Am I correct and Waitress is limited by Python threading?
>>
>> - What's the recommended modern multiprocess enabled web server to do
>> more scaleable Pyramid hosting?
>>
>> Thank you,
>> Mikko
>>
>> Ps. Site is here, also we are hiring if anyone is looking for gigs or
>> jobs in Pyramid + SQLAlchemy:
>>
>> https://tradingstrategy.ai/
>>
>> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/20f1a129-1853-412b-a707-ebeb11db10e2n%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWA85Wxm%3D%3DTHSNa4HsnDr98rb%2B39JMpLcvmC73Bb0%3DkF6A%40mail.gmail.com.


[pylons-discuss] Hypatia alternative?

2022-04-17 Thread Thierry Florac
Hi,

I'm actually using the Hypatia package for content indexing and I'm very
happy with it, but this package doesn't seem to be updated for a very long
time (2 years since last commit).
Actually, my own packages unit tests are failing when using Python 3.10
with Hypatia, so I was wondering if it is actually used and maintained, or
is there any alternative ?

Best regards,
Thierry
-- 
  https://www.ulthar.net -- http://pyams.readthedocs.io

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWBOptsdANDDQZiZGEaXqVnWfv2Oa4aFty4YHD2%2BT-60_Q%40mail.gmail.com.


Re: [pylons-discuss] Hypatia alternative?

2022-04-17 Thread Thierry Florac
Hi Laurent,

I'm actually using Elasticsearch, with a custom integration package to
include it in my framework!
It works very well, but I'm also looking for a default alternative,
"internal" and lighter, as Hypatia does, which doesn't rely on an external
service to handle objects cataloging, and which is really sufficient to
handle indexing of small to medium websites...
Maybe I'll try to fork and make a merge request; Python 3.10 is not my
actual target actually but it will probably be an option in the near future!

Best regards,
Thierry
-- 
  https://www.ulthar.net -- http://pyams.readthedocs.io


Le dim. 17 avr. 2022 à 15:09, Laurent Daverio  a écrit :

> Hi Thierry,
>
> when I started using Pyramid (Pylons, actually), my first idea was to
> integrate the Xapian library, written in C++. Coming from the Zope
> world, I tried to adopt some ideas from the ZCatalog. Xapian worked
> great, except for one problem: it's a library, not a server, thus it
> doesn't handle concurrent updates gracefully (doesn't handle them at
> all, actually...).
>
> So, after a little while, I decided to switch to Solr, which is a
> great indexing engine written in Java. It takes a little while to get
> familiar with it, but it's worth the effort. I used `scorched` for
> interfacing with Python. Please note that the PyPI release doesn't
> work with Python 3.10, but the Github version does. Scorched doesn't
> seem to be actively maintained, unfortunately, but it works fine. I'm
> aware that ElasticSearch might be more popular than Solr these days
> (they're both based on the ame Apache Lucene libraries), but I haven't
> had the motivation to try it out.
>
> I you're looking for a pure Python solution, Whoosh could be a choice,
> but it doesn't seem to be actively maintained either. At some point, I
> tried to integrate it with Pyramid, but I didn't have enough
> motivation to finalise it (I'm happy with Solr, it's superfast, and if
> you're doing frontend programming, you can process its JSON responses
> directly).
>
> Please note that both Solr/ElasticSearch and Woosh offer faceting, a
> feature missing from the ZCatalog.
>
> Hope this helps,
>
> Laurent.
>
> Le dim. 17 avr. 2022 à 13:14, Thierry Florac  a écrit :
> >
> > Hi,
> >
> > I'm actually using the Hypatia package for content indexing and I'm very
> happy with it, but this package doesn't seem to be updated for a very long
> time (2 years since last commit).
> > Actually, my own packages unit tests are failing when using Python 3.10
> with Hypatia, so I was wondering if it is actually used and maintained, or
> is there any alternative ?
> >
> > Best regards,
> > Thierry
> > --
> >   https://www.ulthar.net -- http://pyams.readthedocs.io
> >
> > --
> > 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWBOptsdANDDQZiZGEaXqVnWfv2Oa4aFty4YHD2%2BT-60_Q%40mail.gmail.com
> .
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/CAB7cU6xX51RLsgetgTbWsgzJfzHaF_t0RcZVi2cPWVOTi0tEtQ%40mail.gmail.com
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWDcwOnubxoVA0ga6hGn9VFRT-z3eJ%2BWtqdq16r7RLBndQ%40mail.gmail.com.


Re: [pylons-discuss] Hypatia alternative?

2022-04-17 Thread Thierry Florac
Hi Steve,
I'm aware of these packages, for using Zope for many years!
But Hypatia was providing some improvements (as far as I can estimate) over
these packages, and was perfectly accorded to my own needs...
Am I the only one using this package?
Could it be possible to maintain this package and provide patches (just for
last Python versions actually)?
Best regards,
Thierry
-- 
  https://www.ulthar.net -- http://pyams.readthedocs.io


Le dim. 17 avr. 2022 à 14:21, Steve Piercy  a
écrit :

> Reading:
>
> https://hypatia.readthedocs.io/en/latest/genealogy.html
>
> Unfortunately, this ex-package appears to be pushing up the daisies, if it
> wasn't nailed to the perch.
>
> You could also check out these two packages, which appear to be actively
> developed:
>
> https://github.com/zopefoundation/zope.index
>
> https://github.com/zopefoundation/zope.catalog
>
> I would suggest asking whether there is any successor in Plone and Zope
> community (now that Plone absorbed Zope).
>
> https://community.plone.org/
>
> --steve
>
>
> On 4/17/22 4:14 AM, Thierry Florac wrote:
> > Hi,
> >
> > I'm actually using the Hypatia package for content indexing and I'm very
> happy with it, but this package doesn't seem to be updated for a very long
> time (2 years since last commit).
> > Actually, my own packages unit tests are failing when using Python 3.10
> with Hypatia, so I was wondering if it is actually used and maintained, or
> is there any alternative ?
> >
> > Best regards,
> > Thierry
> > --
> > https://www.ulthar.net <https://www.ulthar.net> --
> http://pyams.readthedocs.io <http://pyams.readthedocs.io>
> >
> > --
> > 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  pylons-discuss+unsubscr...@googlegroups.com>.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWBOptsdANDDQZiZGEaXqVnWfv2Oa4aFty4YHD2%2BT-60_Q%40mail.gmail.com
> <
> https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWBOptsdANDDQZiZGEaXqVnWfv2Oa4aFty4YHD2%2BT-60_Q%40mail.gmail.com?utm_medium=email_source=footer
> >.
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/01e6ac12-58b1-2ca6-338a-2e9276e2db2d%40gmail.com
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWCmd_aCWaQrEXi5bSFvhH0D%2Bf%3DhrJ2sqUc%3DUqXGHZm4iw%40mail.gmail.com.


Re: [pylons-discuss] Hypatia alternative?

2022-04-18 Thread Thierry Florac
Hi Chris,
That would be very nice!  :)
Actually, my own CI tests are passing on Python 3.10 when using PURE_PYTHON
environment variable; the problem seems to be in the Okapi scoring
extension. I'll try to have a look at this but I'm not used to working on
Python C extension...
Best regards,
Thierry
-- 
  https://www.ulthar.net -- http://pyams.readthedocs.io


Le lun. 18 avr. 2022 à 03:15, Chris McDonough  a écrit :

> I would likely be able to review any patches made to Hypatia
>
> --- Original Message ---
> On Sunday, April 17th, 2022 at 11:11 AM, Thierry Florac 
> wrote:
>
> Hi Laurent,
>
> I'm actually using Elasticsearch, with a custom integration package to
> include it in my framework!
> It works very well, but I'm also looking for a default alternative,
> "internal" and lighter, as Hypatia does, which doesn't rely on an external
> service to handle objects cataloging, and which is really sufficient to
> handle indexing of small to medium websites...
> Maybe I'll try to fork and make a merge request; Python 3.10 is not my
> actual target actually but it will probably be an option in the near future!
>
> Best regards,
> Thierry
> --
> https://www.ulthar.net -- http://pyams.readthedocs.io
>
>
> Le dim. 17 avr. 2022 à 15:09, Laurent Daverio  a
> écrit :
>
>> Hi Thierry,
>>
>> when I started using Pyramid (Pylons, actually), my first idea was to
>> integrate the Xapian library, written in C++. Coming from the Zope
>> world, I tried to adopt some ideas from the ZCatalog. Xapian worked
>> great, except for one problem: it's a library, not a server, thus it
>> doesn't handle concurrent updates gracefully (doesn't handle them at
>> all, actually...).
>>
>> So, after a little while, I decided to switch to Solr, which is a
>> great indexing engine written in Java. It takes a little while to get
>> familiar with it, but it's worth the effort. I used `scorched` for
>> interfacing with Python. Please note that the PyPI release doesn't
>> work with Python 3.10, but the Github version does. Scorched doesn't
>> seem to be actively maintained, unfortunately, but it works fine. I'm
>> aware that ElasticSearch might be more popular than Solr these days
>> (they're both based on the ame Apache Lucene libraries), but I haven't
>> had the motivation to try it out.
>>
>> I you're looking for a pure Python solution, Whoosh could be a choice,
>> but it doesn't seem to be actively maintained either. At some point, I
>> tried to integrate it with Pyramid, but I didn't have enough
>> motivation to finalise it (I'm happy with Solr, it's superfast, and if
>> you're doing frontend programming, you can process its JSON responses
>> directly).
>>
>> Please note that both Solr/ElasticSearch and Woosh offer faceting, a
>> feature missing from the ZCatalog.
>>
>> Hope this helps,
>>
>> Laurent.
>>
>> Le dim. 17 avr. 2022 à 13:14, Thierry Florac  a écrit
>> :
>> >
>> > Hi,
>> >
>> > I'm actually using the Hypatia package for content indexing and I'm
>> very happy with it, but this package doesn't seem to be updated for a very
>> long time (2 years since last commit).
>> > Actually, my own packages unit tests are failing when using Python 3.10
>> with Hypatia, so I was wondering if it is actually used and maintained, or
>> is there any alternative ?
>> >
>> > Best regards,
>> > Thierry
>> > --
>> > https://www.ulthar.net -- http://pyams.readthedocs.io
>> >
>> > --
>> > 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWBOptsdANDDQZiZGEaXqVnWfv2Oa4aFty4YHD2%2BT-60_Q%40mail.gmail.com
>> .
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/pylons-discuss/CAB7cU6xX51RLsgetgTbWsgzJfzHaF_t0RcZVi2cPWVOTi0tEtQ%40mail.gmail.com
>> .
>>
> --
> 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,

Re: [pylons-discuss] Hypatia alternative?

2022-04-18 Thread Thierry Florac
I have created a patch and a pull request...
If it's OK and if you could create a new release that would be very nice
!!  :)

Best regards,
Thierry
-- 
  https://www.ulthar.net -- http://pyams.readthedocs.io


Le lun. 18 avr. 2022 à 10:40, Chris McDonough  a écrit :

> Fwiw that extension was stolen from zope.catalog, it's probably fixed
> there.
>
>
>
>
>
>
>  Original Message 
> On Apr 18, 2022, 3:56 AM, Thierry Florac < tflo...@gmail.com> wrote:
>
>
> Hi Chris,
> That would be very nice!  :)
> Actually, my own CI tests are passing on Python 3.10 when using
> PURE_PYTHON environment variable; the problem seems to be in the Okapi
> scoring extension. I'll try to have a look at this but I'm not used to
> working on Python C extension...
> Best regards,
> Thierry
> --
>   https://www.ulthar.net -- http://pyams.readthedocs.io
>
>
> Le lun. 18 avr. 2022 à 03:15, Chris McDonough  a écrit :
>
>> I would likely be able to review any patches made to Hypatia
>>
>> --- Original Message ---
>> On Sunday, April 17th, 2022 at 11:11 AM, Thierry Florac <
>> tflo...@gmail.com> wrote:
>>
>> Hi Laurent,
>>
>> I'm actually using Elasticsearch, with a custom integration package to
>> include it in my framework!
>> It works very well, but I'm also looking for a default alternative,
>> "internal" and lighter, as Hypatia does, which doesn't rely on an external
>> service to handle objects cataloging, and which is really sufficient to
>> handle indexing of small to medium websites...
>> Maybe I'll try to fork and make a merge request; Python 3.10 is not my
>> actual target actually but it will probably be an option in the near future!
>>
>> Best regards,
>> Thierry
>> --
>> https://www.ulthar.net -- http://pyams.readthedocs.io
>>
>>
>> Le dim. 17 avr. 2022 à 15:09, Laurent Daverio  a
>> écrit :
>>
>>> Hi Thierry,
>>>
>>> when I started using Pyramid (Pylons, actually), my first idea was to
>>> integrate the Xapian library, written in C++. Coming from the Zope
>>> world, I tried to adopt some ideas from the ZCatalog. Xapian worked
>>> great, except for one problem: it's a library, not a server, thus it
>>> doesn't handle concurrent updates gracefully (doesn't handle them at
>>> all, actually...).
>>>
>>> So, after a little while, I decided to switch to Solr, which is a
>>> great indexing engine written in Java. It takes a little while to get
>>> familiar with it, but it's worth the effort. I used `scorched` for
>>> interfacing with Python. Please note that the PyPI release doesn't
>>> work with Python 3.10, but the Github version does. Scorched doesn't
>>> seem to be actively maintained, unfortunately, but it works fine. I'm
>>> aware that ElasticSearch might be more popular than Solr these days
>>> (they're both based on the ame Apache Lucene libraries), but I haven't
>>> had the motivation to try it out.
>>>
>>> I you're looking for a pure Python solution, Whoosh could be a choice,
>>> but it doesn't seem to be actively maintained either. At some point, I
>>> tried to integrate it with Pyramid, but I didn't have enough
>>> motivation to finalise it (I'm happy with Solr, it's superfast, and if
>>> you're doing frontend programming, you can process its JSON responses
>>> directly).
>>>
>>> Please note that both Solr/ElasticSearch and Woosh offer faceting, a
>>> feature missing from the ZCatalog.
>>>
>>> Hope this helps,
>>>
>>> Laurent.
>>>
>>> Le dim. 17 avr. 2022 à 13:14, Thierry Florac  a
>>> écrit :
>>> >
>>> > Hi,
>>> >
>>> > I'm actually using the Hypatia package for content indexing and I'm
>>> very happy with it, but this package doesn't seem to be updated for a very
>>> long time (2 years since last commit).
>>> > Actually, my own packages unit tests are failing when using Python
>>> 3.10 with Hypatia, so I was wondering if it is actually used and
>>> maintained, or is there any alternative ?
>>> >
>>> > Best regards,
>>> > Thierry
>>> > --
>>> > https://www.ulthar.net -- http://pyams.readthedocs.io
>>> >
>>> > --
>>> > 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 e

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

2022-12-23 Thread Thierry Florac
Hi Peter!

I'm not sure to have time to test before next year!  :/
Can you just specify the "format" you use to store geometries?
Maybe it's documented in your package but I didn't have any time to check
for it...

Thierry
-- 
  https://www.ulthar.net -- http://pyams.readthedocs.io


Le jeu. 22 déc. 2022 à 11:13, Peter Wilkinson  a
écrit :

>
>
> On 22 Dec 2022, at 6:44 pm, Thierry Florac  wrote:
>
> My main usage are probably :
>  - to find objects which are located below a given distance from a
> reference points
>  - to find objects which are contained into a given geometry or
> overlapping it.
>
> I generally use PostGIS or Elasticsearch to handle these queries, but in
> some contexts it could be useful to mix these queries with other attributes
> queries directly from the catalog…
>
>
> Hi Thierry,
>
> I’m in a similar position and really don’t want to carry around the
> complexity of PostGIS installs and syncing data between two systems. I’ve
> been able to get sub ms results when searching for a point in 300,000+
> polygons from the all country admin region dataset at
> https://gadm.org/download_world.html - that is plenty fast enough for my
> needs...
>
> At the moment there is code in a fork installable via:
>
> pip install 'git+
> https://github.com/pfw/hypatia.git@spatial-index#egg=hypatia[spatial]'
>
> Which so far passes all my tests.
>
> It exposes intersects as a Comparator so you can do things like:
>
> from shapely import box
> spatialindex.intersects(box(151.20699218799413, -33.864564753236095,
> 151.20729952635648, -33.86439938579896)).execute().all()
>
> Or combine as you would normally via:
>
> (spatialindex.intersects(box(151.20699218799413, -33.864564753236095,
> 151.20729952635648, -33.86439938579896)) &
> otherindex.eq(263)).execute().all()
>
> It does support other predicates than ‘intersects’ but doesn’t expose them
> as Comparators yet - that will come shortly - have a look at test_belgium.
>
> The underlying data structure can support a KNN query for finding ’nearest
> to x’ and I’ll add that as well.
>
> It would be great to hear if the current state works for your needs and
> once the few extra bits are there I’ll clean it up for a PR on the main
> repo.
>
> Peter W.
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/5EFF8574-F3EF-4DCA-A1DD-FBC95CFBD438%40thirdfloor.com.au
> <https://groups.google.com/d/msgid/pylons-discuss/5EFF8574-F3EF-4DCA-A1DD-FBC95CFBD438%40thirdfloor.com.au?utm_medium=email_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWBhMjaER2%3DTgUOEzG1fCv%2BO_aKdSJM7t2XPyWQ6ONLjeA%40mail.gmail.com.


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

2022-12-21 Thread Thierry Florac
Hi Peter,

I'm also using Hypatia for several years now without any problem, it works
very well!
So this "alpha" notice is probably useless!

I'm also interested in using spatial indexes in Hypatia, so I'm quite
excited to use your indexes.
And if you need any help to test these features, just ask!  ;)

Best regards,
Thierry
-- 
  https://www.ulthar.net -- http://pyams.readthedocs.io


Le mar. 20 déc. 2022 à 23:26, Peter Wilkinson  a
écrit :

>
>
> On 20 Dec 2022, at 7:38 am, Bert JW Regeer  wrote:
>
> I’m happy to review such a PR.
>
>
> I’ve put a PR at https://github.com/Pylons/hypatia/pull/16 which is a
> relatively small first step to start bringing things inline with Pyramid -
> I’d like to add listing and formatting as well as remove all of the Python
> 2 compatibility code but that can wait.
>
> I’d also like to remove the ‘alpha’ notice in README.rst - what is there
> works very well as it is and from my own experience the ‘alpha’ put me off
> at the start, although I think the audience is probably limited I don’t
> think anyone should be afraid to use Hypatia.
>
> Peter W.
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/A3B67487-5489-4D15-ACFD-80F0759A41C1%40thirdfloor.com.au
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWAjV6f4LG%3D2D43TZuf8NtRNXNPe74a5-6GCeV-u2o-_uQ%40mail.gmail.com.


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

2022-12-21 Thread Thierry Florac
Hi Peter,

My main usage are probably :
 - to find objects which are located below a given distance from a
reference points
 - to find objects which are contained into a given geometry or overlapping
it.

I generally use PostGIS or Elasticsearch to handle these queries, but in
some contexts it could be useful to mix these queries with other attributes
queries directly from the catalog...

Thierry
-- 
  https://www.ulthar.net -- http://pyams.readthedocs.io


Le mer. 21 déc. 2022 à 23:32, Peter Wilkinson  a
écrit :

>
>
> On 21 Dec 2022, at 7:21 pm, Thierry Florac  wrote:
>
> I'm also interested in using spatial indexes in Hypatia, so I'm quite
> excited to use your indexes.
> And if you need any help to test these features, just ask!  ;)
>
>
> Hi Thierry,
>
> Out of interest, what spatial searches are you looking to use? I’ve got
> straight up intersection on exact geometries (Polygon, MultiPolygon,
> Points) working and it’s pretty straightforward to support additional
> predicates, eg. Contains, touches etc. but rather than just dump all in I’d
> like to get actual use cases that I can write tests for as well.
>
> Peter W.
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/CE37D3F7-C7F3-4ACD-80FB-CD3C8EC9BE94%40thirdfloor.com.au
> <https://groups.google.com/d/msgid/pylons-discuss/CE37D3F7-C7F3-4ACD-80FB-CD3C8EC9BE94%40thirdfloor.com.au?utm_medium=email_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWDE9z-pmoLZMoXdLqzkLpvui0ZxfVfyP6QYFdMhmnZHYA%40mail.gmail.com.


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

2023-06-06 Thread Thierry Florac
Hi!
I'm working on a Pyramid application using ZODB and RelStorage to store
Python objects into a PostgreSQL database.
This application is a document management application using many file blobs
which are stored on the filesystem (not in PostgreSQL), and a catalog is
used to index documents metadatas. The application is running in an Apache
process using mod_wsgi.
My question is that we have another application which is used to transfer
documents from another repository to this one; this application is only
using one process and one thread to avoid ZODB conflicts on catalog
updates; when the application is started, we handle approximately 120
transactions/minute and everything is OK but after 50 to 60 minutes,
transactions rate is highly decreasing down to 30 tpm!
While looking at server processes, it seems that most activity is related
to PostgreSQL; I tried to disable autovacuum but it doesn't change
anything! If I reload Apache service, the transaction rate is restarting at
120 tpm before decreasing after another hour of high activity...
So, does anyone have any idea about the origin of this increase in
PostgreSQL activity and performance decrease?

Best regards,
Thierry
-- 
  https://www.ulthar.net -- http://pyams.readthedocs.io

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWCNmjC6xvkRT8RnfHENEnP9KW2S3F5Eqc0BCt5M6y4ouA%40mail.gmail.com.


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

2023-06-06 Thread Thierry Florac
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Hi Julien,
The server is an SSD-based Hyper-V virtual machine running Debian GNU/Linux
with Python 3.9.2 and PostgreSQL 13.
We have 32 GB of RAM and only 4 are used so there is no swapping and there
is no I/O wait while looking at "top".
There is no other application running on this server, and no other
connected users while loading documents.
I tried to look at pg_stat_activity but didn't found any useful
information...

Thierry

- --
- --
  https://www.ulthar.net -- http://pyams.readthedocs.io

On 2023-06-06 at 07:24, jul...@perdition.city wrote:
> On Tue, Jun 06, 2023 at 09:17:18AM +0200, Thierry Florac wrote:
> > Hi!
>
> Hello,
>
> > I'm working on a Pyramid application using ZODB and RelStorage to store
> > Python objects into a PostgreSQL database.
> > This application is a document management application using many file
blobs
> > which are stored on the filesystem (not in PostgreSQL), and a catalog
is
> > used to index documents metadatas. The application is running in an
Apache
> > process using mod_wsgi.
> > My question is that we have another application which is used to
transfer
> > documents from another repository to this one; this application is only
> > using one process and one thread to avoid ZODB conflicts on catalog
> > updates; when the application is started, we handle approximately 120
> > transactions/minute and everything is OK but after 50 to 60 minutes,
> > transactions rate is highly decreasing down to 30 tpm!
> > While looking at server processes, it seems that most activity is
related
> > to PostgreSQL; I tried to disable autovacuum but it doesn't change
> > anything! If I reload Apache service, the transaction rate is
restarting at
> > 120 tpm before decreasing after another hour of high activity...
> > So, does anyone have any idea about the origin of this increase in
> > PostgreSQL activity and performance decrease?
> >
>
> Hard to say, is it I/O bound? CPU bound? Did you check pg_stat_activity?
> Do you log slow queries? What's your server / postgresql configuration?
>
> > Best regards,
> > Thierry
> > --
> >   https://www.ulthar.net -- http://pyams.readthedocs.io
> >
> > --
> > 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 view this discussion on the web visit
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWCNmjC6xvkRT8RnfHENEnP9KW2S3F5Eqc0BCt5M6y4ouA%40mail.gmail.com.

>
> --
> Julien Cigar
> Belgian Biodiversity Platform (http://www.biodiversity.be)
> PGP fingerprint: EEF9 F697 4B68 D275 7B11  6A25 B2BB 3710 A204 23C0
> No trees were killed in the creation of this message.
> However, many electrons were terribly inconvenienced.
>
> --
> 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 view this discussion on the web visit
https://groups.google.com/d/msgid/pylons-discuss/gu7jtudne4gcfbfg2tnoyat2lgjawj46yfaqejw3v3cx3eyieg%40kizwmzrppuox.
-BEGIN PGP SIGNATURE-
Version: FlowCrypt Email Encryption 8.4.7
Comment: Seamlessly send and receive encrypted email

wsBzBAEBCAAnBYJkfuaICZAeEMoZ8dg1JhYhBFGZiY9tHFonIsnSNh4Qyhnx
2DUmAABM4Af/XpkJXxLXwJxcXH+AWSC/4iXu64JRqOPQ5zcezr2ycd7YI9tk
J557Y9cxbnK1v4S90FqLS0Z1lgwAmtzEiGOQ/f9ulW2Suimiw1hieAR+tvkV
0X4pooziZwi6vavu+ObnK+rOVYC8mPkowdn4wbn5R7ROZF5Mle3PkrtdSUc3
HHh1jOiwU3r5hMfIHLB6cEUUqnLAD0wZbZUaWm1eo6urdG+N6AAfue8obQdM
neyBUfhHCPfYxcUMwaggsGH/AmP7iLofFQJkjWhXwgNKbsg5mZj1OTVDdaMZ
XHHpCFkBfQrZaG5WwuK838qCuMTc8irqJXxYF2IFZ+iIFhMS3oLeIQ==
=u64S
-END PGP SIGNATURE-

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWBpyL%2BHSQ9QhJ4dWd1%3Do1YA8vBwLnF_RuHiwH-EqBiOkw%40mail.gmail.com.


0x1E10CA19F1D83526.asc
Description: application/pgp-keys


Re: [pylons-discuss] ZODB debugging

2024-02-11 Thread Thierry Florac
I forgot to give you a link: https://gitlab.com/pyams/pyams-zodb-browser

Any feedback is greatly welcome!  ;)

Best regards,
Thierry
-- 
  https://www.ulthar.net -- http://pyams.readthedocs.io


Le dim. 11 févr. 2024 à 16:12, Thierry Florac  a écrit :

> Hi Adam,
>
> I have built a full web framework called PyAMS which is based on Pyramid
> and ZODB, and which is including a ZODB browser package.
> But it is actually lacking documentation, and including a complete
> framework is probably not what you are looking for just to debug an app!  :/
>
> Best regards,
> Thierry
> --
>   https://www.ulthar.net -- http://pyams.readthedocs.io
>
>
> Le dim. 11 févr. 2024 à 11:53, Adam Groszer  a écrit :
>
>> Hi,
>>
>> What are my best chances to debug a pyramid app using ZODB?
>> I'm looking for something like zodbbrowser for ZTK is, but for pyramid.
>>
>> thanks
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/pylons-discuss/9f7835b1-911c-485c-a4cf-d53ac3b629b5n%40googlegroups.com
>> <https://groups.google.com/d/msgid/pylons-discuss/9f7835b1-911c-485c-a4cf-d53ac3b629b5n%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWDH-jmJG7hxx%2B0w_PgJhKa%3DA8xyykv6RwbGuKej1V9DDg%40mail.gmail.com.


Re: [pylons-discuss] ZODB debugging

2024-02-11 Thread Thierry Florac
Hi Adam,

I have built a full web framework called PyAMS which is based on Pyramid
and ZODB, and which is including a ZODB browser package.
But it is actually lacking documentation, and including a complete
framework is probably not what you are looking for just to debug an app!  :/

Best regards,
Thierry
-- 
  https://www.ulthar.net -- http://pyams.readthedocs.io


Le dim. 11 févr. 2024 à 11:53, Adam Groszer  a écrit :

> Hi,
>
> What are my best chances to debug a pyramid app using ZODB?
> I'm looking for something like zodbbrowser for ZTK is, but for pyramid.
>
> thanks
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/9f7835b1-911c-485c-a4cf-d53ac3b629b5n%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWDcNYPTUFAd95z66W-C7kNWxn4cwTXTh9fHXB8Lcvi6UA%40mail.gmail.com.


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

2023-11-15 Thread Thierry Florac
Hi,
My problem is probably quite simple: I would like to be able, in a Pyramid
application, to create a custom security policy which could use an SSL
client certificate as a request credential to handle authentication
(authorized certificates being referenced in a database or stored in a
specific server directory).
This application is then supposed to be published via mod_wsgi in an Apache
server located behind an HAProxy.
I tried to search here and there but didn't find any information about
this...
Any hint?

Best regards,
Thierry
-- 
  https://www.ulthar.net -- http://pyams.readthedocs.io

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWBosR7p%3DLb%2BzEXWKuwuuENy6CORPrVpHaRMU9qWV4uW4g%40mail.gmail.com.


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

2023-11-15 Thread Thierry Florac
Hi Theron,

I'm not sure of the exact naming of this!
The common idea behind it is just to use an SSL client certificate as a
credential to authenticate an incoming request; this is generally used to
authenticate a remote application more than a common user...

Regards,
Thierry
-- 
  https://www.ulthar.net -- http://pyams.readthedocs.io


Le mer. 15 nov. 2023 à 18:43, Theron Luhn  a écrit :

> I’m unsure what this “request credential” is.  Are you talking about TLS
> Mutual Auth?
>
> — Theron
>
>
>
> On Nov 15, 2023, at 6:13 AM, Thierry Florac  wrote:
>
> Hi,
> My problem is probably quite simple: I would like to be able, in a Pyramid
> application, to create a custom security policy which could use an SSL
> client certificate as a request credential to handle authentication
> (authorized certificates being referenced in a database or stored in a
> specific server directory).
> This application is then supposed to be published via mod_wsgi in an
> Apache server located behind an HAProxy.
> I tried to search here and there but didn't find any information about
> this...
> Any hint?
>
> Best regards,
> Thierry
> --
>   https://www.ulthar.net -- http://pyams.readthedocs.io
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWBosR7p%3DLb%2BzEXWKuwuuENy6CORPrVpHaRMU9qWV4uW4g%40mail.gmail.com
> <https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWBosR7p%3DLb%2BzEXWKuwuuENy6CORPrVpHaRMU9qWV4uW4g%40mail.gmail.com?utm_medium=email_source=footer>
> .
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/57B4950A-F6F9-432B-81C8-81566502F94C%40luhn.com
> <https://groups.google.com/d/msgid/pylons-discuss/57B4950A-F6F9-432B-81C8-81566502F94C%40luhn.com?utm_medium=email_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWD9vFNoJ1tqUs3_PoP7AB6P%3D6cDiawLQ66FYy2NJR-fSA%40mail.gmail.com.


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

2024-03-23 Thread Thierry Florac
Hi Aaron,
Could you explain what is not working when you use Pyramid static views to
handle videos or audios files?

Best regards,
Thierry

Le sam. 23 mars 2024 à 21:08, Aaron Krister Johnson  a
écrit :

> Hi all,
>
> I have a pyramid app on Dreamhost, and they are reverting from using
> Ruby's passenger back to fcgi fro shared hosting accounts. The server runs
> Apache, and I have control of .htaccess configuration.
>
> At the moment, I am able to serve static files by using
> `config.add_static_view`, but it does not appear to be working for things
> like videos hosted on site (.mp4) nor audio (.ogg).
>
> I thought to bypass `add_static_view` and have Apache serve static assets
> itself, but it's brought no joy, since apparently, my setup doesn't allow
> `Alias` directives, and the `RewriteCond` for files doesn't play well with
> Pyramid's layout, with or without `add_static_view`. The basic site seems
> to work better when I use Pyramid to serve, but like I said, video and
> audio files are blocked somehow. How do I serve .mp4 and .ogg? Do I have to
> get into declaring things iwth the `mimetypes` lib?
>
> Here's my .htaccess, for reference:
>
> $ cat .htaccess
> #Disables GZIP
> SetEnv no-gzip 1
>
> #Turns off the expires headers for Apache
> 
>   ExpiresActive Off
> 
>
> # DISABLE CACHING
> 
>   Header set Cache-Control "no-cache, no-store, must-revalidate"
>   Header set Pragma "no-cache"
>   Header set Expires 0
>   Header always set Content-Security-Policy "upgrade-insecure-requests;"
> 
>
> Options +ExecCGI
> AddHandler fcgid-script .fcgi
> SetHandler fcgid-script
> RewriteEngine On
> RewriteBase /
> RewriteCond %{HTTPS} !=on
> RewriteRule ^(.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteRule ^(.*)$ dispatch.fcgi/$1 [QSA,L]
>
> And here is my `dispatch.fcgi`:
>
> #!/home/untwelve_admin/untwelve.dreamhosters.com/bin/python3.12
>
> import sys
>
> from paste.deploy import loadapp
> from flup.server.fcgi_fork import WSGIServer
>
> sys.path.append("UnTwelveDotOrg")
>
> app = loadapp(
> "config:/home/untwelve_admin/
> untwelve.dreamhosters.com/UnTwelveDotOrg/development.ini"
> )
>
> if __name__ == "__main__":
> WSGIServer(app).run()
>
>
> Thanks for any insights you can provide!
>
> Best,
> Aaron
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/2df33b45-96b9-4812-9eed-72f58861af12n%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWC%3DHi6uqgpX3gOQh%3Dyd5Wwm8kLnUhWe0%2B7Jqnv3uJUfWA%40mail.gmail.com.