SQLAlchemy and ZopeTransactionExtension

2012-11-30 Thread Vlad K.
Hello list, I've just noticed in the SQLAlchemy docs that the `extension` parameter passed to session is being deprecated in favor of session events, however the Pyramid alchemy scaffold is still passing ZopeTransactionExtension as `extension` to the sessionmaker (and in turn to the

Pyramid 1.4: Route predicate mismatch and response codes

2012-11-17 Thread Vlad K.
I'm not sure if this is currently a bug because of missing implementation or something, or I'm missing some configuration. Basically, when a route is matched by URL pattern but fails other predicates like request_method or accept, it should respond with 405 and 406 (for those two), not with

Custom content type for json renderer

2012-11-10 Thread Vlad K.
Hello list, I'm trying to use the built-in json renderer to produce a json formatted response, but if I set the response content type to anything else, despite of explicitly naming the renderer via view_config, the response body is empty: @view_config(route_name=test, request_method=POST,

Re: Custom content type for json renderer

2012-11-10 Thread Vlad K.
My bad for failing to mention that this is Pyramid 1.4a3. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to

Re: Logging, again...

2012-09-17 Thread Vlad K.
On 09/16/2012 07:46 AM, Marius Gedminas wrote: Yeah, sounds like you hit this: http://mg.pov.lt/blog/logging-fileconfig-gotcha.html Yes, that's it. My google-fu must have failed me. :) Thanks a lot, that fixed my problem! -- .oO V Oo. Work Hard, Increase Production, Prevent Accidents,

Logging, again... (repost)

2012-09-12 Thread Vlad K.
Hi all, I'm resending this, the first time I sent it didn't reach the list. I'm having a bit of an issue with logging. I did this (a trick I picked up from a site to enable logging under uwsgi): __init__.py def main(global_config, **settings): Main

pyramid_rpc chaining decorators

2012-08-07 Thread Vlad K.
Hi all, I have a JSON RPC API as a set of methods which all have some common processing involved, esp. regarding exceptions. To catch those and in turn raise proper JsonRpcError, with proper code and message, I wanted to wrap the methods in a common decorator. @common_rpc

Pyramid paste/logging/uwsgi problem...

2012-07-13 Thread Vlad K.
I think this is getting old Please, how do I run a Pyramid 1.3 app, full with logging as specified in the .ini file, under uWSGI. Thanks. -- .oO V Oo. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send

pyramid_rpc stale on PyPi

2012-07-11 Thread Vlad K.
Hi. Any reason why pyramid_rpc is months old on Pypi? -- .oO V Oo. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to

Re: pyramid_rpc stale on PyPi

2012-07-11 Thread Vlad K.
On 07/11/2012 11:24 PM, Michael Merickel wrote: Sure, because it's not ready for another release. There's only some minor improvements atm, the big thing pending for release is python 3 compatibility (which is a pain because of pyamf). Okay, I see, thanks. -- .oO V Oo. -- You received this

AuthPolicy order of business

2012-06-29 Thread Vlad K.
Hi all. I am not quite sure from the docs, nor quickly looking at the source, what is the order of business with the IAuthenticationPolicy interfaced objects. There are two separate but tightly integrated methods: (un)authenticated_userid() and effective_principals() which per CallbackAuth

Re: AuthPolicy order of business

2012-06-29 Thread Vlad K.
The cookbook. I keep missing that little gem every. Single. Time. Thanks! ;) On 06/29/2012 06:30 PM, Michael Merickel wrote: The cookbook illustrates a way to cache this information inside of `request.user`. The idea is that authenticated_userid and effective_principals both use

Re: Compiling Python

2012-06-13 Thread Vlad K.
On 06/13/2012 03:21 PM, Chris McDonough wrote: On 06/12/2012 06:36 PM, Wade Leftwich wrote: With the Pyramid docs in ebook form on my phone I tend to browse them at odd times. Today, standing in line at the post office, I stopped at this paragraph right near the beginning: It’s useful to use a

Re: Pylons/Pyramid Performance

