Re: [pylons-discuss] Routes with same name and different url
On 04 Mar 2015, at 15:34, Mário Idival marioidi...@gmail.com wrote: Good morning I wonder if there is any way that I can name two routes with the same name and with different urls … You can’t do that. Why would you want to do that? Perhaps there is an alternative approach that would work for you. 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 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] Dynamically-generated PDF to download
On 25 Jan 2015, at 07:37, Adam Morris adam.mor...@igbis.edu.my wrote: I have a view that serves up a page that whose template/css contain both define screen and print media. Which means the view's renderer provides a page that serves up html that is formatted for the browser (screen media) and if the user prints it formatted for the page (the print media). The CSS that does this is: link rel=stylesheet href=${static_url}css/reports.css media=screen link rel=stylesheet href=${static_url}css/reports_pdf.css media=print I want to add a view that returns a FileResponse, as rendered by the print media, so that particular location results in a download of that PDF, but I don't want to repeat code. I don't want to serve a static asset, I want the PDF to be dynamically created. Any ideas on how to tackle this best? Here is an example: https://github.com/wichert/checking/blob/master/src/checking/invoice.py#L306 https://github.com/wichert/checking/blob/master/src/checking/invoice.py#L306 The basic approach is: generate your data (in this case the PDF file), create a response object using your data, set the right headers for it and return it from your view. 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.
Re: [pylons-discuss] Dynamically-generated PDF to download
On 25 Jan 2015, at 14:40, Adam Morris adam.mor...@igbis.edu.my wrote: Okay, I get that bit now, and coded it up, but when I go to render it, I use the pyramid.renderers.render object but obviously it ends up downloading a corrupted file because it's not even in PDF format. You are still rendering a .pt file, so I’m guessing you are generating HTML, not PDF. If you want to generate PDF you will need to use a PDF library. So does reportlab have something to take that html/css and paint it to a Canvas or something? I use z3c.rml, which uses RML as input to generate PDF. If you want to use HTML CSS you’ll need to find a library that can convert HTML to PDF. 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.
Re: [pylons-discuss] Handling hTTP OPTIONS request
On 13 Dec 2014, at 19:52, Raja Naresh rajanares...@gmail.com wrote: Hello Everyone, Is there a way I can handle HTTP OPTIONS request in pyramid? I am trying to make a CORS request with a custom header hence it's preflighted and I want to handle the HTTP OPTIONS request. Any kind of help is appreciated. Thank you. Handling OPTIONS is no different than handling any other request method as fast as Pyramid is concerned. The simplest way to do that is to specify the request_method parameter for the view_config decorator: @view_config(route_name=‘my-route’, request_method=‘OPTIONS’, renderer=’string'): def my_route_options(context, request): request.response.headers.update({ ‘Access-Control-Allow-Methods’: ‘POST,GET,OPTIONS’, ‘Access-Control-Allow-Credentials’: ‘true’}) return '' If you are writing a REST backend you may also want to look at rest-toolkit (see http://rest-toolkit.readthedocs.org/en/latest/ http://rest-toolkit.readthedocs.org/en/latest/ ) which will automatically handle OPTIONS for you. Regards, 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.
Re: [pylons-discuss] JSON data no reaching my view
On 10 Dec 2014, at 13:27, Rosciuc Bogdan rosciuc.bog...@gmail.com wrote: My view code: @view_config(route_name = 'declare_usage', renderer = 'declara.jinja2') @view_config(route_name = 'declare_usage_json', renderer = 'json') def declara_consum(request): #Removed code for simplicity val = request.POST.get('room') #I get a None value in my html if I change to request.json_body - I get an error that there is no json to be parsed. You need to use request.json_body to get decoded JSON data. 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.
Re: [pylons-discuss] Strange overlaps in independent Pyramid projects
On 30 Oct 2014, at 11:30, Laurent DAVERIO ldave...@gmail.com wrote: Overlap #1: SQLAlchemy maps the wrong class to the returned data : I assume this is because the classes bear the same names (or aliases) in the two distinct projects : $ cd foo $ pshell development.ini In [1]: from foo.models import * In [2]: Article Out[2]: foo.models.article.FooArticle In [3]: print Session.query(Article) SELECT [...] FROM article JOIN foo_article ON article.id = foo_article.id In [4]: a = Session.query(Article).first() In [5]: a Out[5]: BarArticle id=19844 In that example, Article is an alias of FooArticle, which is confirmed by [2]. The generated SQL query interrogates the right tables, as shown by [3]. But the object returned by [4] should be an instance of FooArticle, not BarArticle [5]! You may want to ask about that one on the SQLAlchemy list, it might be a bug. The fact that you alias the classes to Article is not related (and SQLAlchemy can’t even see that). I suspect this has more to do with your use of row ids and inheritance setup. = Overlap #2: Supervisord picks the wrong gunicorn_paster script It happens even when the two projects are moved to separate virtualenvs. I've been obliged to replace it with daemontools, temporarily or permanently. For instance, with the line below: command = /projects/venv2/bin/gunicorn -w 4 --paste /projects/venv2/bar/bar/production.ini supervisord incorrectly launches /projects/venv1/bin/gunicorn... This is totally illogical... :( Don’t know about that one. 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.
Re: [pylons-discuss] Pyramid + ZODB persistent registry
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.
Re: [pylons-discuss] Turning arbitrary query string into IMultiDict?
On 08 Sep 2014, at 16:04, pyramidX veerukrish...@hotmail.com wrote: In Python 3 what is the best way to turn a string that's a URL querystring (gotten from anywhere, not necessarily current request) into an IMultiDict? Is it urllib.parse or is there a more Pyramid specific way of doing this? I tried to look in the Pyramid code on github but couldn't find how IMultiDict is created (searched for IMultiDict but couldn't find the class that implements that interface). There is nothing Pyramid-specific about that: Python's standard library has a function to decode the query string, and MultiDict comes from webob. This should work in Python 3 (untested since I use Python 2 only): from webob.multidict import MultiDict from urllib.parse import parse_qsl d = MultiDict(parse_qsl('foo=barfoo=buz')) d.getall('foo') ['bar', 'buz'] 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.
Re: [pylons-discuss] setup.py's requires vs development.ini's pyramid.includes vs __init__.py's config.include
On 07 Sep 2014, at 13:07, pyramidX veerukrish...@hotmail.com wrote: In what cases would you add something you've put in setup.py into one of pyramid.includes or config.include()? I see that my sample applications work fine even though some of the things specified in setup.py haven't been 'included' (relatively new to Python). The simplest answer here is that you would add an include-statement or .ini entry if the documentation of the package says you should. Generally speaking that is used by pyramid-specific packages that need to hook into pyramid's configuration, for example to register a tween or a renderer. 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.
Re: [pylons-discuss] setup.py's requires vs development.ini's pyramid.includes vs __init__.py's config.include
On 06 Sep 2014, at 14:20, pyramidX veerukrish...@hotmail.com wrote: I'm not sure what the difference is between the requires statement in setup.py and the pyramid.includes statement in development.ini and the config.include(...) in __init__.py. The requires statement in setup.py tells the Python packaging system (pip/easy_install/buildout/etc.) that in order to use your package another package must be installed. This is always needed. The pyramid.includes statement in your .ini file and config.include() do exactly the same thing; which one you us is completely up to your personal preference. 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.
Re: [pylons-discuss] RFC: Pyramid tutorial at PyCon
On 04 Sep 2014, at 12:35, Paul Everitt paulwever...@gmail.com wrote: tl;dr Should I submit a slightly different kind of PyCon tutorial proposal? Although this isn't necessarily the target audience, I thought I'd open it up for discussion here. At the last two PyCons I did a half-day intro to Pyramid under Python 3 tutorial. In fact, I pitched at those interested in web development under Python 3 first, with Pyramid along for the ride. The signup numbers were good the first year, then lower last year. I am thinking about adding something to attract interest. Lately I've been doing a lot of frontend development: AngularJS talking to a REST API in Pyramid. Which also means the modern frontend toolchain: npm, bower, grunt/gulp, with Karma/Protractor for testing. Do you think I should submit a tutorial proposal that is frontend+REST in nature? I like this plan :) 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.
Re: [pylons-discuss] Mako templates with Deform
On 22 Aug 2014, at 10:39, pyramidX veerukrish...@hotmail.com wrote: I'm using Mako templates and have tried using Deform and it seems to work even though I haven't converted any widget templates to Mako from chameleon. Why is that? I am guessing deform renders the widget templates itself, so the template language used for widgets is just an implementation detail that you never have to think about. http://deform.readthedocs.org/en/latest/templates.html says Optionally, convert all the existing Deform templates to your templating language of choice. This is only necessary if you choose to use the widgets that ship as part of Deform. but I am using the widgets that ship with Deform, so I'm not sure why it's working. That documentation might be wrong. If I want to add a single new widget template and want to write it in Mako, does that mean I need to change ALL the widget templates? For example if I have a form with 10 field and I want to rewrite 1 of them, and I don't want to write it in chameleon, can I only rewrite that 1 widget or do I have to rewrite all 10? I'ld say no; you can probably choose the template tool to use per widget as part of its implementation. 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.
Re: [pylons-discuss] Localized URL schema using chameleon
On 21 Aug 2014, at 01:29, Kamal Gill designbyka...@gmail.com wrote: Oscar, It's probably safer to pass the translated string as a template variable from the view callable, since Pyramid's i18n machinery only picks up translation strings marked via i18n:translate and i18n:attributes in .pt files IIRC. Basically, you would pass products as a string marked for translation to your template from the view. The template would be the following (using your original code)... pa href=/${request.locale_name}/${products}img src=products.jpg alt= //a/p While the view would mark the products string for i18n as follows... from pyramid.i18n import TranslationString as _ ... @view_config(route_name='products', renderer='templates/products.pt http://products.pt/') def products_view(): ... return dict(products=_(u'products')) HTH, Kamal On Aug 20, 2014, at 4:13 PM, Oscar Curero flext...@gmail.com mailto:flext...@gmail.com wrote: On Wednesday, August 20, 2014 7:28:28 PM UTC+2, Wichert Akkerman wrote: On 20 Aug 2014, at 19:21, Oscar Curero flex...@gmail.com javascript: wrote: Hi, I'm building my first application using pyramid and chameleon and I'm having problems with the localized URL schema. It's something like this: /en/products /es/productos /ca/productes The problem starts when I need to make the HTML templates. For example, I want to make the following template: pa href=/${request.locale_name}/${products}img src=products.jpg alt= //a/p The problem here is that ${products} assumes that you have a python variable named products at hand and want to insert its value in the template. But since you have no such variable you get a NameError exception. If you goal is to make the word products translatable you can do this: ${_(products)} . Wichert. Thanks Wichert. If I try what you say with nothing else, it doesn't work yet: NameError: _ - Expression: ${request.locale_name}/${_('products')} - Filename: ... ate/templates/products.pt http://products.pt/ - Location: (line 10: col 30) - Source: ... pa href=/${request.locale_name}/${_('products')}img ... However, if I add at the top of the template the following statement, it works as expected: ?python from pyramid.i18n import TranslationString as _ ? Is this the way it should work? It is! You can also use a BeforeRender event to expose _ to all templates. See http://docs.pylonsproject.org/projects/pyramid/en/1.5-branch/api/events.html#pyramid.events.BeforeRender http://docs.pylonsproject.org/projects/pyramid/en/1.5-branch/api/events.html#pyramid.events.BeforeRender for an example of doing that. 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.
Re: [pylons-discuss] See authentication headers with DummyRequest
On 19 Aug 2014, at 23:13, pyramidX veerukrish...@hotmail.com wrote: I'm using DummyRequest in my tests to test authentication, this is what I return from the view when login succeeds headers = remember(request, email) return HTTPFound(location=next, headers=headers) This is my test request = testing.DummyRequest(post={'usr': 't...@example.com', 'pwd': 'mypassword'}) view = views.login(request) print(view.headers) The returned value there is a response object. print(request.headers) The exact response here will vary a bit depending on your authentication policy. For auth_tkt you should see a couple of Set-Cookie headers that set the authentication cookie. If you use a session authentication policy you might not see anything here, or only a Set-Cookie header to set the session cookie. print(unauthenticated_userid(request)) print(authenticated_userid(request)) Those function only work on an incoming request, not on a response object. How can I test that authentication has worked? That depends a bit on your testing style. The most reliable method is to write an integration test and do a second request and check the response to see if authentication succeeded. The pure unit-test approach is to insert a mock for remember() and check if the headers returned by remember() show up in the response headers. 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.
Re: [pylons-discuss] See authentication headers with DummyRequest
On 20 Aug 2014, at 12:33, pyramidX veerukrish...@hotmail.com wrote: Thanks, that clarifies things. You're right that an integration test is more the way to go rather than trying to unit test this. What is the most straightforward way to run integration tests that span multiple requests? I could do 1 DummyRequest to log in, then take those Set-Cookie headers on the response and create a new DummyRequest and manually turn them into Cookie headers, but this seems error-prone. It would be me trying to do the work of a web client (such as browser) manually (i.e. the part you mentioned Browser will process the response from the view in step 2, update its cookies and send a new request.). For example, maybe I'll set a cookie that shouldn't have been set because of the cookie's path attribute, expiry time, or something else I didn't consider (but a browser or proper web client would). request1 = DummyRequest(post=) response1 = views.login(request1) # What's the least error-prone way of turning all the Set-Cookie's from response1 into Cookie's in request2? request2 = DummyRequest(post=.) response2 = views.someotherview(request2) I took a look at the Integration testing and Functional testing sections at http://docs.pylonsproject.org/docs/pyramid/en/latest/narr/testing.html but they don't mention such a workflow. Is my only option to use something at a much higher level like Selenium? Hopefully not, as I like the idea of asserting things at the level of the pyramid view (like asserting with a dict that is returned by a view for example). What I'd like to do is write some use case integration tests, like: Use functional tests: http://docs.pylonsproject.org/projects/pyramid/en/1.5-branch/narr/testing.html#creating-functional-tests . They are designed for this very purpose. Selenium is useful if you also want to take the next step and verify in-browser rendering and javascript. 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.
Re: [pylons-discuss] Localized URL schema using chameleon
On 20 Aug 2014, at 19:21, Oscar Curero flext...@gmail.com wrote: Hi, I'm building my first application using pyramid and chameleon and I'm having problems with the localized URL schema. It's something like this: /en/products /es/productos /ca/productes The problem starts when I need to make the HTML templates. For example, I want to make the following template: pa href=/${request.locale_name}/${products}img src=products.jpg alt= //a/p The problem here is that ${products} assumes that you have a python variable named “products” at hand and want to insert its value in the template. But since you have no such variable you get a NameError exception. If you goal is to make the word “products” translatable you can do this: ${_(“products”)} . 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.
Re: [pylons-discuss] Can sessions be used if using AuthTktAuthenticationPolicy instead of SessionAuthenticationPolicy?
On 18 Aug 2014, at 12:46, pyramidX veerukrish...@hotmail.com wrote: So when using AuthTkt auth policy I'm setting 2 cookies and making a network round trip to the session srver (assuming session server and web server are on different machines) only when the request uses the session? Yes. I'm not sure what you mean with session server though. There are many ways to store session data, and not all of those require a separate storage server. For example cookie sessions have the very nice advantage of not requiring any server-side storage at all. And by using Session auth policy I set 1 cookie but make a round trip to the session server every single request? Have I understood this right? Yes. 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.
Re: [pylons-discuss] Multilingual Pyramid applications
On 18 Aug 2014, at 20:52, Mike Orr sluggos...@gmail.com wrote: Are there other significant multilingual Pyramid applications out there? There's generic things like Kotti but I'm thinking more of concrete applications. We have a bunch of sites that run in Dutch, English, German, Simplified and Traditional Chinese (although we don’t run in all languages anymore currently). I would say the software-part of i18n is in pretty good shape these days – the non-technical part of i18n tends to take a lot more effort, although tools like Weblate help a lot there as well. Having said that there are a few caveats: translationstring messages can only be extracted from Python code and Chameleon templates. See https://github.com/wichert/lingua/issues/46 https://github.com/wichert/lingua/issues/46 for some background on this. Plural support is still be a bit immature and could definitely use some more polish. Oddly enough I haven’t had that use that so far, so I’ve never put any real effort into it. Some of the existing Pyramid-related documentation/blogs/etc might still assume use of lingua 1 in combination with Babel to create your POT file. This has changed quite significantly with lingua 2, so make sure to follow the official documentation for Pyramid and lingua. 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.
Re: [pylons-discuss] Multilingual Pyramid applications
On 18 Aug 2014, at 21:24, Kamal Gill designbyka...@gmail.com wrote Note that we're on Pyramid 1.4 due to our deployment target, so we're still using Lingua and Babel, but we hope to switch to Pyramid 1.5 or later in an upcoming release. You can use Lingua 2 with Pyramid 1.4 as well. I would still use Babel for its l10n features (CLDR access) so you get date, time, currency, etc. formatting correct for all locales. One gotcha that tripped us up was that every template (including pyramid_layout panels) needs to have the i18n:domain attribute specified. Placing it in the master template (e.g. at https://github.com/eucalyptus/eucaconsole/blob/develop/eucaconsole/templates/master_layout.pt#L6 https://github.com/eucalyptus/eucaconsole/blob/develop/eucaconsole/templates/master_layout.pt#L6) unfortunately isn't sufficient. For what it's worth: that is by design. Your layout template, or any METAL macro you are calling, might come from a different source and use a different domain than the calling template. If the domain would be passed down when calling a METAL macro you could get very strange results in complex systems where you use multiple domains: depending on where you call a macro from you could get very different results. To guarantee that the i18n behavior is predictable the i18n domain is only managed through the local hierarchy in the template. 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.
Re: [pylons-discuss] Per user connection using SQLAlchemy ORM
On 25 Jul 2014, at 09:44, Lele Gaifax l...@metapensiero.it wrote: url = config['sqlalchemy.url'] if username is None: url = url.replace(u'username:password@', u'') else: url = url.replace(u'username', username) url = url.replace(u'password', password) That code looks dangerous to me. If someone picks “password” as username the results will be interesting. Worse things will happen if you other characters. For example what my password is “password@192.168.0.100/“ – will that make the system try to connect to a PostgreSQL server at 192.168.0.100? 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.
Re: [pylons-discuss] [pyramid] testing views with models sqlalchemy
On 22 Jul 2014, at 08:28, Kiss György w2lk...@gmail.com wrote: py.test style rewrite: # conftest.py from pyramid import testing import pytest import transaction from pokerherd.models import DBSession @pytest.fixture def req(): Pyramid DummyRequest. return testing.DummyRequest() @pytest.fixture(scope='function') def db(request): SQLAlchemy session. config = testing.setUp() from sqlalchemy import create_engine engine = create_engine('sqlite://', echo=True) from pokerherd.models import Base, MyModel DBSession.configure(bind=engine) Base.metadata.create_all(engine) with transaction.manager: model = MyModel(name='one', value=55) DBSession.add(model) def fin(): DBSession.remove() testing.tearDown() request.addfinalizer(fin) return DBSession # test_views.py from myproject.models import DBSession, MyModel class TestMyView: def test_passing_view(self, db, req): from myproject.views import my_view response = my_view(req) assert response['one'].name == 'one' assert response['project'] == 'pokerherd' def test_failing_view(self, req): from myproject.views import my_view response = my_view(req) assert response.status_int == 500 The first example is working fine, but the second test fails, because sqlite DBSession from memory don't get deleted. I don't understand the difference. You may need to explicitly dispose of the engine. I would recommend to look at the pytest section of the pyramid_sqlalchemy documentation: https://pyramid-sqlalchemy.readthedocs.org/en/latest/tests.html#py-test-fixtures . That describes in detail how you can setup pytest fixtures for SQLAlchemy, and use this with functional tests of a Pyramid application. 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.
Re: [pylons-discuss] beginner: route_url param
On 20 Jul 2014, at 21:15, Michael taomaili...@gmail.com wrote: hi all, how do I properly create a param with route_url ? when I do return HTTPFound(location=request.route_url('user_recent', username=auth.username, page='1'), headers=headers) Use the _query parameter for route_url: url = request.route_url(‘user_recent’, _query={‘username’: auth.username, ‘page’: ‘1’}) HTTPFound(url, headers=headers) 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.
Re: [pylons-discuss] How does one use SQLAlchemy Events with Pyramid?
On 14 Jul 2014, at 09:29, Seth seedifferen...@gmail.com wrote: Hello, I'd like to use SQLAlchemy events (http://sqlalchemy.readthedocs.org/en/rel_0_9/orm/events.html) to be able to fire off a task when a particular model is updated. For example, say someone updates their UserProfile model via a form or an API -- I'd like to be aware when the model update takes place and be able to perform some ancillary tasks. For some reason I'm having trouble finding good/usable examples for this so maybe it's not possible/not the right approach? This is certainly possible. There is nothing pyramid-specific about doing that. If you want an example of using SQLAlchemy events you can take a look at pyramid_sqlalchemy (I'll announce that properly in a separate mail): https://github.com/wichert/pyramid_sqlalchemy/blob/master/src/pyramid_sqlalchemy/events.py 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.
Re: Returning a file object from an action
On 2010-7-21 21:40, Mike Orr wrote: On Wed, Jul 21, 2010 at 12:33 PM, Ian Wilsonianjosephwil...@gmail.com wrote: Hello, I think you want something like this. from paste.fileapp import FileApp # in controller #...in some action, get the path to serve wsgi_app = FileApp(path) return wsgi_app(request.environ, self.start_response) Yes, use paste.fileapp. You can just return the wsgi_app object directly, and Pylons will call it for you. A better solution you might want to look into is x-sendfile/x-accel-redirect which let's you pass the path up to a proxying server via a header that it can use to serve the file. That way you can check permissions in your app but still serve the file via apache/nginx/etc. This is a more efficient method which some of us are starting to use. Would be nice if FileApp can do that automatically itself. Or does it already? Wichert. -- Wichert Akkerman wich...@wiggy.net It is simple to make things. http://www.wiggy.net/ It is hard to make things simple. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Paste 1.7.4, security fix for XSS hole
On 6/24/10 09:07 , Ian Bicking wrote: I believe the changes to 1.7.4 are limited and upgrading will have a low impact. Is there a changelog somewhere? The paste website still lists 1.7.3 as the last release and the pypi page has no changelog information. If I look at http://bitbucket.org/ianb/paste/src/30425672adf7/.hgtags there are two 1.7.4 tags? Wichert. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Is there a possible way to get a translator working into routing.py ?
On 2010-6-9 19:47, Gael Pasgrimaud wrote: On Wed, Jun 9, 2010 at 6:35 PM, danieldaniel...@orange.fr wrote: Hello I'm working on an i18n project with pylons. I would need using _ function from within routing.py If trying the following import into routing.py: from pylons.i18n.translation import _ I get an error upon a browser request sending : TypeError: No object (name: translator) has been registered for this thread Apparentely there is some object missing at that stage Any help is greatly appreciated I think that you can translate your urls at generation time: mapper('blog', '/{lang}/{slug}', controller=''...) Then in templates/python code: from pylons.i18n import get_lang url('blog', lang=get_lang(), slug=_(slug_var)) (dont remember if get_lang() return a string or a list of all accepted languages) What I found to be simpler is to leverage some route tricks. I have a route which looks like this: map.connect(shop_category, /shop/:category, controller=shop, action=category, conditions=dict(function=translate_incoming), _filter=translate_outgoing) def translate_incoming(environ, match_dict): # ... translate the URL data in matchdict to canonical language def translate_outgoing(match_dict): # ... translate the URL data in match_dict to target language that will allow you to use one canonical language everywhere in your code, and routes will call your two translation things when needed. Wichert. -- Wichert Akkerman wich...@wiggy.net It is simple to make things. http://www.wiggy.net/ It is hard to make things simple. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Is there a possible way to get a translator working into routing.py ?
On 6/10/10 13:19 , daniel wrote: thank you Wichert appreciate your help this is exactly what I did. My problem actually is how to import the _ function to use it within the translate_incoming(environ, match_dict) function You can't easily do that: at the time routing.py is run there is no active Pylons request, so the SOPs are not active. You'll need to manually register some objects there and configure the right language to use. Wichert. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Pylons and images from database
There is also transaction aware handling of files involved. Personally I do store images and generated scaled images separately on disk, but using repoze.filesafe for transaction integration. Wichert. On 2010-2-21 21:15, Stephan Ellis wrote: There are some advantages to having them in the database. Backups are just a database dump away, which is really easy if you are on mysql. Also, controlling access to files is the same as controlling access to anything else that comes out of the db. On Sun, Feb 21, 2010 at 2:12 PM, gazza burslem2...@yahoo.com mailto:burslem2...@yahoo.com wrote: Make sence. I will follow the kiss and keep it on the disc. Much appreciated the anwers. Gazza On Feb 21, 11:08 am, Thomas G. Willis tom.wil...@gmail.com mailto:tom.wil...@gmail.com wrote: It depends really, if you believe Oracle(or any database vendor), they claim serving file blobs from their database is more efficient then the filesystem and has the benefit of transactional integrity. At least that's how my day job rationalized storing images/pdf's and other things related to a patient chart in the database along with everything else that is stored. But I can see where this would be considered misuse of a database(when all you have a hammer, everything looks like a nail). I would say it's an exotic use of the db for sure. Not mention it's likely that your code will end up relying on more vendor specific api's for this which makes your code less portable. Nonethless, sqlalchemy has column types for binary data. http://www.sqlalchemy.org/docs/search.html?q=binarycheck_keywords=ye. http://www.sqlalchemy.org/docs/search.html?q=binarycheck_keywords=ye... On Sun, Feb 21, 2010 at 11:57 AM, gazza burslem2...@yahoo.com mailto:burslem2...@yahoo.com wrote: Why is this wrong? Is it performance? Much appreciated, Garyc On Feb 20, 6:58 pm, Jonathan Vanasco jonat...@findmeon.com mailto:jonat...@findmeon.com wrote: On Feb 20, 4:59 pm, Wyatt Baldwin wyatt.lee.bald...@gmail.com mailto:wyatt.lee.bald...@gmail.com wrote: I thought this was generally not recommended and that you should instead store the files on the file system with just the paths to the files in the database. That would be correct. -- 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 mailto:pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com mailto:pylons-discuss%2bunsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/pylons-discuss?hl=en http://groups.google.com/group/pylons-discuss?hl=en. -- Thomas G. Willis- Hide quoted text - - Show quoted text - -- 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 mailto:pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com mailto:pylons-discuss%2bunsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en. -- Wichert Akkerman wich...@wiggy.net It is simple to make things. http://www.wiggy.net/ It is hard to make things simple. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Can an app be debugged without constantly reloading the server?
On 2/16/10 08:26 , Jamie wrote: I know that the answer is probably no, but I wanted to ask it anyhow. I'm trying to find an IDE that works well with Pylons and currently evaluating both Wing and Komodo. I was spoiled years ago by Visual Studio's awesome debugging features and was hoping to get as close that as possible. My biggest hurdle now is that adding breakpoints or minor code edits require me to manually restart Paste. On my modestly-powered Windows notebook, each server restart takes about 10-15 seconds. It doesn't sound like much, but when I'm hunting down a bug, I can spend more time waiting to type code than I am actually typing. I can at least recommend this: paste serve --reload That will autotomatically restart paste if a source file or the .ini file changes, so at least you won't have to restart it manually. Wichert. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Lazy Registration
On 1/25/10 09:57 , Matt Woolnough wrote: The answer doesn't need to be pylons specific. I just happen to be using this framework, so this group seemed like a good place to start. I'm looking to store info thats a bit more complex than just a item number, so I'm considering storing temporary items created in guest sessions in a table along with items saved in users sessions. The temporary items would need to be flagged in someway in the DB cleaned out somehow Any thoughts? Beaker sessions. Wichert. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Can't get pylons to log in mod_python mode..
On 2009-12-8 23:20, Graham Dumpleton wrote: Paste server does special stuff to initialise the environment for logging. Arguably it shouldn't do this and any such initialisation should be a side effect of getting the root WSGI application object. What it means is that you have to perform the same initialisation somehow when using mod_python. For discussion of how to do that for mod_wsgi see: http://groups.google.com/group/pylons-discuss/browse_thread/thread/9b9add4529b3779c You will have to work out how to do the same for mod_python. The collective.recipe.modwsgi recipe for buildout does that for you. Wichert. -- Wichert Akkerman wich...@wiggy.net It is simple to make things. http://www.wiggy.net/ It is hard to make things simple. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Calling a controllers method from another method? Is there a 'safe' way without redirecting?
On 2009-12-7 22:21, Mike Orr wrote: On Mon, Dec 7, 2009 at 9:58 AM, Jonathan Vanascojonat...@findmeon.com wrote: mike- on the subject... does Pylons have a subrequest facility ? Some platforms , like mod_perl , offer it: http://perl.apache.org/docs/2.0/api/Apache2/SubRequest.html internal_redirect Redirect the current request to some other uri internally No. return self.othermethod() is the equivalent. I'm quite sure Paste has some API that allows you to do subrequests from Pylons. You could look at how middleware such as URLMapper or Deliverance handle that. Wichert. -- Wichert Akkerman wich...@wiggy.net It is simple to make things. http://www.wiggy.net/ It is hard to make things simple. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Python 3.1
On 11/2/09 16:00 , Mario Ruggier wrote: On Nov 2, 2009, at 3:41 PM, Wichert Akkerman wrote: On 11/2/09 15:28 , Mario Ruggier wrote: The (big) gain... is that Evoque can be sandboxed (i.e. let your untrusted user modify the template source!), a feature that no other templating system had *designed-in* from the start. You mean like Zope PageTemplates since its creation about 10 years ago? If you say so, I guess not ;-) Does ZPT allow embedding (most) python expressions? It allows Python expressions, and runs them in a special sandbox (see http://pypi.python.org/pypi/RestrictedPython ). Zope has always allowed untrusted people to use python in a secure manner. My impression is that ZPT was designed to primarily output X/HTML (altho I think it can be made to output arbitrary text- based formats) so I tend to think of it as a beast of a different kind, that is not comparable to mako/evoque class of text-based templating (performance would certainly not be comparable). Zope also ships with DTML (which is much older than ZPT) which is possibly more similar and possibly more comparable to text-based templating languages. You seem to imply that attribute-style languages such as ZPT (or Genshi/kid/meld/etc.) have to be slower than text-based languages. I think chameleon has proven that that is not the case: its zpt and genshi implementations are on par with Mako. Wichert. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Python 3.1
On 11/2/09 15:28 , Mario Ruggier wrote: The (big) gain... is that Evoque can be sandboxed (i.e. let your untrusted user modify the template source!), a feature that no other templating system had *designed-in* from the start. You mean like Zope PageTemplates since its creation about 10 years ago? Wichert. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: pylons with chameleon?
On 2009-9-25 22:55, Iain Duncan wrote: Hm, the chameleon.zpt template has not seen as much love as the chameleon.genshi version so it might have broken somewhere. Can you test if chameleon.genshi works for you? If so I'll look at fixing up the chameleon.zpt version. Thanks, Chameleon genshi is working with your correction. Is the plan for chameleon to eventually be able to support both genshi and tal attributes at the same time or will it always be an either or? My correction was in chameleon.zpt. chameleon.genshi has always had a working template loader. As far as I know there are no plans to support both Genshi and Page Template syntax in the same file, and I have to admit that I personally do not see any real benefits to doing that. chameleon.zpt does go a little bit beyond the official zpt standards though: it also supports ${...} expansions, similar to Genshi templates. Wichert. -- Wichert Akkerman wich...@wiggy.net It is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: pylons with chameleon? unescaping HTML
On 2009-9-26 00:45, Iain Duncan wrote: Hm, the chameleon.zpt template has not seen as much love as the chameleon.genshi version so it might have broken somewhere. Can you test if chameleon.genshi works for you? If so I'll look at fixing up the chameleon.zpt version. I've got the genshi templates being rendered, but I don't seem to be able to use HTML() or XML() to unescape html tags if the values being injected into the template are xhtml. Can anyone tell me what I need to do to display HTML properly within a genshi template rendered by chameleon, or why the HMTL function is not available? Same system as Mako uses: it checks for a __html__ method. If you use pylons that means you can use webhelpers.html.literal to indicate a string should not be escaped. For example: from webhelpers.html import literal def my_func_in_lib_helpers(): return literal(uHello, emworld/em!) Wichert. -- Wichert Akkerman wich...@wiggy.net It is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: pylons with chameleon?
On 2009-9-26 21:10, Thomas G. Willis wrote: On Sep 26, 10:14 am, Wichert Akkermanwich...@wiggy.net wrote: On 2009-9-25 22:55, Iain Duncan wrote: Hm, the chameleon.zpt template has not seen as much love as the chameleon.genshi version so it might have broken somewhere. Can you test if chameleon.genshi works for you? If so I'll look at fixing up the chameleon.zpt version. Thanks, Chameleon genshi is working with your correction. Is the plan for chameleon to eventually be able to support both genshi and tal attributes at the same time or will it always be an either or? My correction was in chameleon.zpt. chameleon.genshi has always had a working template loader. As far as I know there are no plans to support both Genshi and Page Template syntax in the same file, and I have to admit that I personally do not see any real benefits to doing that. chameleon.zpt does go a little bit beyond the official zpt standards though: it also supports ${...} expansions, similar to Genshi templates. Wichert. -- Wichert Akkermanwich...@wiggy.net It is simple to make things.http://www.wiggy.net/ It is hard to make things simple. I was just playing with this and it seems that the genshi syntax is somewhat limited. Is that correct? For example, including a site page just like this example from gensh blows up. http://genshi.edgewall.org/wiki/GenshiTutorial#AddingaLayoutTemplate And even though I know it's not good practice to do the whole? python ? thing, chameleon seems to blow up on this as well. To be more precise: chameleon.genshi implements the Genshi XML template syntax as described in http://genshi.edgewall.org/wiki/Documentation/0.5.x/xml-templates.html . ?python is not a part of that syntax. That tutorial does not work due to a limitation chameleon.genshi currently has: match templates defined in included templates are not applied to the calling document. That is documented at http://pypi.python.org/pypi/chameleon.genshi. If enough people ask Malthe if he can add support for that might be fixed :) Wichert. -- Wichert Akkerman wich...@wiggy.net It is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: pylons with chameleon?
On 2009-9-24 07:53, Iain Duncan wrote: In Sat, 2009-09-19 at 09:40 +0200, Wichert Akkerman wrote: On 2009-9-16 21:06, Iain Duncan wrote: Hi folks, I have not built enough pylons to be know how to switch templating languages beyond mako and genshi, but I'm interested in using Chameleon. Has anyone got any examples up of what one needs to do to use Chameleon? Thanks Wichert, I've hit some problems here, and muddled along a bit, if you ( or someone ) can check this that would be great. In config/environment.py: from genshi.template import TemplateLoader as GenshiTemplateLoader Doh, that line should have read: from chameleon.genshi.loader import TemplateLoader I assume I'm also supposed to add?? from chameleon.zpt.loader import TemplateLoader That depends. Personally I use chameleon.genshi since I prefer Genshi syntax over zpt. If you want to use the Zope page template syntax you'll want to replace chameleon.zpt. def load_environment(global_conf, app_conf): ... ... # Create the chameleon TemplateLoader config['pylons.app_globals'].pt_loader = TemplateLoader( paths['templates'], auto_reload=True) Add a new file in lib (mine is called lib/pt.py): from pylons.templating import pylons_globals from pylons.templating import cached_template def render_pt(template_name, cache_key=None, cache_type=None, cache_expire=None): Render a page template with z3c.pt. def render_template(): globs = pylons_globals() template = globs[app_globals].pt_loader.load(template_name) return template(**globs) return cached_template(template_name, render_template, cache_key=cache_key, cache_type=cache_type, cache_expire=cache_expire) def render_text(template_name, cache_key=None, cache_type=None, cache_expire=None): Render a text template with z3c.pt. def render_template(): globs = pylons_globals() template = globs[app_globals].pt_loader.load(template_name, format=text) return template(**globs) return cached_template(template_name, render_template, cache_key=cache_key, cache_type=cache_type, cache_expire=cache_expire) you can then use render_pt to render html/xml templates, and render_text to render text templates, exactly like you use other templating languages. I copied the above in, and imported render_pt from lib/pt.py, but when I try to render a template like so: (in a controller) def zpt(self): test of using zpt templates return render_pt(mytemplate.pt) I get the following traceback, any help much appreciated. File '/home/ymh/pylons_full/pylons_full/controllers/peek.py', line 50 in zpt File '/home/ymh/pylons_full/pylons_full/lib/pt.py', line 15 in render_pt cache_key=cache_key, cache_type=cache_type, cache_expire=cache_expire) File '/home/ymh/lib/python2.5/site-packages/Pylons-0.9.7-py2.5.egg/pylons/templating.py', line 249 in cached_template return render_func() File '/home/ymh/pylons_full/pylons_full/lib/pt.py', line 11 in render_template template = globs[app_globals].pt_loader.load(template_name) File '/home/ymh/lib/python2.5/site-packages/chameleon.zpt-1.0.0-py2.5.egg/chameleon/zpt/loader.py', line 11 in load template.PageTemplateFile) File '/home/ymh/lib/python2.5/site-packages/chameleon.core-1.0.0-py2.5.egg/chameleon/core/loader.py', line 8 in load self.registry[args] = template = func(self, *args) File '/home/ymh/lib/python2.5/site-packages/chameleon.core-1.0.0-py2.5.egg/chameleon/core/loader.py', line 39 in load path, self.parser, auto_reload=self.auto_reload) TypeError: __init__() takes exactly 2 non-keyword arguments (3 given) Hm, the chameleon.zpt template has not seen as much love as the chameleon.genshi version so it might have broken somewhere. Can you test if chameleon.genshi works for you? If so I'll look at fixing up the chameleon.zpt version. Wichert. -- Wichert Akkerman wich...@wiggy.net It is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: pylons with chameleon?
On 2009-9-16 21:06, Iain Duncan wrote: Hi folks, I have not built enough pylons to be know how to switch templating languages beyond mako and genshi, but I'm interested in using Chameleon. Has anyone got any examples up of what one needs to do to use Chameleon? In config/environment.py: from genshi.template import TemplateLoader as GenshiTemplateLoader def load_environment(global_conf, app_conf): ... ... # Create the chameleon TemplateLoader config['pylons.app_globals'].pt_loader = TemplateLoader( paths['templates'], auto_reload=True) Add a new file in lib (mine is called lib/pt.py): from pylons.templating import pylons_globals from pylons.templating import cached_template def render_pt(template_name, cache_key=None, cache_type=None, cache_expire=None): Render a page template with z3c.pt. def render_template(): globs = pylons_globals() template = globs[app_globals].pt_loader.load(template_name) return template(**globs) return cached_template(template_name, render_template, cache_key=cache_key, cache_type=cache_type, cache_expire=cache_expire) def render_text(template_name, cache_key=None, cache_type=None, cache_expire=None): Render a text template with z3c.pt. def render_template(): globs = pylons_globals() template = globs[app_globals].pt_loader.load(template_name, format=text) return template(**globs) return cached_template(template_name, render_template, cache_key=cache_key, cache_type=cache_type, cache_expire=cache_expire) you can then use render_pt to render html/xml templates, and render_text to render text templates, exactly like you use other templating languages. Wichert. -- Wichert Akkerman wich...@wiggy.net It is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Enabling logging for collective.recipe.modwsgi
Hi Phil, On 8/7/09 10:31 , Kershaw, PJ (Philip) wrote: Hi Wichert, I've been making use of your modwsgi buildout recipe for sometime now - thanks :) ... but have been wondering about the best way to integrate logging capability into the WSGI script that's generated. Looking at: http://groups.google.com/group/pylons-discuss/browse_thread/thread/9b9add4529b3779c?pli=1 I can do something like this to enable the logging configuration to be picked up from my ini file: from paste.deploy import loadapp from paste.script.util.logging_config import fileConfig configFilePath = /usr/local/myapp/etc/myapp.ini fileConfig(configFilePath) application = loadapp(config:+configFilePath) In your buildout recipe code I could override the default WRAPPER_TEMPLATE or is there a way I could do it via an option in my buildout config? I could not see a reason not to do this by default, so I changed the template wrapper in collective.recipe.modwsgi and released a new version 1.2 with this change. Thanks for the feedback! Wichert. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Launching a background process
On 7/27/09 8:40 AM, Graham Dumpleton wrote: On Jul 27, 2:07 pm, Dave Forgactylerd...@gmail.com wrote: I am trying to write an application that will allow a user to launch a fairly long-running process (5-30 seconds). It should then allow the user to check the output of the process as it is generated. The output will only be needed for the user's current session so nothing needs to be stored long-term. I have two questions regarding how to accomplish this: 1. What is the best way to launch a background process such as this with a Pylons controller? 2. What is the best way to get the output of the background process back to the user? Often the better way of doing this is to run a separate persistent long running process which has an XML-RPC interface and have the web application communicate with the back end process using XML-RPC. This avoids all the mess that can often occur with forking off a web application process. zc.async (see http://packages.python.org/zc.async/1.5.0/ ) might also be interesting. Wichert. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Authkit vs repoze.who for openid
On 7/19/09 8:57 PM, Dalius Dobravolskas wrote: Damjan wrote: 2) Your server should remember somehow who and when initiated OpenID request. So it create OpenID session and saves it to database (OpenID session usually is encoded into return URL); I can remember that in the http session (which could be Beakers secure cookie) I guess that's not the most secure thing to do but if you want you could try to write your own OpenID implementation. It might be possible that I have oversimplified everything and there are more steps to make OpenID secure. I really doubt that OpenID authors were that stupid so they have not thought about secure cookies ;-) It's a prefectly valid thing to do, and I do not see why you should not do that. The standard python openid implementation encourages this type of approach by making the store pluggable. Wichert. -- Wichert Akkerman wich...@wiggy.net It is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Authkit vs repoze.who for openid
On 7/19/09 10:08 PM, Damjan wrote: I guess that's not the most secure thing to do but if you want you could try to write your own OpenID implementation. It might be possible that I have oversimplified everything and there are more steps to make OpenID secure. I really doubt that OpenID authors were that stupid so they have not thought about secure cookies ;-) It's a prefectly valid thing to do, and I do not see why you should not do that. The standard python openid implementation encourages this type of approach by making the store pluggable. what's the The standard python openid implementation ? http://openidenabled.com/python-openid/ Wichert. -- Wichert Akkerman wich...@wiggy.net It is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Logging example in Windows (lama)
Previously durumdara wrote: Can I get some callback that starts at/before every requests where I can log everything what I need? Write a tiny bit of WSGI middleware? Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: deploying to production?
Previously Chris Withers wrote: * I'd like to be using buildout for things wherever possible, the following is what I have so far: [buildout] parts = pylons develop = myproj [pylons] recipe = zc.recipe.egg eggs = Pylons PasteScript myproj myproj should depend on Pylons and PasteScript, so don't list them here. You will need to use dependent-scripts = true to get bin/paster generated. If you want to deploy using mod_wsgi you can use the collective.recipe.modwsgi buildout recipe. Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: using buildout with pylons
Previously Chris Withers wrote: Hi All, I found this: http://wiki.pylonshq.com/display/pylonscommunity/Howto+install+Pylons+with+buildout ...which looks nice and straight forward. However, I've been having some problems. If I do *exactly* what's on that page, it works, so I guess I must have an issue at my end. BUT, one thing I have noticed so far is that after running buildout, I end up with eggs for Paste, PasteDeploy and PasteScript in pylons_buildout/myproject, which is wrong. Everything in setup_requires and test_requires is installed there, and buildout can't prevent that. As a workaround you can move those dependencies to install_requires. Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: using buildout with pylons
Previously Chris Withers wrote: Wichert Akkerman wrote: BUT, one thing I have noticed so far is that after running buildout, I end up with eggs for Paste, PasteDeploy and PasteScript in pylons_buildout/myproject, which is wrong. Everything in setup_requires and test_requires is installed there, Why? and buildout can't prevent that. Again, why? setuptools internals do that, and buildout has no influence over that as far as I know. If you want to discuss that distutils-sig is the right list. Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: app engine - state of play - 0.9.7
Previously Wichert Akkerman wrote: Previously Ben Bangert wrote: On May 3, 2009, at 7:42 AM, Wichert Akkerman wrote: And it's not limited to GAE; interactive traceback hasn't work for me for a month or so. It hasn't? What is happening instead? I click on the + and get a javascript error. I noticed something interesting today: interactive traceback does not work with Firefox 3.5b4, but works fine with Safari 4 beta. Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: app engine - state of play - 0.9.7
Previously Ben Bangert wrote: On May 3, 2009, at 7:42 AM, Wichert Akkerman wrote: And it's not limited to GAE; interactive traceback hasn't work for me for a month or so. It hasn't? What is happening instead? I click on the + and get a javascript error. Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: app engine - state of play - 0.9.7
Previously Ben Bangert wrote: On May 6, 2009, at 12:54 AM, Wichert Akkerman wrote: I click on the + and get a javascript error. What type of environment? What wsgi server? I can see why it wouldn't work under GAE, since there's no guarantee you'll get back to the same process (it relies on a *single* long-lived process to ask for more debug info). A pretty standard environment: OSX, python2.5, paster, pylons 0.9.7. It could be a result of using chameleon.genshi, although it worked fine with chameleon a while ago. Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: app engine - state of play - 0.9.7
Previously Mike Orr wrote: On Sat, May 2, 2009 at 1:21 PM, Mike Orr sluggos...@gmail.com wrote: On Sat, May 2, 2009 at 6:34 AM, David Wilson david.wil...@entertainmentcloud.com wrote: I could not seem to get the debugger to work (vital for consideration) The problem with the interactive traceback seems to be due to the middleware disabling itself because of something in the runtime environment -- some situation that wasn't foreseen when the middleware was written. We just have to figure out what exactly that is and patch the middleware to work with App Engine. Also, whatever broke is something recent, because the interactive traceback was working on App Engine a few months ago. And it's not limited to GAE; interactive traceback hasn't work for me for a month or so. Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Plugin architecture
Previously Mike Orr wrote: The most difficult problem seems to be controllers, and the 'controller_scan' argument in Routes which seems useless. (We had to hardcode the controllers in our GUI BILS app because of some incompatibility with py2exe.) Several people have asked how to have controllers in various packages and then pull in a selection of them. The simplest method is stub modules in the controllers directory that import the actual controllers. But maybe we can find something more flexible. If you decide to use zope.component a controller could be a named utility. You could then register it like so: class BaseController(object): This is the standard Pylons base controller class. implements(IPylonsController) class MyController(BaseController): My very own controller. registerUtility(MyController, name=my_controller) and Pylons could get a list of all utilities using something like this: controllers = getUtilitiesFor(IPylonsController) This prevents the need to skin directories as currently happens, and will allow you to put your controllers anywhere you want. You can also selectively do the registerUtility calls, override already registered controllers or remove controller registrations. Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Plugin architecture
Previously Ben Bangert wrote: On Apr 28, 2009, at 2:43 PM, Wichert Akkerman wrote: If you decide to use zope.component a controller could be a named utility. You could then register it like so: class BaseController(object): This is the standard Pylons base controller class. implements(IPylonsController) class MyController(BaseController): My very own controller. registerUtility(MyController, name=my_controller) Yikes! :) Why the yikes? The only change for a Pylons user is adding a single line to register the controller. The interface that is used to manage the registrations can be hidden in the BaseController class and internal pylons logic - people may never need to know about it. This gives you a lot of extra flexbility and pluggability, at the expense of asking people to add a single line of code for each controller. Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: updating database schema
Previously Ross Vandegrift wrote: On Wed, Apr 22, 2009 at 12:36:09AM -0700, Richard Jones wrote: Is there a way to access the database directly, so that I can manually re-jig the database. Or do I have to provide an update script each time i change the schema? (and if so, how?) I have a very low-tech solution. I never use table reflection, all table layouts are explicit in my code. If I deploy a new version that requires schema changes and forget to update the database schema manuall, Pylons will throw me an error on any hit since the model won't be able to load. :) Unless you change a constraint or index. Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: best ways to test ?
Previously Marius Gedminas wrote: Testing JavaScript is a bit harder. I've seen how people integrate JavaScript *unit* tests into their py.test test suite, and I've used those ideas to define a unittest.TestCase subclass that spawns a browser window and drives it to run JsUnit-compatible test suites in Firefox or MSIE (under WINE, no idea if it would work in a real Windows OS). This is not, however, a real integration test involving a real browser and your app. Guido Wesdorp wrote a basic javascript emulator in Python which you can use to test javascript in webpages from your python tests. I haven't tried it, but at the concept is very interesting. Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: What I've learned deploying pylons
Previously Wyatt Baldwin wrote: Questions: Which versions of supervisor and Python are ya'll using together? Should I go for supervisor 2.1 or 2.2b1 or 3.0a6 or ...? Everyone is running 3.0a6 as far as I know. Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: CMS/CMF on top of Pylons
Previously Mike Orr wrote: On Sun, Mar 22, 2009 at 5:29 AM, Raoul Snyman raoul.sny...@gmail.com wrote: You want a CMS? Use Drupal. You want to develop a web application? Use Pylons. Except that some applications may need a drop-in CMS for a section of the application. You can supposedly embed Plone as a WSGI application but I don't know anybody who has tried it. I think OpenPlans is doing that. You can run Plone 3 as a WSGI application using Repoze, and Plone trunk is WSGI by default. Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
pylonshq issue tracker disappeared
I'm not sure if anyone already noticed, but at the risk of repeating the message: the issue tracker on pylonshq.com no longer works. All relevant URLs return a 404. Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Beaker repeats every get
I was looking a bit at the memcache handling and noticed something odd: all requests were repeated. For example: 11 get tostyle4you.lib.helpers_image_url_by_id·scale=scale56·id=None 11 sending key tostyle4you.lib.helpers_image_url_by_id·scale=scale56·id=None 11 END 11 get tostyle4you.lib.helpers_image_url_by_id·scale=scale56·id=None 11 sending key tostyle4you.lib.helpers_image_url_by_id·scale=scale56·id=None 11 END I tracked the cause down to the get_value code from the Beaker container, which looks like this: 222 def get_value(self): 223 self.namespace.acquire_read_lock() 224 try: 225 has_value = self.has_value() 226 - if has_value: 227 value = self.__get_value() has_value and __get_value execute the same memcache get command, so a cache hit always results in two identical queries. Is there a reason Beaker can't roll has_value and get_value in one call? Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Sqlalchemy: querying table in different functions gives different results
Previously Bryan wrote: 1. Client calls login(), a new row is inserted in the token table. 2. Client calls anotherFunction and the new row is not visible inside that function 3. If I place a Session.commit() in anotherFunction, then I can see the row def login(self, user, pass): ' Create new login entry that gives the client an id to pass back to the server with each request newtoken = Token() Session.add(newtoken) Session.flush() Session.commit() ' Querying token table at this point shows all the tokens including the newly added one def anotherFunction(self, tokenId): ' If I list all rows in the token table at this point, the token created in login() is not visible ' If I have a Session.commit() call before I query however, the row is visible Other details: This is in an XMLRPCContoller. I have a scoped_session setup. Why is the second function looking at a stale version of the table? Because you haven't flushed the changes to the database. This is well documented in the SQLAlchemy documentation. Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Caching in auth middleware
I have what I suspect is a reasonably common setup with a repoze.who middleware for authentication, followed by transaction, routes, session, cache, registry manager and pylons middlewares. In some cases you want to use a cache in authentication middleware to prevent a SQL server hit on every request. Not completely unexepctedly that immediately aborts on No object (name: cache) has been registered for this thread. Strangely enough moving the registry and cache middlewares up to be before the auth middleware did not help: I got the exact same error. Is there some magic in pylons that I'm missing? Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Caching in auth middleware
Previously Wichert Akkerman wrote: I have what I suspect is a reasonably common setup with a repoze.who middleware for authentication, followed by transaction, routes, session, cache, registry manager and pylons middlewares. In some cases you want to use a cache in authentication middleware to prevent a SQL server hit on every request. Not completely unexepctedly that immediately aborts on No object (name: cache) has been registered for this thread. Strangely enough moving the registry and cache middlewares up to be before the auth middleware did not help: I got the exact same error. Is there some magic in pylons that I'm missing? Of course just after sending this I figured out what it was. In case this is useful for others: I solved this by adding a tiny bit of middleware which registers the beaker cache. class CacheRegisteringApp(object): def __init__(self, app): self.app=app def __call__(self, environ, start_response): from pylons.util import PylonsContext import pylons context = PylonsContext() context.cache = environ[beaker.cache] environ[2s4u.context] = context registry = environ['paste.registry'] registry.register(pylons.cache, context.cache) return self.app(environ, start_response) Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
changes from rc4 to rc5
Is there a summary of the changes between rc4 and rc5? Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: changes from rc4 to rc5
Previously Ben Bangert wrote: - Beaker has been updated since the last release to fix several bugs involving memcached, and how it stores session data Does that mean that it is now possible to use memcache for beaker sessions? Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: beaker_cache query_args when duplicate queries are in
Previously Philip Jenvey wrote: I just applied a fix that now correctly handles eleith's issue with duplicate query params, and always includes the function name regardless of the key type specified. A fix was made about a month ago to make it work everywhere (not just controller actions) again. That has not yet made it into a release though. Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: beaker_cache query_args when duplicate queries are in
Previously Philip Jenvey wrote: I just applied a fix that now correctly handles eleith's issue with duplicate query params, and always includes the function name regardless of the key type specified. I think you also need to add the class name if you get a bound function: you may very well have the same function name in multiple classes in the same source file. I also found another problem in the determination of the cache key: default function arguments were not handled correctly. I've filed that under http://pylonshq.com/project/pylonshq/ticket/568 along with a fix. Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: beaker_cache query_args when duplicate queries are in
On 2/11/09 11:12 PM, Philip Jenvey wrote: The class's name and module name are used for the cache's namespace, which'll prevent clashes. For normal functions just the function's module name is used for the namespace. Looking at this again maybe the class name should be in the key instead of the namespace, but that's not a big deal. By the time you read this an rc5 will likely be out with all these fixes. Thanks! I'm looking forward to it. Wichert. -- Wichert Akkermanwich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: beaker_cache query_args when duplicate queries are in
Previously eleith wrote: My solution was to write my own decorator. could you share your decorator? For what it's worth below is my variant of beaker_cache. It has the advantage over the stock version that it works everywhere instead of only for controller methods and will never try to cache response headers. The only missing feature I can think of is a simple way to add request headers to the cache key. That is trivial to add, but not needed for my current projects so I haven't added that. Wichert. def timed(expire=None, invalidate_on_startup=False, **b_kwargs): Cache decorator utilizing Beaker. Caches action or other function that returns a pickle-able object as a result. Optional arguments: ``expire`` Time in seconds before cache expires, or the string never. Defaults to never ``invalidate_on_startup`` If True, the cache will be invalidated each time the application starts or is restarted. If cache_enabled is set to False in the .ini file, then cache is disabled globally. if invalidate_on_startup: starttime = time.time() else: starttime = None def wrapper(func, *args, **kwargs): Decorator wrapper enabled = pylons.config.get(cache_enabled, True) if not asbool(enabled): log.debug(Caching disabled, skipping cache lookup) return func(*args, **kwargs) key_dict=kwargs.copy() key_dict.update(_make_dict_from_args(func, args)) cache_key = .join([%s=%s % (k, v) for k, v in key_dict.iteritems()]) if hasattr(func, im_class): namespace=%s.%s.%s % (func.__module__, func.im_class.__name__, func.__name__) else: namespace=%s.%s % (func.__module__, func.__name__) my_cache = pylons.cache.get_cache(namespace, **b_kwargs) def create_func(): log.debug(Creating new cache copy with key: %s, cache_key) return func(*args, **kwargs) return my_cache.get_value(cache_key, createfunc=create_func, expiretime=expire, starttime=starttime) return decorator(wrapper) -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: is there a way to call render with string teamplates?
Previously Dalius Dobravolskas wrote: Hello, On Fri, Feb 6, 2009 at 9:03 PM, Jonathan Vanasco jonat...@findmeon.comwrote: ie -- instead of passing in a file, passing in a string? the only way i can think of this right now is with a tmpfile, and i'd like to avoid that. I'm pretty sure that methods must return string and that's the only requirement on them. Or string-like things. If you want to have the option of doing transformation on the output rendering to XML doms and returning repoze.xmliter (see http://repoze.org/viewcvs/repoze.xmliter/trunk/README.txt?rev=2839view=auto) instances is quite interesting. Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Is Django more popular than Pylons?
Previously Gael Pasgrimaud wrote: Here it is: http://www.gawel.org/howtos/howto-install-pylons-with-buildout It might be useful to document using collective.recipe.modwsgi as well. That makes it trivial to use pylons with mod_wsgi from a buildout environment. Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: FormEncode and International Languages
Previously Jonathan Vanasco wrote: fair on some points, i disagree with others. i'm in the US. the formencode author seems to be as well. 'internationalization' on most things seems to be limited to swapping in text. There is internationalization and localization. You need to deal with both. many of the checks, such as PlainText allow for only a subset of ascii. Which subset would that be? Your example of é falls well outside of ASCII. anything else trips an error. short of making everything a unicode string (which I aready had done) - i'm specifically wondering how people are handling validating different form elements with these shortcomings. Without concrete examples of things that break there is little we can tell you. Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: FormEncode and International Languages
Previously Gustavo Narea wrote: On Monday January 26, 2009 23:20:37 Jonathan Vanasco wrote: Our project is dealing with a lot of French writers typing things like é , which fails many formencode tests. There is nothing special about the occasional accent in French: French is much simpler than, for example, Chinese. Use UnicodeString instead of String: http://www.formencode.org/class-formencode.validators.UnicodeString.html I don't think the problem will be present on other validators -- at least I guess so. OneOf can't deal with non-ascii values if I remember correctly. I have an open ticket in a project related to that. Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: console tools
Previously Mike Orr wrote: On Fri, Jan 23, 2009 at 12:31 AM, cropr ruben.dec...@gmail.com wrote: I want to add some administrative console tools next to my 0.9.7 Pylons application (e.g. a backup/restore). I want to make use of some parameter settings in the development.ini or production.ini, but I don't need any wsgi stuff. What is the best and easiest way to start up the console application The easiest way is to make a package for your scripts and run them with python -m; e.g., python -m myapp.scripts.maintain development.ini . A more difficult way is to create paster plugins, but these will only be available if the current directory is the application. I'm not sure it is more difficult. Here is an example :). Lets start by creating a base class which does the basic Pylons setup work so we can use Pylons tools in our commandline script: from paste.deploy import loadapp, appconfig from paste.script.command import Command class PylonsCommand(Command): group_name = 2style4you min_args=1 max_args=1 def _SetupPylons(self): Perform some magic setup work. config_name = config:%s % self.args[0] self.logging_file_config(self.args[0]) cwd=os.getcwd() conf=appconfig(config_name, relative_to=cwd) conf.update(dict(app_conf=conf.local_conf, global_conf=conf.global_conf)) self.wsgiapp=loadapp(config_name, relative_to=cwd) We can now write the code for a simple command: class MyExampleCommand(PylonsCommand): summary=Summary shown in paster command listing usage=\nExtra help text shown by paster help command parser=PylonsCommand.standard_parser() def command(self): self._SetupPylons() session=meta.Session() # Do your work here session.commit() If you need to handle commandline arguments you register those with the parser class variable: class MyExampleCommand(PylonsCommand): summary=Summary shown in paster command listing usage=\nExtra help text shown by paster help command parser=PylonsCommand.standard_parser() parser.add_option(-u, --url, dest=url, default=None, help=Use a different URL for our data) The result is available via self.options. To make your command available create an entry point so paster picks it up. In your setup.py do something like this: entry_points= [paste.paster_command] controller = pylons.commands:ControllerCommand restcontroller = pylons.commands:RestControllerCommand mycommand = myapp.commands:MyExampleCommand You can now call it like this: paster mycommand development.ini Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Webtest doesn't like 204 response with Content-Type header
Previously Chris Miles wrote: That is fair enough, but if the controller returns no content (None or for instance) would it make sense to not set any Content-Type (and related) headers? At the very least you have to send a Content-Length: 0 header. If you don't some proxies get confused and some browsers will spin forever waiting for data to arrive. Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: running a controller method outside wsgi app
Previously Roberto Allende wrote: Wichert Akkerman escribió: Previously Dalius Dobravolskas wrote: Hello, On Mon, Jan 19, 2009 at 7:44 AM, Roberto Allende ro...@menttes.com wrote: My motivation is to write a unit testing but even in other cases it could have sense to use a controller function isolated. Or at least in my case, this is the only restriction. If your intention is unit-testing do it Pylons way: http://wiki.pylonshq.com/display/pylonsdocs/Unit+Testing That is not unit testing, that is functional testing. If you want to unit test your controller and run it in isolation you need to do a bit of setup work in your test case. I use this: Thanks a lot Wiggy, your mails were very helpful. Although, it seems we're using different versions of Pylons (or i'm doing smt wrong) because following your approach i also needed wsgiapp variables Buffet, g and session at least. Just for the record, i'm using 0.9.6.2. I'm using 0.9.7rc5, so there are bound to be some differences. Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: running a controller method outside wsgi app
Previously Dalius Dobravolskas wrote: On Mon, Jan 19, 2009 at 9:34 AM, Wichert Akkerman wich...@wiggy.net wrote: Previously Dalius Dobravolskas wrote: Hello, On Mon, Jan 19, 2009 at 7:44 AM, Roberto Allende ro...@menttes.com wrote: My motivation is to write a unit testing but even in other cases it could have sense to use a controller function isolated. Or at least in my case, this is the only restriction. If your intention is unit-testing do it Pylons way: http://wiki.pylonshq.com/display/pylonsdocs/Unit+Testing That is not unit testing, that is functional testing. What's the difference except that your way might be a little bit more-efficient (like 20%)? I have seen several different ways of unit-testing pylons applications but basically they just help to do the same. What makes unit-testing functional testing in your opinion? I run the controller method in isolation, which means: - no other middleware that influences the result - I can put stuf in c before I call the controller method, and introspect c afterwards - no paste.fixture or WebTest influencing the result with a unittest you want to call something in isolation, without anything else being present. This is the only way to do that. Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: running a controller method outside wsgi app
Previously Dalius Dobravolskas wrote: Hello, On Mon, Jan 19, 2009 at 7:44 AM, Roberto Allende ro...@menttes.com wrote: My motivation is to write a unit testing but even in other cases it could have sense to use a controller function isolated. Or at least in my case, this is the only restriction. If your intention is unit-testing do it Pylons way: http://wiki.pylonshq.com/display/pylonsdocs/Unit+Testing That is not unit testing, that is functional testing. If you want to unit test your controller and run it in isolation you need to do a bit of setup work in your test case. I use this: from unittest import TestCase from paste.registry import Registry import pylons from pylons.util import ContextObj from pylons.controllers.util import Request class MockTranslator: def ugettext(self, value): return value class PylonsTestCase(TestCase): A basic test case which allows access to pylons.c and pylons.request. def setUp(self): self.registry=Registry() self.registry.prepare() self.context_obj=ContextObj() self.registry.register(pylons.c, self.context_obj) self.request_obj=Request(dict(HTTP_HOST=nohost)) self.registry.register(pylons.request, self.request_obj) self.translator_obj=MockTranslator() self.registry.register(pylons.translator, self.translator_obj) If you just need database access you can use this: class DatabaseTestCase(TestCase): def setUp(self): init_model(meta.engine) meta.metadata.create_all(meta.engine) def tearDown(self): meta.Session.remove() meta.metadata.drop_all(meta.engine) and if you need both just inherit from both classes (and call setUp from both). Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Unicode routes
Previously Mark Ramm wrote: URIs can be UTF-8 with standard URL %-escaping - most browsers will decode (and encode) that automatically and show the unicode string in the address bar. That is especially important for languages with a non-latin character set: without this URLs are horrible for them. It would be awesome if routes supported this natively, even if only as an option, because lots of international URL's are much cleaner with it than they would be without it. If you work with Asian companies it's pretty much a hard requirement these days. Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Unicode routes
I am trying to use unicode URLs and routes, but as far as I can see routes does not quite support this at the moment: generating a route with a non-ascii component fails (see http://routes.groovie.org/trac/routes/ticket/85) and incoming requests data is return as ASCII strings, not decoded unicode strings. This contradicts the routes manual (http://routes.groovie.org/manual.html#unicode) which appears to say this should work fine. Is anyone using unicode routes succesfully? Is there a trick that I'm missing somewhere? Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Unicode routes
Previously Dalius Dobravolskas wrote: Hello, (see http://routes.groovie.org/trac/routes/ticket/85) The first impression about this ticket is that non unicode and non utf-8 encoded string was passed to routes. Most probably string was in some local encoding. That's only my impression. I wonder why this ticket is still open. Maybe routes authors think about using encoding prediction function from feedparser. It's still open because I only just submitted it :) I only pass unicode data to Pylons' redirect_to method, which calls routes' url_for with only unicode parameters. Inside there everything is encoded to utf-8 and then breaks. Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: category support for flash
Previously Mike Orr wrote: On Fri, Dec 19, 2008 at 11:57 AM, Wichert Akkerman wich...@wiggy.net wrote: Often it is very useful to have flash/status messages of several different types, for example to be able to differentiate between informational messages, warnings and errors. To do that I made a simple extension to WebHelpers to add category support to its Flash class. The change is completely backwards compatible, so if you do not need categories you will never notice them. Patch attached. Opened a ticket for it. http://pylonshq.com/project/pylonshq/ticket/551 As soon as 0.9.7 is out I can put it in a point release. If you could write a little howto about using it with Ajax and styling different categories, I'm sure it would help a fair number of people. Certainly. Shall I put that text and the relevant javascript code in that ticket as well? Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: category support for flash
) { button.removeClass(processing); ShowJSONResponse(data); }, error: function(request, status, error) { button.removeClass(processing); ShowMessage(JSON call failed, error); } }); return false; }); }); /script This sets up a simple form which can be submitted normally by non-javascript enabled browsers. If a user does hava javascript an AJAX call will be made to the server and the result will be shown in a message. While the call is active the button will be marked with a *processing* class. The server can return a message by including a ``message`` field in its response. Optionally a ``message_category`` field can also be included which will be used to determine the message category. For example:: @jsonify def handler(self): .. .. return dict(message=uSettings succesfully updated) -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Opinion sought on example.com/username
Previously ED209 wrote: I'm planning on moving my users' profile pages to: example.com/:username but there has been some discussion amongst fellow developers that this might cause problems. I would have this route and subsequent routes as the last ones defined in my array of routes defenitions so any static routes would be matched first. What if at some point in the future you need a new static route and a user already registered with that username? Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Flickr tutorial under 0.9.7?
Previously Matt Feifarek wrote: On Wed, Dec 17, 2008 at 6:19 PM, Ben Bangert b...@groovie.org wrote: I've updated the front page in the codebase which will soon be up at http://beta.pylonshq.com/, to properly reflect what's in Pylons 0.9.7. Should be deployed there shortly. I'm also getting most of the links fixed up so the site can be ready for launch with 0.9.7 final rather soon. Wow, Ben, the new site looks GREAT! Well done. Indeed. And curious wants to know: is that a Pylons-powered CMS? It looks like one.. Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
category support for flash
Often it is very useful to have flash/status messages of several different types, for example to be able to differentiate between informational messages, warnings and errors. To do that I made a simple extension to WebHelpers to add category support to its Flash class. The change is completely backwards compatible, so if you do not need categories you will never notice them. Patch attached. Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~--- diff -wurN WebHelpers-0.6.4/webhelpers/pylonslib.py WebHelpers/webhelpers/pylonslib.py --- WebHelpers-0.6.4/webhelpers/pylonslib.py 2008-12-01 23:59:25.0 +0100 +++ WebHelpers/webhelpers/pylonslib.py 2008-12-19 20:52:10.0 +0100 @@ -9,6 +9,17 @@ # modules should be importable on any Python system for the standard # regression tests. +class Message(object): +def __init__(self, category, message): +self.category=category +self.message=message + +def __str__(self): +return self.message + +__unicode__ = __str__ + + class Flash(object): Accumulate a list of messages to show at the next page request. @@ -64,13 +75,15 @@ def __init__(self, session_key=flash): self.session_key = session_key -def __call__(self, message): +def __call__(self, message, category=notice): +if category not in [ warning, notice, error, success ]: +raise ValueError(category) from pylons import session -session.setdefault(self.session_key, []).append(message) +session.setdefault(self.session_key, []).append((category, message)) session.save() def pop_messages(self): from pylons import session messages = session.pop(self.session_key, []) session.save() -return messages +return [Message(*m) for m in messages]
Re: category support for flash
Previously Mike Orr wrote: On Fri, Dec 19, 2008 at 11:57 AM, Wichert Akkerman wich...@wiggy.net wrote: Often it is very useful to have flash/status messages of several different types, for example to be able to differentiate between informational messages, warnings and errors. To do that I made a simple extension to WebHelpers to add category support to its Flash class. The change is completely backwards compatible, so if you do not need categories you will never notice them. What kind of template do you use to display this? Do you display all categories in the same place or in different places? I show them in the same manner using self-healing messages (ie the same kind of thing Growl does on OSX) with different styling for different types of messages. I have the exact same interface in javascript which I use to show messages returned by JSON calls or other notices. Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: sqlalchemy objects in beaker cache
Previously Tomasz Narloch wrote: Andrey Plotnikov pisze: Hi, Is it safe to cache objects getting from sqlalchemy session query in beaker cache? I was done that but in that way I loose connection with sqlalchemy (Session) so You can re-associate an object with a new session. See http://www.sqlalchemy.org/docs/05/session.html#merging Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: buildout vs virtualenv for pylons and/or other wsgi apps?
Previously Mike Orr wrote: On Sun, Dec 14, 2008 at 8:38 PM, Iain Duncan iaindun...@telus.net wrote: Hi folks, I totally do not want to start a flame war here, but was wondering if people could give me their reasons for preferring buildout or virtualenv for automated builds of pylons apps or other wsgi apps. Virtualenv is more popular because it follows traditional Python usage for the most part. You install packages interactively and can change your mind at any time. Buildout's configuration recipes are hard for many people to memorize, and it's more suited to situations where you know ahead of time exactly which libraries you'll need You can change the configuration and rebuild the environment from scratch, but it's not as easy as installing an experimental package, trying it out, and then uninstalling it if you don't like it.So with virtualenv you can use the same tools for development as you use for deployment, whereas buildout is more of a deployment-only thing. I do not fully agree with that: I use buildout for development all the time. One very very important thing buildout adds is repeatability. I can take my buildout and deploy it it any random other machine and be sure that I will have the exact same environment afterwards, down to exact package versions if needed. Adding more librares with buildout is just as simple as with virtualend, the pattern is just a bit different: instead of running easy_install you add declare the new dependency in setup.py and re-run buildout. This has the advantage of guaranteeing that your dependencies are declared correctly: buildout will happily install everything you need and uninstall everything you do not need to keep the system as clean as possible. Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Deploying Pylons project
Previously Pavel Skvazh wrote: Can you please point me in the direction the real world pylons apps are deployed? I tried mod_wsgi but couldn't get it running. Was a while ago. Probably there's a nice tutorial availible. Personally I use mod_wsgi and deploy the application in a zc.buildout environment using collective.recipe.modwsgi. That gives me an easy to manage and predictable setup. Wichert. -- Wichert Akkerman [EMAIL PROTECTED]It is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Django or Pylons - comparison details
Previously cropr wrote: I don't use FormEncode. It is based on a very common design mistake made by a lot of programmers, who think one can better generate html from code. When a graphical artist designs the layout of a web page, he uses tools who speak html, css and javascript, but no python (or Perl, Java, C++, ...). While I agree FormEncode is very far from ideal, your argument does not make sense to me. FormEncode does not generate markup at all unless you explicitly tell it to. I do exactly what you describe: hand-written markup written by a designer, with FormEncode on the backend only doing decoding and validation. Wichert. -- Wichert Akkerman [EMAIL PROTECTED]It is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Django or Pylons - comparison details
Previously Alex Marandon wrote: 2008/12/6 zunzun [EMAIL PROTECTED]: Seems like I should use Django? Or should it be Pylons instead? Here is the advice of an average programmer with no emotional involvement in any of these projects. I think it depends on your background. The Pylons ecosystem is very powerful but it's quite complex and not really suitable for beginners. If it's going to be the first web framework you use, you should probably stick with Django or even better Rails. grok might also be a good choice. I'm not quite sure of repoze.bfg is quite there yet, but it is shaping up to be another excellent candidate as well. Wichert. -- Wichert Akkerman [EMAIL PROTECTED]It is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Django or Pylons - comparison details
Previously Ian Bicking wrote: Wichert Akkerman wrote: Previously Alex Marandon wrote: 2008/12/6 zunzun [EMAIL PROTECTED]: Seems like I should use Django? Or should it be Pylons instead? Here is the advice of an average programmer with no emotional involvement in any of these projects. I think it depends on your background. The Pylons ecosystem is very powerful but it's quite complex and not really suitable for beginners. If it's going to be the first web framework you use, you should probably stick with Django or even better Rails. grok might also be a good choice. I'm not quite sure of repoze.bfg is quite there yet, but it is shaping up to be another excellent candidate as well. Grok over Pylons? I don't think Grok is really any less complex. Doing basic stuff isn't particularly hard in Pylons, is it? There's no reason you have to use FormEncode, AuthKit, or any of those other pieces unless you want to, and if you are beginner to Python or web development you might off avoiding those pieces and just writing your own ad hoc code. grok is much more pluggable than pylons and has more documentation available (especially if you also consider all zope documentation that works for grok apps as well). In terms of complexity for simple apps I don't think grok and pylons differ much. Wichert. -- Wichert Akkerman [EMAIL PROTECTED]It is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Pyjamas : Python - JS
Previously Eric Ongerth wrote: I have heard that the more you try to make Javascript behave like Python, the more you end up hating Javascript -- but that says nothing about Javascript itself. Javascript is really a different language, with different strengths. Perhaps the best plan is to use Javascript for its strongest points (for example instant-turnkey use of JSON, totally anonymous objects, function mutability, etc.) and do your more Pythonic tasks in Python. Pylons makes it quite easy to leave as much of your logic as you wish in your controllers and keep your client- side view code very very thin. Especially if you use a lightweight, concise JS framework like jQuery to help keep things readable and organized. That still leaves the case of the programmer who says, I want to keep as much logic as possible on the client side to ease my server load, but I hate Javascript. In that case I don't have any good advice. Choose a new carreer :) The claim that Javascript become[s] quickly unreadable for even medium-sized applications really reflects only on the individual programmer/developer and not on the language, honestly. Javascript does not deserve to be compared to (e.g.) php, an unruly beast that literally encourages a mess. Javascript is, at worst, neutral with respect to organization; at best it embodies the heights of abstraction, encapsulation, and readability. It's all up to you. A problem with javascript is that most people using it never get beyond writing tiny bits of code to perform a single effect on a page. With new frameworks making that even simpler that is even more true now than it was a few years ago. But once you get beyond that you will indeed see that javascript is a very nice and fun language. Wichert. -- Wichert Akkerman [EMAIL PROTECTED]It is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Pyjamas : Python - JS
Previously Kless wrote: On 6 dic, 03:22, Eric Ongerth [EMAIL PROTECTED] wrote: But if you don't like Javascript, you have plenty of company. Including myself somewhat recently before I studied it more thoroughly and started trying harder with it ;-) Well, I hope that any day Lua can be embedded in the browser. I'm not the only person that think about it, and nobody should doubt about its better performance [1]. Unfortunately in the world of browsers you can not use something until enough browsers support it. That is why we are still bound by the capabilities of IE6 even now. Wichert. -- Wichert Akkerman [EMAIL PROTECTED]It is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: simplejson install error, need help
Previously Mike Orr wrote: On Tue, Nov 25, 2008 at 2:35 PM, Ben Bangert [EMAIL PROTECTED] wrote: On Nov 25, 2008, at 12:43 PM, Mike Orr wrote: Is it possible to limit a dependency to certain versions of Python? It should be. Setup.py is just a Python file, I don't see why I can't test the Python version and toggle the dependencies. Aren't the dependencies stored in the egg_info files and reparsed when you call pkg_resources.require()? Otherwise I don't see how it could do its cascade of dependency checking when you load the application egg, because setup.py isn't available at that point. It works with source eggs since that python is run during dependency determination, and for binary eggs since those are python version-specific. Wichert. -- Wichert Akkerman [EMAIL PROTECTED]It is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Pylons and Python 2.6 (Was: Re: go-pylons.py broken on Python 2.6 in Windows?)
Previously Mike Orr wrote: On Tue, Nov 18, 2008 at 12:22 AM, Lawrence Oluyede [EMAIL PROTECTED] wrote: On Tue, Nov 18, 2008 at 8:35 AM, Eric Ongerth [EMAIL PROTECTED] wrote: Correction: the point at which easy_installing Pylons errored out was during the installation of simpleJSON. So it never reached the point of installing paste, pastescript, pastedeploy etc. Hey, I thought Python 2.6 includes the former simpleJSON as the new json module. No? It does: http://docs.python.org/library/json.html It does but I doubt Python provides sufficient egg-info data for easy_install to know the dependency is not needed. It can: setup.py is just python, so you can put conditional code in there that checks the python version and modifies install_requires accordingly. You need to do the same thing for the uuid module as well. Wichert. -- Wichert Akkerman [EMAIL PROTECTED]It is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Putting DELETE's params into request.POST
Previously Sok Ann Yap wrote: On the other hand, if we look into httplib2's source code, which I supposed is everyone's favorite http client library, Joe Gregorio doesn't make any distinction between POST and DELETE. You can verify that by using httplib2 to send a DELETE request with body to a simple wsgi app that echoes back wsgi.input. Probably because that was just easier. I can not imagine what the semantics for a body for DELETE would be. What information would you want to send to something that you are deleting? Wichert. -- Wichert Akkerman [EMAIL PROTECTED]It is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Freezing a Pylons app
Previously Christopher Barker wrote: So, is there a way to turn off the use of pkg_resources in paste? No, paste relies on it to handle entry points in various places. That is a very popular pattern that more and more things are starting to use. Wichert. -- Wichert Akkerman [EMAIL PROTECTED]It is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Beaker info
Beaker seems to be very little documentation online, so hopefully someone can help me out here. I am looking at caching the results of things like expensive function calls and database queries, and beaker seems to be usable as a caching system. What I can't seem to find is how to conveniently handle per-request and forever-lasting caching. In Zope I can do this: from plone.memoize import forever from plone.memoize import view @forever.memoize def expensive_stuff(): The result of this function is cached forever, with the function and its argument as cache keys. @view.memoize def expensive_stuff(): The result of this function is cached during this request only, with the function and its argument as cache keys. as far as I can see there is no direct alternative for beaker, is that correct? Wichert. -- Wichert Akkerman [EMAIL PROTECTED]It is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Freezing a Pylons app
Previously Mike Orr wrote: On Thu, Oct 9, 2008 at 11:23 PM, Wichert Akkerman [EMAIL PROTECTED] wrote: Previously Christopher Barker wrote: So, is there a way to turn off the use of pkg_resources in paste? No, paste relies on it to handle entry points in various places. That is a very popular pattern that more and more things are starting to use. Popular, but it's still on unstable ground because Setuptools isn't built into Python yet,. This is just one of a series of problems people have when installing Pylons. It's worth remembering that there aren't many packages that depend on others, much less a multilevel dependency -- Pylons and TurboGears are about it. The zope libraries are much larger and have much more (too many) dependencies than Pylons and Turbogears, by several factors. Unfortunately that puts the onus on us to either fix the Setuptools problems ourselves, complain to the developers, or make Pylons/Paste less dependent on Setuptools. What exactly are 'the setuptools problems'? Entry points and namespaces are very practical and I wouldn't want to loose them. All the installation and index-handling logic in setuptools is probably best replaced. The whole idea of importing an application by entry point when you already know what the module is called and it's already been installed is kind of funny. But in this case, the problem seems to be not entry points or namespace packages but pkg_resources.require. The purpose of pkg_resources.require, according to its documentation, is to guarantee version dependencies are satisfied and to activate eggs that are along sys.path but not on it. I tend to think this whole concept is obsolete now that you can install different versions into different virtual environments. I don't know of anybody who has installed multiple versions of a package into the same directory, and then had two applications that each used pkg_resources.require to activate a different version. On the other hand, I know people who have hesitated to use pkg_resources.require because that makes the application or library depend on Setuptools. I've never used multi-version support or resources.require, and I agree that we have better tools now. I think a problem of setuptools is that it does too many things, and not all of them very well: - namespace handling - entry points - multi-version egg installation - building and uploading eggs - egg installation - remote package searching and downloading pyinstall already does a better job at the last two. A simple implementation of the first two in the standard library would go a long way to improving things. Wichert. -- Wichert Akkerman [EMAIL PROTECTED]It is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---