2012-06-06 Thread Vlad K.
On 06/06/2012 07:49 AM, Andi wrote: just a benchmark, but better than nothing. found that during our research. http://blog.curiasolutions.com/the-great-web-framework-shootout/ andi (sent right out of my head) The Curiasolutions shootout is interesting. However, even for a synthetic

Re: Database access pattern

2012-06-06 Thread Vlad K.
On 06/06/2012 09:50 AM, tanshu wrote: Hi, I am sorry if this has been asked before, but I couldn't find the answer anywhere. I am relatively new to python / pyramid and have developed a few test programs. I come from a C# background and could not figure out what the best pattern is to lay

Re: Database access pattern

2012-06-06 Thread Vlad K.
On 06/06/2012 09:18 PM, Mike Orr wrote: I generally put business logic in the model, but I may have a different notion of business logic than Tanshu does. To me, business logic is any calculations that are specific to the model but are *independent* of the UI and HTML. So form validators belong

Re: Performance monitoring

2012-05-28 Thread Vlad K.
On 05/28/2012 08:44 AM, Ergo wrote: Hi, You can use errormator wsgi client, that allows you to use free https://errormator.com service. It will show you slow requests/slow sqlalchemy queries within your app, you would need to tweak the client to show you requests below 1s (that's min

Re: Performance monitoring

2012-05-28 Thread Vlad K.
On 05/27/2012 10:30 PM, bard stéphane wrote: you could be interested by this small pyramid tween pyramid_perfstat https://bitbucket.org/tuck/pyramid_perfstat also available in pypi http://pypi.python.org/pypi/pyramid_perfstat easy to use and maybe more pyramid aware. It logs average in

Performance monitoring

2012-05-25 Thread Vlad K.
I'm interested in visualizing some performance metrics of my Pyramid app. 1. Average, min and max response time per route group (eg. interface views vs API calls) 2. Optimal threads per process ratio 3. Backlog size I'm using uwsgi. I've found this:

Re: Performance monitoring

2012-05-25 Thread Vlad K.
On 05/25/2012 02:19 PM, Roberto De Ioris wrote: This is a far better approach: http://projects.unbit.it/uwsgi/wiki/StatsServer having simple json to manage is an invaluable feature. You may want to look at the uwsgitop project for an example usage. -- Roberto De Ioris http://unbit.it JID:

Re: Pyramid 1.3 DeprecationWarning

2012-05-21 Thread Vlad K.
On 05/21/2012 10:52 AM, Eric Lemoine wrote: On Sun, May 20, 2012 at 12:53 PM, Vlad K.v...@haronmedia.com wrote: Okay, this helped a lot. Installed Pyramid 1.3.2, upgraded zope.deprecation back to 4.0.0, zope.interface back to 4.0.0, had also to upgrade transaction to 1.3.0 (dep of

Re: Pyramid 1.3 DeprecationWarning

2012-05-20 Thread Vlad K.
of which is 3.5.1 I think. .oO V Oo. On 05/18/2012 01:12 PM, Vlad K. wrote: FTR, I just released zope.sqlalchemy 0.7.1 and Pyramid 1.3.1. These include fixes that allow them to work with zope.interface 4.0. - C -- You received this message because you are subscribed to the Google Groups

Re: Pyramid 1.3 DeprecationWarning

2012-05-18 Thread Vlad K.
On 05/18/2012 10:53 AM, Brian Sutherland wrote: Try sticking to zope.interface 3.8.x for now: http://pypi.python.org/pypi/zope.interface Okay, yeah, Pyramid's setup.py says zope.interface = 3.8.0, I guess that's safe then. Thanks for

Re: Pyramid 1.3 DeprecationWarning

2012-05-18 Thread Vlad K.
BTW, seems downgrading zope.intarface to 3.8.0 requires also zope.deprecation 4.0.0 , the latest of which is 3.5.1 I think. .oO V Oo. On 05/18/2012 01:12 PM, Vlad K. wrote: On 05/18/2012 10:53 AM, Brian Sutherland wrote: Try sticking to zope.interface 3.8.x for now: http

Re: Python's memory hogging

2012-05-17 Thread Vlad K.
On 05/17/2012 02:44 PM, Ceri Storey wrote: Also, it's worth bearing in mind that heapy will only record objects allocated and tracked by python, which will of course be a subset of the total memory allocated to python by the os (which is what the virtual size (VIRT) measures). I'd guess that

Re: Memory profiling a Pyramid app

2012-05-17 Thread Vlad K.
Thanks for all your replies. I've also tried pympler and looks like nice alternative to heapy(). .oO V Oo. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To

Pyramid 1.3 DeprecationWarning

2012-05-17 Thread Vlad K.
Hi. Just upgraded a 1.2 app to 1.3, with clean new virtualenv, all is working fine (with changes to config for waitress) except those pesky DeprecationWarning messages caused by Transaction, Chameleon, SQLA and even the configurator. It is in line with the changelog in docs stating it

Memory profiling a Pyramid app

2012-05-16 Thread Vlad K.
How? Which tools? I'm trying to use heapy but I'm fighting both with lack of proper documentation, and with the fact that I need to profile a wsgi app run behind uwsgi. Even if I run with pserve (1.3) I have no idea how to use heapy's interactive features. What else would you suggest to

Re: Python's memory hogging

2012-05-15 Thread Vlad K.
Okay, followup on this problem. I've now replaced one large lxml.etree root with chunked writing into a tempfile. The XML view basically does this (debug heapy output included): hp = guppy.hpy() print " BEFORE TEMPFILE"

Re: Web-framework+db with the widest scalability?

2012-05-12 Thread Vlad K.
There's no right answer to that. I suppose the choice of DB depends on your data structure. Do you need simple key-value storage, data store, or normalized database and relations? Can you live with denormalized data? Do you need complex queries for which SQL is most suitable? Do you need

Mixing data and interface in RESTful app

2012-05-07 Thread Vlad K.
Hi all. I am building an application that will be used both by humans and machines (via an API) and I am making it RESTful. I've decided to design it as one big API where human-operated browser is just another client to the API. With that I'm actually mixing user interface and data in

Re: Python's memory hogging

2012-05-07 Thread Vlad K.
On 05/06/2012 10:11 PM, Ben Bangert wrote: I found this presentation quite fascinating regarding how Python handles memory: http://revista.python.org.ar/2/en/html/memory-fragmentation.html Oh yeah, I've seen that presentation before, it is very interesting. Which version of Python? You

Re: Mixing data and interface in RESTful app

2012-05-07 Thread Vlad K.
On 05/07/2012 06:01 PM, Bill Seitz wrote: I agree, the human-UI needs to be optimized for an elegant UX, the API needs to be kept logically simple. For the API, you should be able to automate a lot of the CRUD renderings by introspection on your db structure, equivalent to how Rails/Django

Re: Python's memory hogging

2012-05-07 Thread Vlad K.
On 05/08/2012 12:42 AM, Jonathan Vanasco wrote: Yes. but if you're at the size where it needs to be a SOA , you pretty much need to have that daemon running nonstop. So you have a single process that is 'eternally' allocated 256MB (or whatever) and does all the grunt work - and you never run

Re: Python's memory hogging

2012-05-06 Thread Vlad K.
On 05/06/2012 07:31 AM, Roberto De Ioris wrote: But why moving away from uWSGI if it already give you all of the features you need to bypass your problem without installing other softwares ? (remember, uWSGI is not about speed as lot of people still think, it is about features) As options:

Re: Python's memory hogging

2012-05-06 Thread Vlad K.
On 05/06/2012 08:55 AM, Malthe Borch wrote: On 6 May 2012 04:27, Vlad K.v...@haronmedia.com wrote: I've got about 20 XML file formats to construct, each produced by its own (pluggable) module because each defines its own format etc... Switching to a file-based partial generation would mean a

Python's memory hogging

2012-05-05 Thread Vlad K.
Hi all. As I understand it Python won't release internally released memory back to OS. So it happens in my Pyramid app that has to process/construct rather largish XML files occasionally, the memory consumption jumps to several hundred MB and stays there for good or until I recycle the

Overriding (blocking) Set-Cookie per view

2012-03-10 Thread Vlad K.
Hi all. I'm using custom session-based Authentication Policy, and sessions are using default UnencryptedCookieSessionFactory in my Pyramid 1.2 app. For certain views I'd like to block (re)sending of Set-Cookie header because the results are cached by the web server (nginx) in which I

Re: Overriding (blocking) Set-Cookie per view

2012-03-10 Thread Vlad K.
Thanks for your reply. I tried both subscribing to NewResponse and adding a tween above main, but it seems that the session is working above INGRESS which I cannot override, because there is no set-cookie header in the response object. Unless I'm doing something wrong it seems I'd have to

Re: anyone have an idea to discern if we're operating as https or not ?

2012-03-10 Thread Vlad K.
I think in nginx + uwsgi setup you can use uwsgi_param to set, say, HTTP_SCHEME in your env taking it from $scheme variable in nginx (contains http or https). Fastcgi implementations have something similar. Otherwise (mod_wsgi ?) iirc, Paster Prefix middleware should be used. .oO V Oo.

Something in Pyramid is preventing gc on SQLAlchemy objects

2012-02-23 Thread Vlad K.
Hi all. I have a Pyramid bootstrapped script that has to process thousands of rows (on relatively complex model relationships) per call from command line. Pyramid is bootstrapped to reuse models and helper functions from the main web application this script is part of. The problem I'm

Re: Something in Pyramid is preventing gc on SQLAlchemy objects

2012-02-23 Thread Vlad K.
on. Sorry for wasting your time, folks. I'm sending this email to the SQLAlchemy list too, where I asked about this problem, for further reference in case anyone else has the same problem .oO V Oo. On 02/23/2012 02:24 PM, Vlad K. wrote: Hi all. I have a Pyramid bootstrapped script

Re: Something in Pyramid is preventing gc on SQLAlchemy objects

2012-02-23 Thread Vlad K.
, .oO V Oo. On 02/23/2012 02:24 PM, Vlad K. wrote: Hi all. I have a Pyramid bootstrapped script that has to process thousands of rows (on relatively complex model relationships) per call from command line. Pyramid is bootstrapped to reuse models and helper functions from the main web application

ApplicationShutdown Event?

2012-02-08 Thread Vlad K.
Hi all, is there a way to hook the code into some kind of application shutdown event? In particular I'd like to call engine.dispose() whenever the app shuts down (including pyramid.paster.bootstrap'ed scripts that call env[closer]() at the end), to prevent my PostgreSQL logs from filling

Re: Pyramid, threads and uWSGI

2012-01-15 Thread Vlad K.
On 01/15/2012 01:08 AM, Igor wrote: On 14 янв, 19:11, Vlad K.v...@haronmedia.com wrote: Hi all! I'm testdriving uwsgi to deploy Pyramid apps, and there's something I don't think I quite understand. If you want to use threads just for serving many pyramid apps in single uwsgi process, you

Pyramid, threads and uWSGI

2012-01-14 Thread Vlad K.
Hi all! I'm testdriving uwsgi to deploy Pyramid apps, and there's something I don't think I quite understand. First of all, I find its ability to run Pyramid natively through paste.deploy (via --paster option) excellent as it removes the need for .wsgi interface module. With that, Pyramid

Re: Pyramid, threads and uWSGI

2012-01-14 Thread Vlad K.
Hi, thanks for your reply. Python threads ARE mapped 1:1 to os threads. The GIL is only a pthread_mutex governing object access (obviously, i am speaking about a pthread-based implementation, that is the case for Linux/BSD/Solaris) My understanding was wrong then, but what you say makes

Re: Is there any case where chameleon is more preferred?

2011-12-18 Thread Vlad K.
It's not the question of well-formedness but the difference between HTML and XHTML. XHTML must comply to XML formatting rules (for example, self-closing tags) because it is essentially XML with HTML namespace (as default), HTML has no such requirement, but is backward compatible with XHTML

Re: Model validation

2011-12-13 Thread Vlad K.
Which is in my view exactly the power of Pyramid. By combining libs that do one job and do it well (like in The UNIX Way), one can build an application with Pyramid which is far, far more advanced at given task(s) than any full-stack solution limited only to what its stack is mandating.

Events system

2011-12-13 Thread Vlad K.
Hi all! In my Pyramid app I want to implement an event system, basically for plugins to hook to various events that raise in the life of the application. These events are each different, some allow one hook (by raising an exception if another hook tries to register for same event), some

Re: Events system

2011-12-13 Thread Vlad K.
Ah, great, excellent, I totally forgot about this... thought they were limited to Pyramid configuration only and failed to re-read the docs properly. Except I don't see a way how to enforce single handler for particular events, and raise if multiple subscribers exist. Track count with a

Re: Model validation

2011-12-12 Thread Vlad K.
No they're not the same. I'm developing a complex app based on Pyramid and I love the fact that Pyramid is lightweight and not assuming things. It allows me to: 1. choose peppercorn + colander to validate multilevel forms (forms that are not flat key-value pairs but complex hierarchies),

Locale identifier in clean URL

2011-12-09 Thread Vlad K.
Hi! I'd like to implement clean locale-aware URLs, meaning no _LOCALE_ in params, cookies, or similar. For example, route: /en/page/{id} What are your thoughts on how I should implement this. As I see it, my options are 1. Write a tween or something that parses the URL before the router

Re: Pyramid 1.3a1 released

2011-12-09 Thread Vlad K.
Awesome, excellent changes, many thanks and congrats to the devs! Question: is departure from Paste and PasteScript permanent? Is it a long term goal to depart from PasteDeploy as well in the future versions? I don't have anything against Paste* libs, of course, just asking because I

Fetching registry (settings) outside of the view

2011-12-01 Thread Vlad K.
Hello all! What is the recommended way to fetch registry (settings) for read only outside of the view (where request object is not available)? I was looking at the threadlocal.get_current_registry() but the docs say it should not be used except maybe in unit tests. I understand that the

Re: Fetching registry (settings) outside of the view

2011-12-01 Thread Vlad K.
be called in views, or command line scripts (using pyramid.paster.bootstrap), etc... It requires admin address and smpt server data given in the config files. Thanks! .oO V Oo. On 12/01/2011 05:42 PM, Chris McDonough wrote: On Thu, 2011-12-01 at 17:30 +0100, Vlad K. wrote: Hello all

Re: Fetching registry (settings) outside of the view

2011-12-01 Thread Vlad K.
Hi, thanks for your feedback. It's just a matter of the separation of concerns. The code I need it in is confined to the model, defined in a pluggable model module. It's not that I can't redesign the chain of calls in order to pass the request object around, I was just looking at feasible

Re: Multiple transactions within request

2011-11-16 Thread Vlad K.
Yes it actually works if I use session.flush() instead of transaction.commit() within the subtransaction. So I guess transaction.commit() and transaction.abort() close the entire transaction unlike session.commit() which when matched against session.begin_nested() releases the savepoint but

Re: Multiple transactions within request

2011-11-16 Thread Vlad K.
According to my tests it is, or at least the end result is savepoint release being emitted before final commit. For this code: sp = transaction.savepoint() ... do something session.flush() sp2 = transaction.savepoint() ... do something session.flush() # Oops,

Re: Multiple transactions within request

2011-11-15 Thread Vlad K.
Okay, I guess I have fixed it. I say I guess because the solution between my app and a simple test scenario is different. The new test scenario is here: https://gist.github.com/1366878 Basically the same as before, but now you can vary between using Transaction or SQLAlchemy directly

Re: Multiple transactions within request

2011-11-14 Thread Vlad K.
Sure, I'll whip something up. Thanks. .oO V Oo. On 11/14/2011 06:01 AM, Chris McDonough wrote: I hate to ask, but would it be possible to concoct a short Python script that creates a SQLA DBSession (with the ZopeTransactionExtension enabled) that issues transaction.commit/savepoint/abort

Re: Multiple transactions within request

2011-11-14 Thread Vlad K.
() connection. .oO V Oo. On 11/14/2011 12:04 PM, Vlad K. wrote: Sure, I'll whip something up. Thanks. .oO V Oo. On 11/14/2011 06:01 AM, Chris McDonough wrote: I hate to ask, but would it be possible to concoct a short Python script that creates a SQLA DBSession

Re: Multiple transactions within request

2011-11-14 Thread Vlad K.
or relationship() connection. .oO V Oo. On 11/14/2011 12:04 PM, Vlad K. wrote: Sure, I'll whip something up. Thanks. .oO V Oo. On 11/14/2011 06:01 AM, Chris McDonough wrote: I hate to ask, but would it be possible to concoct a short Python script that creates a SQLA DBSession

Re: Multiple transactions within request

2011-11-14 Thread Vlad K.
... Thanks! ;) .oO V Oo. On 11/14/2011 07:50 PM, Chris McDonough wrote: On Mon, 2011-11-14 at 13:41 +0100, Vlad K. wrote: Here: https://gist.github.com/1363860 This simple test case works just fine, meaning the problem is somewhere in my application. As you can see from the code, I tried both

Re: Multiple transactions within request

2011-11-14 Thread Vlad K.
. Thanks! .oO V Oo. On 11/14/2011 09:27 PM, Chris McDonough wrote: On Mon, 2011-11-14 at 21:14 +0100, Vlad K. wrote: Because each savepoint must be met by one commit or one rollback. If I use session.flush(), the second call would start savepoint 2, but would not release savepoint 1 (nor roll

Re: Multiple transactions within request

2011-11-13 Thread Vlad K.
How dumb of me for not trying that... thanks! It seems it also works for transaction.abort(), except that invalidates previous session altogether. .oO V Oo. On 11/13/2011 08:44 AM, Malthe Borch wrote: On 12 November 2011 01:07, Vlad K.v...@haronmedia.com wrote: Is it possible to have

Re: Multiple transactions within request

2011-11-13 Thread Vlad K.
transaction but it fails with: TransactionFailedError: An operation previously failed, with traceback .oO V Oo. On 11/13/2011 01:37 PM, Vlad K. wrote: How dumb of me for not trying that... thanks! It seems it also works for transaction.abort(), except that invalidates previous session altogether

Re: Multiple transactions within request

2011-11-13 Thread Vlad K.
I do, but that doesn't help. If I use transaction.abort() it seems that entire transaction is aborted. If I use savepoint.rollback() (savepoint being given by transaction.savepoint()) I get InvalidSavepointRollbackError. The SQLAlchemy manual suggests that for each session.being_nested()

Re: Multiple transactions within request

2011-11-13 Thread Vlad K.
Hi, thanks for joining us here. :) Yes, zope.transaction does indeed support savepoints: somesavepoint = transaction.savepoint() And indeed I can see it being emitted in the SQL debug output: 2011-11-13 15:59:57,895 INFO [sqlalchemy.engine.base.Engine][worker 0] SAVEPOINT sa_savepoint_1

Multiple transactions within request

2011-11-11 Thread Vlad K.
Hi all! Is it possible to have multiple transactions within a request, and how to start new one after transaction.commit() is manually invoked? But maybe I'm asking wrong question. What I'm trying to do is database-based process locking. A request must check for this lock (basically a

Re: Handling Duplicate Primary Keys

2011-10-27 Thread Vlad K.
I have apps that solve the same problem and I rely on IntegrityError. I simply catch it and return the information to the user that the username is already taken. Someone else here suggested you should check if the username exists first, but that is not as good a solution. What if another

WebTest's functional testing with unicode: how to?

2011-10-25 Thread Vlad K.
Hi! I'm using the WebTest package for functional tests with webtest.TestApp(...), providing the POST params as dictionary to webtest.TestApp.post(). The values in the dictionary are unicode (u strings), and the test script has proper encoding given via #-*- coding:UTF-8 -*- as first line.

Re: WebTest's functional testing with unicode: how to?

2011-10-25 Thread Vlad K.
Hi. Meanwhile I've forced all values through a central dictionary constructing method that forces values into unicode object type right before posting and does: for k,v in params: params[k] = unicode(v).encode(UTF-8) That along with content_type set to application/x-www-form-urlencode;

Re: Any sort of troubles deploying with mod_wsgi

2011-10-19 Thread Vlad K.
What Pyramid version you're running? There has been a change in the way middleware is included, I believe as of 1.2., it now uses pyramid.includes entry in the INIs. However, I _don't_ know if the old way via [pipeline:main] is still acceptable, or if this makes any difference since you say

Re: Any sort of troubles deploying with mod_wsgi

2011-10-19 Thread Vlad K.
I recommend you start with clean setup.py and development/production.inis from 1.2 and then fill it up with your config. Also good thing to watch the changelog for (breaking) changes. I also recommend you lock the libs to specific version your app is tested against, ie. don't use = but ==

Using colander locales in Pyramid

2011-09-22 Thread Vlad K.
Hi. I have a Pyramid application that uses colander for form validation, and I don't know how to set its locale. I have: * set pyramid.default_locale_name = hr_HR.utf8 in development|production.ini * set locale.setlocale(locale.LC_ALL, hr_HR.utf8) at the beginning of app's __init__.py

Re: Using colander locales in Pyramid

2011-09-22 Thread Vlad K.
Yes: config.add_translation_dirs('colander:locale/') It seems I lack basic understanding of using locales. I tried this quick test and I don't get error in Croatian. Could me the .po .mo files are invalid? Those are directly supplied from Poedit, editing the colander.pot file. import

Re: Using colander locales in Pyramid

2011-09-22 Thread Vlad K.
Okay, but let's forget my translations for a moment. Say I wish to use colander like in the test example for any of the locales already present in colander package, for example de_DE. What do I need to do? Because I can't get any of them to work. .oO V Oo. On 09/22/2011 01:13 PM, Chris

Re: Using colander locales in Pyramid

2011-09-22 Thread Vlad K.
No I don't use deform. I use peppercorn to parse POST but that's on the other side of the pattern. :) My problem is using colander directly. I don't know how to make it output translated error strings in any of the provided locales, let alone doing that from Pyramid. Seems I need to setup

Re: Using colander locales in Pyramid

2011-09-22 Thread Vlad K.
02:21 PM, Chris McDonough wrote: On Thu, 2011-09-22 at 13:45 +0200, Vlad K. wrote: Okay, but let's forget my translations for a moment. Say I wish to use colander like in the test example for any of the locales already present in colander package, for example de_DE. What do I need to do? Because I

Deploying to multiple app servers

2011-09-13 Thread Vlad K.
I have a question about deploying a Pyramid app to multiple application servers. My personal preference is to check out the code from SVN directly into production, but that's not the issue here. The virtualenv and dependencies are the issue. Some deps come with extensions that need to be

Re: Pyramid 1.2b2 released

2011-09-09 Thread Vlad K.
Just installed 1.2 (b2) for the first time and just wanted to say that the debug toolbar is AWESOME! Congrats to the dev team! .oO V Oo. On 09/08/2011 11:52 PM, Chris McDonough wrote: Pyramid 1.2b2 has been released. The changes from 1.2b1 are as follows: -- You received this message

Profiling Pyramid apps

2011-09-06 Thread Vlad K.
Searching the group on the subject reveals some year old talk about profiling Pylons apps. Is there anything new, any advice on how to profile Pyramid apps though? -- .oO V Oo. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to

Re: In Pylons 1.0 or Pyramid, what is your better javascript cache invalidation solution ?

2011-09-05 Thread Vlad K.
I take latest SVN revision number from local .svn dir entries automatically upon application start, put it in settings, and use that, for instance as: example.com/static/js/foobar.js?rev=${settings[svn_revision]} I use global revision number, but it is possible to monitor the rev of only

Pyramid 1.1 static routes

2011-07-18 Thread Vlad K.
Just a quick observation regarding static routes. Is static really a good name here? IMHO a static route is something that never changes, as opposed to dynamic route: /foo/bar is a static route /foo/{bar} is a dynamic one Perhaps the term should be a void route? A route that is never

Re: Help with Authentication and Authorization

2011-07-13 Thread Vlad K.
It's not just the problem of hardcoded groups. Default authn implementation with AuthTkt uses a groupfind callback which effectively defines the group per request, and that would be the right place to pull data from db (based on authenticated_userid). Not being happy with it, I rolled my

Multiple WSGI apps on same code base?

2011-07-11 Thread Vlad K.
Experimental, hypothetical question: If I wanted two logically separate parts of the same application (sharing same resources) to run as two separate WSGI apps (say, by mapping different sub-domains to two distinctive .wsgi interface files), are there any (non-)obvious traps in this? Of

Re: WebOb POST vars like in PHP?

2011-07-01 Thread Vlad K.
On 06/26/2011 08:18 PM, Chris McDonough wrote: This is actually not quite true. See http://plope.com/peppercorn (which might be something you'd want to use). Yes, I wrongly accused MultiDict of being unordered, so I ran through the source to see how it works. And indeed, peppercorn is

Re: WebOb POST vars like in PHP?

2011-06-26 Thread Vlad K.
Thanks for your reply, but the problem is there is no request.POST(var), there is request.POST(var[foo]) and at that point I don't know all the possible values of foo. I solved with with a custom extraction function. While I'm at it, though, I wonder how others are solving the same

WebOb POST vars like in PHP?

2011-06-25 Thread Vlad K.
I guess this has probably been asked before, but Google did not return anything meaningful. My question is what would be the best way to supply POST vars in PHP notation, that would be converted to a dictionary (in Pyramid): var[foo]=123 - becomes request.POST[var][foo] with value 123

Re: Easier permission check possible?

2011-06-25 Thread Vlad K.
On 06/24/2011 07:21 PM, Chris McDonough wrote: If you mean you want to be able to do if perm in all_perms, where all_perms is some sort of list or dict provided by Pyramid (and not just an object with a __contains__ wrapper, as I provided before), I'm afraid it's not going to fly. Yes, I see

Easier permission check possible?

2011-06-24 Thread Vlad K.
pyramid.security.has_permission() takes three params, the 'context' of which is redundant for URL dispatch apps with no non-default context (isn't it?). In templates, we often display various UI parts depending on the permissions the user has. For instance: % if has_permission(admin,

Re: Easier permission check possible?

2011-06-24 Thread Vlad K.
On 06/24/2011 03:32 PM, Chris McDonough wrote: If you never use the factory= or traverse= arguments to to add_route and you never use *traverse in a URL pattern, it will always be the default context. But it isn't always the default context. My point is that the context parameter ( of

Re: Pyramid: Authn policy, remember() and groupfinder confusion

2011-03-31 Thread Vlad K.
user group upon each request? Thanks, Vlad On 03/24/2011 06:54 PM, Vlad K. wrote: I'm slightly confused regarding the trio of AuthTktAuthenticationPolicy, its groupfinder callback and the pyramid.security.remember() function. First of all, I don't quite understand the kw params

Pyramid: Authn policy, remember() and groupfinder confusion

2011-03-24 Thread Vlad K.
I'm slightly confused regarding the trio of AuthTktAuthenticationPolicy, its groupfinder callback and the pyramid.security.remember() function. First of all, I don't quite understand the kw params of the remember() function. If those params are app specific, where can they be read and used

Re: Pyramid: Authn policy, remember() and groupfinder confusion

2011-03-24 Thread Vlad K.
Yes, that much I understood from the documentation, but for example this is from the pyramid.security documentation: headers = remember(request, 'chrism', password='123', max_age='86400') From which I gather that password and max_age are the kw params where meaning of **kw must be