Re: use tween to centralize redirection or something else
I am already using Pyramid auth, but to bend it for the new feature I'd have to edit _every_ add_view(), which will make it an even worse hack than my current tween hack, where I need to manually recreate the attributes used in the template, notably the missing matched_route -- def signup_hack_tween_factory(handler, registry): def signup_hack_tween(request): if request.user and not request.user.user_name and request.method == 'POST': request.c['h'] = helpers request.matched_route = Mock() settings = registry.settings request.RedisCache = settings['RedisCache'] return render_to_response('templates/signup_hack.genshi', request.c, request) else: try: response = handler(request) finally: return response return signup_hack_tween Jerry On Monday, April 8, 2013 11:18:32 PM UTC+8, Jonathan Vanasco wrote: are you using Pyramid's auth already ? -- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
add_route() question
Is there a clean way to pass information to Pyramid app from add_route()? For SEO reasons, I want multiple routes to point to the same view. i.e., -- add_route('christmas', '/christmas') add_view('views.christmas_view', route_name='christmas') add_route('christmas-gifts', '/christmas-gifts') add_view('views.christmas_view', route_name='christmas-gifts') add_route('christmas-gift-ideas', '/christmas-gift-ideas') add_view('views.christmas_view', route_name='christmas-gift-ideas') now in my christmas_view or christmas_template, I need to set the header keywords according to the route match. Instead of checking matched_route.name, which can quickly lose sync as the routes structure changes, is there a cleaner way to achieve this? Thanks. Jerry -- 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: Minimatic for Pyramid?
From a quick skim of the documentation, webassets doesn't seem to be as flexible or versatile as Fanstatic: Resource publishing for Pythonistas [ http://www.fanstatic.org/en/latest/index.html ]. Any thoughts? Jerry On Jun 12, 2:34 pm, John Anderson son...@gmail.com wrote: On Tue, Jun 12, 2012 at 1:31 AM, Mark Huang zhengha...@gmail.com wrote: Hi Pyramid experts, I am about to launch a web application soon and I realized I had some problems with js and css assets (minimizing and which one to use for production and development). I used to use Minimatic when I was developing using Pylons. I came to learn that Webhelpers is not supported in Pyramid and hence, Minimatic, being an extension of webhelpers, doesn't seem to work on Pyramid. What do you guys use for this sort of job. The key feature I need is for Pyramid to switch resources when I switch from development to production and vice versa. Regards, Mark Huang I usehttp://webassets.readthedocs.org/en/latest/index.html withhttps://github.com/sontek/pyramid_webassets -- 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: Need help on caching, background jobs manual ORM cache refresh (Pyramid project)
If you like beaker, you might also want to take a look at retools ( http://pypi.python.org/pypi/retools/0.2 ), a newer caching library specifically for Redis from the same author. Jerry On Jun 6, 3:36 am, Learner hello.bku...@gmail.com wrote: Thanks Jason. I will take your suggestion. But your hint about beaker caching is helpful. cheers -Bkumar On Jun 5, 4:22 pm, Jason ja...@deadtreepages.com wrote: On Tuesday, June 5, 2012 7:49:10 AM UTC-4, Learner wrote: Hello Pyramid gurus, I have been searching for quick tutorials on caching, background jobs ORM related topics. I found quite a few resources which seem to be very informative. Since I am new to both Python Pyramid, I thought I will seek experienced people opinion, before I go ahead and use anything I found on web. Any help is very much appreciated. 1. Caching: The simple use case is:- I want to show top 10 or 20 articles on my wiki application. Before I render the data I would like to cache the db result upon first query execution and cache it. Cache to refresh automatically after every 1 hour or so. As far as caching is concerned you will be better off caching the result of your view. Beaker cache has decorators for caching individual functions/methods for a specified period of time (look for cache_region decorator) this way not only will the database results be cached, but also the processing required to turn them into the template values. I don't know if there is a way to also cache the rendered template with Pyramid. 2. Background Jobs: I am using SQLAlchemy in my application. All the data needed for the application comes from XML/CSV files. Is there any way in Pyramid I can create a background job and schedule it to run every 30 minutes or so?. Job will look at one particular folder everytime it is run, and if there are any xml/csv files job will pick it up and process them. Since this is simple ETL job, SQLAlchemy is not aware of the DB changes. So does this confuse any of the ORM caching mechanism and show the dirty data? If so, how would I be able to notify ORM to rebuild its caching? Thanks for your time. Are the XML files parsed and then the data is inserted into a database that Pyramid uses? Perhaps a cron job would be better suited to that? If you are using caching then the data will not be refreshed in Pyramid until the cache refreshes. If you are using beaker you can force the cache to refresh on the next hit. Are you sure you need all this caching though? It seems unnecessarily complicated. Pyramid is very fast, SQLAlchemy is very fast, your database will probably be caching the query plans as well so it's going to be very fast. I would recommend building your application with no caching, and then adding it later if it is needed. That way you can worry about getting the loaded data displaying correctly (especially since you're data setup is a little more complex) before having to figure out a caching system. -- Jason -- 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: Mobile version of site with Pyramid
Check out a new adaptive CSS/JS Foundation framework ( http://foundation.zurb.com/ ), with that you can have one-template-fit-all and impress your client if they have not seen web page that automatically changes layout according to screen size :) Jerry On Apr 17, 9:38 am, Theron Luhn the...@luhn.com wrote: Hello. My client thinks its very important to have a mobile version of their website. Do you guys have any recommendations on how to use different Chameleon templates for the mobile/desktop website? - Theron -- 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.
Anything similar to Django dogslow in Pyramid?
Just learnt the Django dogslow module ( http://pypi.python.org/pypi/dogslow ) from the Instagram architecture presentation. It's a middleware for identifying slow process, is there anything similar in Pyramid? Jerry -- 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 pdb.set_trace() in Chameleon
Uber! This should be the final call to translate my 10K Genshi templates to Chameleon. Are there any auto migration tool out there? Jerry On Feb 29, 4:32 pm, Malthe Borch mbo...@gmail.com wrote: Just wanted to note that as of 2.8.0 (just released), you can now embed Python code blocks in templates. This makes it easy to enter the debugger from inside a template: ?python import pdb; pdb.set_trace() ? div tal:condition=... ... /div It works best if you're running in debug-mode since then the generated source code is written out to disk, letting the debugger actually see the code. If you're an emacs user, consider binding this to M-p: (fset 'pdb-pi-set ?python import pdb; pdb.set_trace() ?) (global-set-key \M-p 'pdb-pi-set) This extends on the common binding M-t: (fset 'pdb-set import pdb; pdb.set_trace()) (global-set-key \M-t 'pdb-set) Naturally, code blocks can be used for more than just debugging. I'm not sure it's particularly useful. It allows you to write out a Fibonacci-generator right from inside your templates – should you ever need that. Enjoy, \malthe -- 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.
How To Prepare For get_current_registry() Manually
I am trying to use of SQLAlchemy event outside of web app. SQLAlchemy event functions are in their own module -- from sqlalchemy import event from pyramid.threadlocal import get_current_registry event.listen(model.User, 'after_update', after_update_listener) def after_update_listener(mapper, connection, target): settings = get_current_registry().settings ... which works well in the web app. However, get_current_registry() returns nothing in paster command or bootstrap scripts. How can I prepare the config values for get_current_registry() manually? Any pointer will be much appreciated. Jerry -- 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.
[Pyramid] Caching Response Object
Hi, I wonder if anyone has succeeded in caching the template output. The main hurdle I'm facing is how to serialize the entire Response object. I have made a tween to cache the vanilla 200 response.text, but what about redirect, forbidden, etc, I don't have a solution. Any pointer will be much appreciated. Jerry -- 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 Response Object
Thanks Robert. However, the cache needs to, at minimum, differentiate login users from non-login users to serve different content, and only a Pyramid app aware caching engine can do that. Jerry On Jan 31, 9:44 pm, Robert Forkel xrotw...@googlemail.com wrote: hi jerry, if you run your app via paster/gunicorn/whatever proxied by apache or nginx, it is trivial to insert varnish [1] as transparent cache between the frontend and the server serving your pyramid app. regards robert [1]https://www.varnish-cache.org/ On Tue, Jan 31, 2012 at 9:16 AM, jerry jerryji1...@gmail.com wrote: Hi, I wonder if anyone has succeeded in caching the template output. The main hurdle I'm facing is how to serialize the entire Response object. I have made a tween to cache the vanilla 200 response.text, but what about redirect, forbidden, etc, I don't have a solution. Any pointer will be much appreciated. Jerry -- 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 athttp://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-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 Response Object
Thanks Simon. Varnish is definitely worth exploring. I'm also very interested in your second approach, how can you tell if the user has JS enabled by looking at her request? Jerry On Jan 31, 11:45 pm, Simon Yarde simonya...@me.com wrote: I wonder if this solves your issue with Varnish, or if it is too coarse: https://www.varnish-cache.org/docs/trunk/tutorial/cookies.html It would seem as a minimum you could identify logged-in-users from non-logged-in-users by a the presence of a specific auth-cookie. This would certainly accelerate pages for non-logged in users. I am currently working on pulling basic user info into cached pages via javascript; this covers most 'cart contents' and 'hello Jane Smith' type feedback scenarios. The graceful fallback is to send the user to a specific cart or account page if they don't have js active. On 31 Jan 2012, at 15:25, jerry wrote: Thanks Robert. However, the cache needs to, at minimum, differentiate login users from non-login users to serve different content, and only a Pyramid app aware caching engine can do that. Jerry On Jan 31, 9:44 pm, Robert Forkel xrotw...@googlemail.com wrote: hi jerry, if you run your app via paster/gunicorn/whatever proxied by apache or nginx, it is trivial to insert varnish [1] as transparent cache between the frontend and the server serving your pyramid app. regards robert [1]https://www.varnish-cache.org/ On Tue, Jan 31, 2012 at 9:16 AM, jerry jerryji1...@gmail.com wrote: Hi, I wonder if anyone has succeeded in caching the template output. The main hurdle I'm facing is how to serialize the entire Response object. I have made a tween to cache the vanilla 200 response.text, but what about redirect, forbidden, etc, I don't have a solution. Any pointer will be much appreciated. Jerry -- 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 athttp://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-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group athttp://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-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.
Pyramid Debug Routematch Not Working
I am using Pyramid 1.2.4, with debug_routematch enabled in the configuration -- $ head prod_test.ini [app:myapp] use = egg:myapp debug_authorization = false debug_notfound = false debug_routematch = true debug_templates = true default_locale_name = en [pipeline:main] pipeline = egg:WebError#evalerror egg:repoze.tm2#tm myapp As well as on the command line -- $ PYRAMID_DEBUG_ROUTEMATCH=true paster serve --reload prod_test.ini But I still don't get any route debug message on the console. What could be wrong? Thanks. Jerry -- 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.
Pyramid Route Bug?
I noticed that Pyramid (1.2.4) url dispatch route does not work with %2F So the below route -- config.add_route('date', '/date/{date}) does not match -- /date/2012%2F1%2F5 Is it a bug? Thanks. Jerry -- 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: Pyramid Debug Routematch Not Working
Thanks Michael. But after setting the loggers in prod_test.ini -- [loggers] keys = root, myapp ... [logger_root] level = DEBUG handlers = console [logger_myapp] level = DEBUG handlers = qualname = myapp I'm starting to see all the ThreadPool work messages, but still nothing from route match. Any further pointer? Jerry On Jan 5, 4:33 pm, Michael Merickel mmeri...@gmail.com wrote: You probably do not have the DEBUG level enabled for the pyramid package. Make sure you have something along the lines of the default logging setup in your ini. http://docs.pylonsproject.org/projects/pyramid/en/1.2-branch/narr/log... On Thu, Jan 5, 2012 at 2:13 AM, jerry jerryji1...@gmail.com wrote: I am using Pyramid 1.2.4, with debug_routematch enabled in the configuration -- $ head prod_test.ini [app:myapp] use = egg:myapp debug_authorization = false debug_notfound = false debug_routematch = true debug_templates = true default_locale_name = en [pipeline:main] pipeline = egg:WebError#evalerror egg:repoze.tm2#tm myapp As well as on the command line -- $ PYRAMID_DEBUG_ROUTEMATCH=true paster serve --reload prod_test.ini But I still don't get any route debug message on the console. What could be wrong? Thanks. Jerry -- 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. -- 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 any case where chameleon is more preferred?
I tried to write full-up programs in XML/XSLT at work and fully agree with you that XML is by design not suitable for such task. However, templates are not, and should not be, full-up programs. The awkward XML programing can actually remind the author to limit the logic in the template. Besides, when both the number and complexity of your templates grow, it'll be appreciated more and more that your final HTML will be well- formed (and free from XSS attack) so long as each individual template is validated. This is kind of like unit testing to me. Last but not the least, XML templates are more designer friendly than their non-XML counterparts. That's why I'm still with Genshi while waiting for Chameleon to be ready for prime time. Just another perspective. Jerry On Dec 18, 5:34 am, John Rusnak jrusna...@gmail.com wrote: If you have ever tried full-up programming in XML or seen XML that tries to act like a full programming language this is what the Chameleon experience was like for me. And for me, this is not a pleasant one. XML/HTML was not designed for programming logic, etc. Mako allows a good and balanced way of mixing logic and HTML(formatted) text. Just one person's perspective. On Sat, Dec 17, 2011 at 11:14 AM, Mike Orr sluggos...@gmail.com wrote: On Sat, Dec 17, 2011 at 5:28 AM, Joshua Partogi joshua.part...@gmail.com wrote: Hi there, I am left undecided whether to use mako or chameleon. From what I have observed, it seems that chameleon is the default template language in pyramid (CMIIW). Is there any case where chameleon is more preferred when using pyramid? I actually like mako but I am afraid there are some mako functionality that is not supported in pyramid. The reason Chameleon seems first is that Pyramid's codebase is a direct descendant of BFG, which had Chameleon. The Pylons-like parts were added later, and the tutorial authors happened to be Chameleon users. Mako was added to Pyramid with the intention that people would use it, and that they *should* use it if they're more comfortable with it. All of Mako is supported in Pyramid. Overall I'd say Mako has more features than Chameleon and is more flexible. However, one advantage of Chameleon is that, because it's an XML-based language, the template is guaranteed to be well-formed if the rendering doesn't raise an exception. (That doesn't necessarily mean the output will be well-formed, if your variables contain unbalanced tags and you output them as literals rather than the default of escaping them.) Also, it looks Pyramid supports internationalization better with Chameleon (more documentation, more built-in support). That doesn't mean you can't do internationalization with Mako, it just means you'd have to do more of the structural work yourself. (Are there any tutorials on this?) One feature that may not be obvious if you're not using the Akhet scaffold, is that you can define Mako options in the INI file (mako.directories = line1 line2) or at the beginning of your main function (``settings[mako.directories] = [...]``). I also have used Mako a lot, and have been trying out Chameleon to see if I might want to use it. My impression is that Chameleon's syntax is very different, and it takes time to map your Mako idioms to Chameleon equivalents. So it's only worth doing if you have time to do it slowly, or if your first Chameleon application requires only simple templates. Longer term, Chris has been talking about removing both Chameleon and Mako from the Pyramid core, making them add-on packages (pyramid_chameleon and pyramid_mako). They would then be application dependencies like SQLAlchemy, rather than Pyramid core dependencies. -- Mike Orr sluggos...@gmail.com -- 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. -- 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: Events system
I would appreciate some confirmation/explanation on the Pyramid event system -- is event/subscribe restricted to Pyramid running on one physical server? Thanks. Jerry On Dec 14, 7:13 am, John Anderson son...@gmail.com wrote: On Tue, Dec 13, 2011 at 5:10 PM, Vlad K. v...@haronmedia.com wrote: Hi all! In my Pyramid app I want to implement an event system, basically for plugins to hook to various events that raise in the life of the application. These events are each different, some allow one hook (by raising an exception if another hook tries to register for same event), some many, they handle various kinds of data, etc... My approach is the following: class SomeEvent(EventBase): Event raised in this or that condition, does X, requires Y, ... HANDLERS = [] @classmethod Register(cls, callable): Decorator that registers a handler for this event. cls.HANDLERS.append(callable) return callable def __init__(self, request): self.request = request ... def dispatch(self): for h in self.HANDLERS: h(self) ... @events.SomeEvent.Register def some_handler(event): ... So basically we have a plugin with a handler some_handler, which we register for the particular event via its decorator. Now, I don't want to reinvent the wheel, and this approach seems rather straightforward, unit-testable and simple to implement, plus the events are then self-documenting. I was wondering if there is a better solution, or perhaps I can reuse some part of the Pyramid framework? ZCL? Also, can I reuse Venusian to scan the plugins package and thus do auto import of plugins at app startup time, instead of having the requirement to manually import each plugin so that the decorators would trigger and register the handlers (I really want the plug and play solution with dropping a module in the plugins package dir and calling it done)? Thanks. You can use:http://docs.pylonsproject.org/projects/pyramid/en/latest/api/events.html this is how you would create custom events:https://github.com/sontek/pyramid_signup/blob/master/pyramid_signup/e... this is how you would fire the event:https://github.com/sontek/pyramid_signup/blob/master/pyramid_signup/v... and this is how you would subscribe to the event:https://github.com/sontek/pyramid_signup/blob/master/pyramid_signup/t... -- 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: Events system
Thanks Michael and Chris. From the framework design point of view, such event system is invaluable. But for application development, I fail to see its added value compared to simple function call. And it makes parsing variables harder. E.g., I'd naively design Michael's example as -- class MyEvent(object): def __call__(self): do_something(v1, v2, ...) def do_something(*args, **kw): # do stuff e = MyEvent() e() Any enlightenment will be much appreciated. Jerry On Dec 14, 5:25 pm, Chris McDonough chr...@plope.com wrote: On Wed, 2011-12-14 at 01:11 -0800, jerry wrote: I would appreciate some confirmation/explanation on the Pyramid event system -- is event/subscribe restricted to Pyramid running on one physical server? Yes. - C Thanks. Jerry On Dec 14, 7:13 am, John Anderson son...@gmail.com wrote: On Tue, Dec 13, 2011 at 5:10 PM, Vlad K. v...@haronmedia.com wrote: Hi all! In my Pyramid app I want to implement an event system, basically for plugins to hook to various events that raise in the life of the application. These events are each different, some allow one hook (by raising an exception if another hook tries to register for same event), some many, they handle various kinds of data, etc... My approach is the following: class SomeEvent(EventBase): Event raised in this or that condition, does X, requires Y, ... HANDLERS = [] @classmethod Register(cls, callable): Decorator that registers a handler for this event. cls.HANDLERS.append(callable) return callable def __init__(self, request): self.request = request ... def dispatch(self): for h in self.HANDLERS: h(self) ... @events.SomeEvent.Register def some_handler(event): ... So basically we have a plugin with a handler some_handler, which we register for the particular event via its decorator. Now, I don't want to reinvent the wheel, and this approach seems rather straightforward, unit-testable and simple to implement, plus the events are then self-documenting. I was wondering if there is a better solution, or perhaps I can reuse some part of the Pyramid framework? ZCL? Also, can I reuse Venusian to scan the plugins package and thus do auto import of plugins at app startup time, instead of having the requirement to manually import each plugin so that the decorators would trigger and register the handlers (I really want the plug and play solution with dropping a module in the plugins package dir and calling it done)? Thanks. You can use:http://docs.pylonsproject.org/projects/pyramid/en/latest/api/events.html this is how you would create custom events:https://github.com/sontek/pyramid_signup/blob/master/pyramid_signup/e... this is how you would fire the event:https://github.com/sontek/pyramid_signup/blob/master/pyramid_signup/v... and this is how you would subscribe to the event:https://github.com/sontek/pyramid_signup/blob/master/pyramid_signup/t... -- 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: Pyramid 1.3a1 released
Thanks bunch for the early Christmas gift :) However, the doc -- New console scripts named pshell, pviews, proutes, and ptweens do what their paster commandname equivalents used to do. leaves out paster customized commands, which is also a first-class member of the paster family. Appreciate if we could get the assurance that it is in the road map. Thanks again. Jerry On Dec 10, 4:15 am, Chris McDonough chr...@plope.com wrote: Pyramid 1.3a1 has been released. This is the first major release in the 1.3 series. Its primary features are: - Python 3.2 compatibility. - A new configuration introspection system. It requires Python 2.6, 2.7 or 3.2. Python 2.5 is no longer supported. Please use the Pyramid 1.2.X series if you need Python 2.5 compatibility. The documentation for the release is available athttp://docs.pylonsproject.org/projects/pyramid/en/1.3-branch/ A detailed What's New in Pyramid 1.3 document is available athttp://docs.pylonsproject.org/projects/pyramid/en/1.3-branch/whatsnew... You can install it via PyPI: easy_install Pyramid==1.3a1 Many thanks to our GSOC students Joe Dallago and Joel Bohman, who helped us get Pyramid and its dependencies ready for Python 3. Thanks also to the Python Software Foundation, who provided a grant to port WebOb to Python 3, and Sergey Schetenin, who helped prepare WebOb for Python 3 compatibility. Enjoy, and please report any issues you find to the issue tracker athttps://github.com/Pylons/pyramid/issues Thanks! - C -- 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.
[Pyramid] Access Global Variable From Form(Encode)
Hi Experts, What would be the best way to pass a global variable into my form(encode) -- class MyModelSchema(Schema): filter_extra_fields = True allow_extra_fields = True name = UniqueUsernameValidator(not_empty=True) where UniqueUsernameValidator is a subclass of formencode.FancyValidator that checks username for duplication. But instead of hitting the database, I prefer first checking via a global (Redis) cache variable in the request object. How do I access this variable from my form? Thanks. Jerry -- 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: pyramid.response.Response(app_iter=?)
Hi Gael, Indeed, app_iter does work flawlessly out-of-box with GridOut object. It was some other elementary mistake I made that is triggering the exception, my bad. Jerry On Nov 4, 12:04 am, Gael Pasgrimaud g...@gawel.org wrote: On Thu, Nov 3, 2011 at 4:54 PM, jerry jerryji1...@gmail.com wrote: Hi, How does pyramid.response.Response use the (app_iter=) object passed in? I'm interested in the details because it does not work with app_iter=MongoDB's gridfs.grid_file.GridOut object (which supports the usual read/seek/tell() operations), but I found myself drowning in the zope style implementation in Pyramid. GridOut also implement __iter__http://api.mongodb.org/python/current/api/gridfs/grid_file.html#gridf... So you can use it as this Thanks in advance. Jerry -- 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 athttp://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-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: Celery Configuration with Pyramid
Hi John, What's wrong with calling initialize_sql from Celery? I am calling initialize_sql(engine, create_all=False) in my Celery tasks.py and didn't notice any problem. Jerry On Nov 5, 8:05 pm, John Anderson son...@gmail.com wrote: So I've been playing with celery configuration with Pyramid and I was wondering how you guys handle it? My problem right now is the best way to tell celery how to bind SQLAlchemy configuration. If I don't call initialize_sql inside my celeryconfig.py it doesn't get bound but I don't want to call initialize_sql from celeryconfig.py because its used both on the app side and to run celeryd. -- 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.
pyramid.response.Response(app_iter=?)
Hi, How does pyramid.response.Response use the (app_iter=) object passed in? I'm interested in the details because it does not work with app_iter=MongoDB's gridfs.grid_file.GridOut object (which supports the usual read/seek/tell() operations), but I found myself drowning in the zope style implementation in Pyramid. Thanks in advance. Jerry -- 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: Recommended way to do background processing once the response is sent
Before you reinvent the wheel, do take a look at Celery ( http://celeryproject.org/ ). I have been using it for all sorts of background/async processing tasks ranging from sending emails to Twitter posting. It was originally created in the Django world but can be easily integrated with Pyramid, just define your task and do anywhere in your view -- DownloadImageTask.delay(image_url) for the task to be picked and handled by a standalone celeryd process. Jerry On Oct 17, 3:14 am, ravi teja raviteja2...@gmail.com wrote: Hi, I would like to do some background processing (like downloading the image, caching the data etc.) after I send the response for the request. Which is the recommended way to do it? Does response callback work for this? Should I use a messaging queue to provide the handling to another service? Thanks in advance, Ravi -- 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.
Pyramid: How to use route_url() without a request?
Hi, I was constructing a paster command and couldn't figure out how to get route_url() to work in the absence of a request. Any pointer will be much appreciated! Jerry -- 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: how to call a function for evry 10 secs
Hi Mike, I'm curious to know where is this main() for Pyramid you were referring to? Thanks. Jerry On Jun 30, 5:30 am, Mike Orr sluggos...@gmail.com wrote: On Wed, Jun 29, 2011 at 10:40 AM, hisan santosh.s...@gmail.com wrote: how to call a function for evry 10 secs in python I assume this is a Pylons or Pyramid application since this is pylons-discuss. The easiest way would probably be to start a thread in the initialization code (environment.py for Pylons, main() for Pyramid). The thread would run a long-running function with a loop that that records its start time, does its thing, sleeps for ``(10 seconds - (now - start_time))``, and repeats. Another way to do repeated events is with cron, possibly using paster request. But that won't work in this case because cron can't handle intervals of less than a minute. -- Mike Orr sluggos...@gmail.com -- 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: Disable SQLAlchemy Transaction
Thanks Chris. I finally got (hopefully is) what I want with -- DBSession = sessionmaker() dbsession = DBSession() for item in items_query.all(): dbsession.begin_nested() item.name = 'foobar' try: dbsession.commit() except: dbsession.rollback() dbsession.commit() What I'm not so sure is whether (PostgreSQL) savepoint is designed to support millions of iteration before the grand final commit. Jerry On May 13, 2:06 pm, Chris Withers ch...@simplistix.co.uk wrote: Hi Jerry, On 13/05/2011 01:31, jerry wrote: Everything is still wrapped in one big transaction -- - for item in items_query.all(): (Pdb) 2011-05-13 08:23:54,109 INFO sqlalchemy.engine.base.Engine.0x...68cc BEGIN (implicit) 2011-05-13 08:23:54,122 INFO sqlalchemy.engine.base.Engine.0x...68cc SELECT ... I don't think this is anything to do with Pyramid. Read the docs for sessionmaker, particularly those about autocommit:http://www.sqlalchemy.org/docs/orm/session.html#sqlalchemy.orm.sessio... So, you have a transaction created for you, but you can manage it yourself: session = DBSession() session.bind = ...your engine... for item in items_query.all(): try: ...do stuff... except: session.abort() else: session.commit() Now, personally, I like the ZopeTransactionExtension 'cos it lets me spell the above in a nicer way and synchronise transactions across things like sending mail, writing files to disk, etc. I also likehttp://packages.python.org/mortar_rdb/use.html, where the pattern would become: from mortar_rdb import registerSession,getSession import transaction registerSession('sqlite://') session = getSession() for item in session.query(...).all(): with transaction: ...do stuff... cheers, Chris -- Simplistix - Content Management, Batch Processing Python Consulting -http://www.simplistix.co.uk -- 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.
[Pyramid] Disable SQLAlchemy Transaction
It seems transaction based SQLAlchemy session is defined by the ZopeTransactionExtension -- DBSession = scoped_session(sessionmaker(extension=ZopeTransactionExtension())) This is causing problem with my long-running/large-volume paster command, which are not suitable for transactions. But I couldn't get the DBSession redefined no matter how I fiddle with the paster command source. Is there a way to temporarily turn off transaction in a Pyramid project? Thanks in advance! Jerry -- 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: Disable SQLAlchemy Transaction
Hi Michael, Thanks for the reply, but even if I remove ZTE in my models.py -- DBSession = scoped_session(sessionmaker()) Everything is still wrapped in one big transaction -- - for item in items_query.all(): (Pdb) 2011-05-13 08:23:54,109 INFO sqlalchemy.engine.base.Engine.0x...68cc BEGIN (implicit) 2011-05-13 08:23:54,122 INFO sqlalchemy.engine.base.Engine.0x...68cc SELECT ... If I have 2 million items it's not going to be a robust design to commit only once in the end after updating 1 million of them. Is there a way to explicitly turn off the transaction (at least for SELECT)? Jerry On May 12, 11:27 pm, Michael Merickel mich...@merickel.org wrote: Nothing is stopping you from defining another session object bound to the same engine that does not use the ZTE. As long as your engine is accessible through the settings/registry then it shouldn't be an issue to create a session in your script and use it only there. Michael On Thu, May 12, 2011 at 1:37 AM, jerry jerryji1...@gmail.com wrote: It seems transaction based SQLAlchemy session is defined by the ZopeTransactionExtension -- DBSession = scoped_session(sessionmaker(extension=ZopeTransactionExtension())) This is causing problem with my long-running/large-volume paster command, which are not suitable for transactions. But I couldn't get the DBSession redefined no matter how I fiddle with the paster command source. Is there a way to temporarily turn off transaction in a Pyramid project? Thanks in advance! Jerry -- 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. -- 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.
Test Data Setup
I'm using Pyramid with a bunch of unit/integration tests, how can I ensure common test data is setup _only once_ before a complete test run? Thanks. Jerry -- 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: Pyramid and social auth
My working codes: Twitter OAuth connect -- http://pylonshq.com/pasties/c549d2be586797da17c7fad5ae875372 Facebook OAuth2 connect -- http://pylonshq.com/pasties/e4b933da7f577c541cc2f2489f825fdd Jerry On Jan 16, 10:16 pm, Adam Klekotka adam.kleko...@gmail.com wrote: Hello, I'm new to Pyramid and I'm developing an app in which I want to use twitter and facebook connect for user auth. I think the repoze.what with plugins would be the best way to do that. Is there any tutorial how to use it with Pyramid? Or maybe should I choose Pylons1.0 instead? Thanks, Adam -- 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.
[Pyramid] Genshi Template Auto-restart
Hi, I'm using the Genshi template via -- myapp/__init__.py config.add_renderer('.genshi', MyGenshiRenderer) ... class MyGenshiRenderer: def __init__(self, info): loader = TemplateLoader(os.path.abspath(os.path.dirname(__file__))) self.tmpl = loader.load(info.name) def __call__(self, value, system): return self.tmpl.generate(**value).render('html') myapp/__init__.py How can I auto-restart pyramid whenever my template changes? Thanks! Jerry -- 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.
[Pyramid] add_route/view_config permission issue
Hi, In pyramid-1.0a7, I noticed something that could be a permission mis- feature with how add_route/view_config interact -- Sole add_route protects the view -- __init__.py config.add_route('account', '/account', renderer='templates/account.genshi', view='myapp.views.account.account_view', view_permission='view') /__init__.py so does this -- __init__.py config.add_route('account', '/account') config.scan() /__init__.py account.py @view_config(route_name='account', renderer='templates/account.genshi') permission='view') def account_view(request): /account.py But with the following combination, the view is not protected -- __init__.py config.add_route('account', '/account', view_permission='view') config.scan() /__init__.py account.py @view_config(route_name='account', renderer='templates/ account.genshi') def account_view(request): /account.py If this is not considered a bug, maybe stating it explicitly in the documentation could save others some time. Thanks. Jerry -- 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.
[Pyramid] User-land Redirection (HTTPFound) Question
Yet-another simple question: What's the best practice in implementing a user-land multi-point redirection? The most common application is redirect user back to the initial page after login, which pyramid's built-in authentication already works well with @view_config(permission='...') However, if I issue an HTTPFound myself pointing to GET login view, how should the user be redirected back after a successful POST? I might be able to get away with recording request.referer all the way and jam a {'referer': initial_url} into the headers of the GET login view response, but there must be better ways. If I recall correctly, Pylons' redirect_to() simply works out-of-the-box. Thanks. Jerry -- 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.
[Pyramid] URL Dispatch Test Confusion
Hi, I have the following URL dispatch setup -- __init__.py config.add_route('user', '/user') config.add_route('user_id', '/user/{user_id}') config.scan() /__init.py__ views/user.py @view_config(route_name='user', renderer='user.genshi') @view_config(route_name='user_id', renderer='user_id.genshi') def user_view(request): /views/user.py which works fine. However, my unit test case always gets routed to 'user' instead of 'user_id' no matter how I tweak the request.path_info -- test_user_view.py request = DummyRequest() request.path_info = route_url('user_id', request, user_id=u'42') #request.path_info = '/user/42' resp = views.user.user_view(request) /test_user_view.py I'm sure I must be missing something very simple there. Thanks in advance! Jerry -- 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: URL Dispatch Test Confusion
Thanks Chris. Well, I thought routing will always happen after view functions are decorated with view_config() Allow me to step back one step and ask: How can routing be unit tested? Jerry BTW, your attached a local URI, the public URL should be http://docs.pylonshq.com/pyramid/dev/narr/testing.html#creating-functional-tests On Dec 23, 11:53 am, Chris McDonough chr...@plope.com wrote: On Wed, 2010-12-22 at 19:45 -0800, jerry wrote: Hi, I have the following URL dispatch setup -- __init__.py config.add_route('user', '/user') config.add_route('user_id', '/user/{user_id}') config.scan() /__init.py__ views/user.py @view_config(route_name='user', renderer='user.genshi') @view_config(route_name='user_id', renderer='user_id.genshi') def user_view(request): /views/user.py which works fine. However, my unit test case always gets routed to 'user' instead of 'user_id' no matter how I tweak the request.path_info -- test_user_view.py request = DummyRequest() request.path_info = route_url('user_id', request, user_id=u'42') #request.path_info = '/user/42' resp = views.user.user_view(request) /test_user_view.py I'm sure I must be missing something very simple there. route_url returns a fully qualified URL (with host, scheme, port, path). You probably want route_path. Not sure if this is the problem you're writing about, but it's *a* problem. I actually don't understand the question, to be honest. You're explicitly calling user_view. No routing is actually happening; you're not running a request through the router. What are you trying to test? If you're trying to write a functional test, do it like this instead: file:///home/chrism/projects/pyramid/docs/_build/html/narr/testing.html#creating-functional-tests - C -- 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.
[Pyramid] How to Unit Test Views Returning HTTPFound?
Hi, When a view returns HTTPFound, how should I write unit test that follows the (possible multiple) redirection and asserts the final response? Thanks in advance! Jerry -- 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.
Pyramid unittest DummyRequest no attribute 'session'
Since I'm using pyramid_beaker session, my unittest fails -- ... session = request.session AttributeError: 'DummyRequest' object has no attribute 'session' What best-practice solution would you recommend? Thanks in advance. Jerry -- 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: Pyramid unittest DummyRequest no attribute 'session'
Thanks Chris. This /is/ what I am doing -- def DummyRequest(): req = testing.DummyRequest() req.session = {} # dummy beaker session return req But would you consider adding the dummy session to the module? Jerry On Dec 9, 9:41 pm, Chris McDonough chr...@plope.com wrote: You might get away with request.session = {} - C On Thu, 2010-12-09 at 05:35 -0800, jerry wrote: Since I'm using pyramid_beaker session, my unittest fails -- ... session = request.session AttributeError: 'DummyRequest' object has no attribute 'session' What best-practice solution would you recommend? Thanks in advance. Jerry -- 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.
Pyramid Genshi Template Renderer Configuration
Hi, While waiting for pyramid_chameleon_genshi to stabilize (I've had a few bugs/glitches in 0.2), is there a way to configure the genuine Genshi to be the default renderer without going through -- from genshi.template import TemplateLoader loader = TemplateLoader([os.path.sep.join([here, 'templates'])]) tmpl = loader.load('template.genshi') c = {'foo': 'bar'} return Response(tmpl.generate(**c).render()) in every view function? Thanks. Jerry -- 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: The (missing) argument for pyramid
Does anyone have the roughest ball-park estimation on when pyramid will be going beta? Thanks. Jerry On Nov 15, 7:19 am, Ben Bangert b...@groovie.org wrote: On Nov 14, 2010, at 1:54 PM, BrianTheLion wrote: I've been away for a while and am trying to come up to speed on some pretty significant developments in the pylons community. I've spent considerable time with the pyramid docs in the last week but have failed to find an answer to one very important question: If your goal (like mine) is to build web apps, what reasons do you have to switch to pyramid? If you don't need the extensibility, if you're building a single app for the whole company. You probably don't have much reason to change at all. The fact that you haven't seen some pyramid add-on you're dying to use already sort of answers that. Let me engage in a bit of flame-fanning here just to make a point. As of right now, pyramid and pylons (v1.0) are, effectively, competing technologies. They are competing for the mindshare amongst Python web application developers. When our BDFLs tell us that pyramid is an improvement over pylons, I believe them but I don't particularly care. As an app-dev, I am pretty much agnostic to things like pylon's extensibility model (http://docs.pylonshq.com/faq/ pylonsproject.html#why-not-just-continue-developing-the-pylons-1-0- code-base). What I care about is how quickly and easily I can get my app up and running, how easy it will be to support and maintain. Bottom line, I think the BDFLs have punted on making a pro-pyramid technical argument to their app-devs, maybe because there isn't one to be made. We aren't preaching the gospel on Pyramid right now because it's still alpha. As I mentioned on my blog, I'll be writing posts about things Pyramid addresses in the future, until then, I'm sorry, but you'll have to wait like everyone else. I only have so much time in the day, I have to budget my time very carefully. Flame-fanning finished. And I was lying about not caring. *I BELIEVE* and I want to see pyramid go forward. But in the end app-devs are the least of pyramid's worries; we're always looking for excuses to learn new things. Middle managers are much more difficult to convince. Hence, I'm calling for some management-friendly pro-pyramid propaganda:https://github.com/Pylons/pylonshq/issues/issue/2. If you're an app-dev trying to figure out how you're going to convince your manager to let you learn pyramid, bump it up! When we're ready for management types to move entire development shops to Pyramid, we'll have that documentation. Right now, the focus isn't on that, its on getting things done so that such a case will be trivial to make in the future. Cheers, Ben -- 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 marketing, ( new thread from web tech )
Guys, there is obviously a lot of passion and love being ignited in this thread, but instead of talking inward among ourselves here, imagine how much influence can be generated if the same messages are blogged/twittered to the outside world. So don't bother Ben with non-tech proposals. He is the engineering director, we all are marketing VPs. Jerry On Aug 25, 7:45 am, Ben Bangert b...@groovie.org wrote: On Aug 24, 2009, at 4:13 PM, Iain Duncan wrote: That's cool, but Ben still has to show some interest if you guys want it to happen. I would put time in, but I better see that it's not going to be wasted or unwanted effort, because like you guys, I have code to write too! As Phil Jenvey mentioned earlier, we both watch twitter and other blog tracking services to try and speak up when we see opportunities. As I've mentioned before, I'd love to see people contribute to both marketing, and the site (which is part of why its code is open- sourced). What other signs of interest should I be providing? Cheers, Ben --~--~-~--~~~---~--~~ 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 marketing, ( new thread from web tech )
I want to chime in on this Pylons marketing topic -- I'm sure many, if not all, of you are also Hacker News ( http://news.ycombinator.com/ ) readers, so why not piggyback by commenting on the Django/Python web framework related threads there, especially those not-so-positive reviews such as this recent one -- Dropping Django ( http://www.recruititassociates.com/jobs/job.aspx?jobid=2743 ) to promote awareness/interest on Pylons? The sad news is that I always found myself being the only one doing that and not recognizing the familiar names here over there -- I hope I'm under the wrong impression. There are many times more founders/evangelists on HN than on any pure tech forum like this one, and every conversion gained over there effectively means winning potentially dozens of developers under/ around them. Marketing just requires a bit of persistence, and if Seth Godin and Tim Ferriss can do it, we sure can as well. Thoughts? Jerry On Jul 20, 5:11 am, Iain Duncan iaindun...@telus.net wrote: Taking Ben's suggestion, I just went ahead created a new thread. Mike Orr said: I have started a Talking Points wiki page to gather the essential points. Please add anything that's missing. http://wiki.pylonshq.com/display/pylonscommunity/Talking+Points Thanks Mike, what do you and the other core team propose we do from here with this starting point? It is probably the area where I can most helpfully contribute to Pylons, as I've done a fair bit of sales/marketingstuff and as I mentioned, I feel I have a real vested interest in making sure that clients feel good about the future viability of Pylons ( and Repoze, Pypes, etc ). As cheesy as it sounds ( and we don't have to call it that ), I think we need a clear Pylons Vision Statement. The purpose and future goals of Pylons distilled into a few very clear sentences that help separate it from competition, but in a realistic and accurate manner. IMHO, I believe this has been one the main problems for TG, no real clear vision on what the framework was trying to provide and for whom. Some wanted it to be a django-competitor, others something different, and that has been an elephant in the room for too long now. iain --~--~-~--~~~---~--~~ 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: Javascript in template
First of all, this question has _nothing_ to do with Pylons -- if you didn't know about it, you do now. Second, it seems that you have intentionally renamed the downloaded JavaScript library, so I think the first point to check can be: Is your installed copy accessed at http://yourserver/js/calendar.js ? Third, a bare-bone working HTML example (not tested) would be -- html head script type=text/javascript src=/js/ dhtmlgoodies_calendar.js/script /head body form input type=button value=Cal onclick=displayCalendar (document.forms[0].theDate,'/mm/dd',this) / /form /body /html Fourth, I can't stop myself from warning you that that site is providing very sloppy (reads BAD) HTML example with non-progressive (reads BAD) JavaScript usage which does not even get rendered properly in Firefox. The same effect can be achieved 42 times more elegantly with any modern unobstructive JavaScript libraries such as JQuery, Prototype, etc. Finally, I think you should show more effort by reading up on the HTML basics first. Jerry On Mar 6, 4:34 am, menshikoval...@gmail.com menshikoval...@gmail.com wrote: Hello. How to use JavaScript in template form? I'v add script src='/js/calendar.js'/script input type=text value=2004/02/02 readonly name=theDate input type=button value=Cal onclick=displayCalendar (document.forms[0].theDate,'/mm/dd',this) http://www.dhtmlgoodies.com/index.html?page=calendarScripts Alexy --~--~-~--~~~---~--~~ 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 0.9.7 released
My most sincere congratulations and tons of thanks to all the Pylons heros! Jerry On Feb 23, 2:46 pm, Ben Bangert b...@groovie.org wrote: Pylons 0.9.7 has been released, I've posted a full write-up on it on the PylonsHQ site:http://pylonshq.com/articles/archives/2009/2/pylons_097_released Cheers, Ben smime.p7s 3KViewDownload --~--~-~--~~~---~--~~ 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 ForEach doesn't obey not_empty=True
Hi, Have you tried -- not_tested ForEach(Int(not_empty=True), ...) /not_tested Jerry On Jan 26, 5:33 am, eleith ele...@gmail.com wrote: for my schema, i want to handle delete?id=100 delete?id=100id=101id=102 and throw an error for delete? - my validators look like this: id = ForEach(Int(), not_empty=True, convert_to_list=True) however, this passes when even when i don't pass in an 'id' i've even tried All(NotEmpty(), ForEach()) that doesn't work either. i've ended up writing my own function and subclassing into SimpleFormValidator to handle this case for me (i just check if the len(values['id']) 1, and return an error message) so either i'm going about this the wrong way, or there is an error in ForEach and/or All. any suggestions? (although, i'm happy with my solution, just thought i would publish my findings) --~--~-~--~~~---~--~~ 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: Can't deploy with FastCGI on Apache2
[Sun Jan 18 23:15:59 2009] [error] [client 127.0.0.1] Error - class 'genshi.template.eval.UndefinedError': {...} has no member named flash_obj Are you trying to render some TG flash_obj stuff? Hint, Pylons WebHelpers usage: http://groups.google.com/group/pylons-discuss/msg/18e9f84bf7533041 Jerry On Jan 22, 7:20 am, Gustavo Narea m...@gustavonarea.net wrote: Anyone? On Sunday January 18, 2009 23:29:31 Gustavo Narea wrote: Hello, I've tried the tutorial at http://wiki.pylonshq.com/display/pylonscookbook/Production+Deployment... g+Apache, +FastCGI+and+mod_rewrite, but I can't get it to work. As suggested on the tutorial, I made a first try with CGI (using the attached script) but I get the error found in the attached log. What's the problem? Thanks in advance. PS: The last line is run_with_cgi(wsgi_app).run(), but I replaced it to run_with_cgi(wsgi_app) as you'll see in the script. -- Gustavo Narea http://gustavonarea.net/. Get rid of unethical constraints! Get freedomware:http://www.getgnulinux.org/ --~--~-~--~~~---~--~~ 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?
Yes. And that's because if the same question is asked in a Django group, you'll probably get far more similar trolls. Jerry On Jan 18, 7:05 pm, walterbyrd walterb...@iname.com wrote: And if so, why? --~--~-~--~~~---~--~~ 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: Paster controller command not recognized
Of course, all the available paster commands are in the Commands section -- $ paster -h Usage: paster [paster_options] COMMAND [command_options] Options: --version show program's version number and exit --plugin=PLUGINS Add a plugin to the list of commands (plugins are Egg specs; will also require() the Egg) -h, --helpShow this help message Commands: create Create the file layout for a Python distribution help Display help make-config Install a package and create a fresh config file/ directory points Show information about entry points post Run a request for the described application request Run a request for the described application serveServe the described application setup-appSetup an application, given a config file And your question was? Jerry On Jan 16, 10:22 am, Bryan bryanv...@gmail.com wrote: I am inside a Pylons project. The project is called jobtrax. The shell session in my previous post all occurs in the jobtrax project folder: b...@brysrv:~/jobtrax$ paster controller home Command controller not known On Jan 13, 7:39 pm, Jorge Vargas jorge.var...@gmail.com wrote: On Thu, Jan 8, 2009 at 1:30 PM, Bryan bryanv...@gmail.com wrote: When I run paster controller controller name, i get an error: Command controller not known I have a .egg-info directory, and a paster_plugins.txt file in it with Pylons, WebHelpers, PasteScript inside on separate lines. I own all the files and directories, and am running the paster command inside of the distribution folder. Why can't paster find my paster_plugins.txt settings? paster controller is a package command, which means it won't work unless you are inside a pylons project, I don't remember right now what exactly determines that but it's a functionality of PasteScript --~--~-~--~~~---~--~~ 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: How to use Genshi to implement the SimpleSite example of the pylonsbook?
index.html ?xml version=1.0 encoding=utf-8? !--! You should read the Geddit tutorial: http://genshi.edgewall.org/wiki/GenshiTutorial -- html xmlns=http://www.w3.org/1999/xhtml; xmlns:py=http:// genshi.edgewall.org/ xmlns:xi=http://www.w3.org/2001/XInclude; py:match path=head once=true head py:attrs=select('@*') title${c.title}title/ div py:strip=True${select('*|text()')}/div /py:match py:match path=body once=true body py:attrs=select('@*') SimpleSite a name=top / h1${c.heading or 'No Title'}/h1 ... div py:strip=True${select('*|text()')}/div /body /py:match /html view.html ?xml version=1.0 encoding=utf-8? html xmlns=http://www.w3.org/1999/xhtml; xmlns:py=http:// genshi.edgewall.org/ xmlns:xi=http://www.w3.org/2001/XInclude; xi:include href=index.xml parse=xml / head / body${c.page.content}/body /html -- Jerry On Dec 24, 4:19 am, johntable liij...@gmail.com wrote: HI, I am reading the pylonsbook, and I want to use Genshi to implate the SimpleSite example. But I find it is not as easier as using Mako or Jinja to implate the layout. Who can give me the Genshi examples of index.html and view.html? Thanks very much!! index.html: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01//EN http://www.w3.org/TR/html4/strict.dtd; html head title${self.title()}/title ${self.head()} /head body ${self.header()} ${self.tabs()} ${self.menu()} ${self.heading()} ${self.breadcrumbs()} ${next.body()} ${self.footer()} /body /html %def name=title()SimpleSite/%def %def name=head()/%def %def name=header()a name=top/a/%def %def name=tabs()/%def %def name=menu()/%def %def name=heading()h1${c.heading or 'No Title'}/h1/%def %def name=breadcrumbs()/%def %def name=footer()pa href=#topTop ^/a/p/%def view.html: %inherit file=/base/index.html/ %def name=title()${c.page.title}/%def %def name=heading()h1${c.page.heading or c.page.title}/h1/ %def ${c.page.content} --~--~-~--~~~---~--~~ 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: serving up generated images
Hi, You should find this thread helpful -- http://groups.google.com/group/pylons-discuss/browse_thread/thread/70fb565a909c72f0/aae0f836d23e62a2?lnk=gstq=dataapp#aae0f836d23e62a2 Jerry On Dec 8, 5:40 am, erowan [EMAIL PROTECTED] wrote: Hello, I have a web app that dynamically generates images (png files). The main html response page has links to these files i.e. a href=/tmp/demand.png title=/tmp/demand img id=/tmp/demand src=/tmp/demand.png width=300 height=200 / I created the tmp dir under public and while running pylons in development this worked ok. Basically these filepaths resolved to the same location. 1. os.path.join(config['app_conf']['public_dir'], 'tmp', filename) 2. graph_file_name = h.url_for('/tmp/' + str(graph_file_name)) However, after packaging, install deploying the app with the same config file dev.ini python setup.py bdist_egg easy_install bmra_web-0.1.0dev-py2.5.egg cd some_deployment_dir paster serve dev.ini The dirs are not the same. 1 is but 2 resolves under the ~site- packages/bmra_web-0.1.0dev-py2.5.egg installation dir. I am not sure how to handle this? Should I be using another StaticURLParser instance for this tmp directory combined with Casade and maybe name it _tmp (does this bypass the routes dispatching?). I am a bit confused as to how to handle this. Thanks. --~--~-~--~~~---~--~~ 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: Announcement of Pylons Powered Site
Hi Zoogie, First of all, congratulations on making the right decision with Pylons (not saying other choices are wrong... :), whose learning curve _will be_ steeper than those of its peers, but its payoff will more than offset the investment. Back when I started, I had to Dive Into Python [http:// diveintopython.org/] before anything else. I particularly like its approach of being pragmatic, i.e., demonstrating incremental steps of a (semi-)real life project, rather than showing Hello-World examples chapter after chapter, and it even has a nice blend of some best practice (TDD!). Then I read from cover-to-cover the Pylons Wiki [http:// wiki.pylonshq.com/dashboard.action], following every step of the tutorials. Of course nowadays a nicer trail is laid out in The Pylons Book [http://pylonsbook.com/]. I chose Genshi as my template engine and found Christopher's Geddit Tutorial [http://genshi.edgewall.org/ wiki/GenshiTutorial] of great help. While trying to grasp the WSGI concept, I had to read PEP 333 [http:// www.python.org/dev/peps/pep-0333/] more than 10 tens (seriously, and still not digesting 100% its concepts). As for database/SQL, I read half of Joe Celko's SQL for Smarties: Advanced SQL Programming [http://www.amazon.com/Joe-Celkos-SQL- Smarties-Programming/dp/1558605762], which prepared me for the more advanced topics (Joe Celko's Trees and Hierarchies in SQL for Smarties [http://www.amazon.com/Hierarchies-Smarties-Kaufmann- Management-Systems/dp/1558609202/ref=pd_sim_b_1/181-5524468-1861956]). I subscribe to the pgsql.sql Google Group [http://groups.google.com/ group/pgsql.sql/topics], a low-volume news group for intermediate to advanced (pl)SQL related discussions. I also read RESTful Web Services [http://www.amazon.com/RESTful-Web- Services-Leonard-Richardson/dp/0596529260/ref=sr_1_1? ie=UTF8s=booksqid=1225817701sr=1-1] to acquire basic understanding of REST before designing my routes. Frontend side, I chose jQuery so Learning jQuery [http:// www.amazon.com/Learning-jQuery-Interaction-Development-JavaScript/dp/1847192505/ref=sr_1_1?ie=UTF8s=booksqid=1225818141sr=1-1] becomes a must-read. From not too long ago I started to subscribe to unofficial planet python [http://www.planetpython.org/] and find it worth recommending. Last but not the least, how can I leave out the classic Test Driven Development: By Example [http://www.amazon.com/Test-Driven- Development-Addison-Wesley-Signature/dp/0321146530/ref=sr_1_1? ie=UTF8s=booksqid=1225817901sr=1-1] -- just wish it comes with an automatic cane that will whip me every time that I fail to write a test first. Learning is an arduous process, but every sequoia starts from a tiny seed, all we need to do is stand taller than yesterday, in good times or not [http://venturebeat.com/2008/10/10/the-sequoia-rip-good-times- presentation-get-your-copy-here/]. Jerry On Nov 3, 8:07 pm, [EMAIL PROTECTED] wrote: Jerry, very inspiring. Well done. I am where you were a year and a half ago. Trying to learn Pylons , but realizing I have to learn cgi (at least to get a better understanding of the big picture), sql etc. It gets a little confusing. Do you mind sharing some of your learning resources, and probably even the order of learning that made most sense? thanks Zoogie --~--~-~--~~~---~--~~ 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: Announcement of Pylons Powered Site
One day, I'm going to start my own blog, even if just for correcting all those broken links. Jerry On Nov 4, 2:23 pm, jerry [EMAIL PROTECTED] wrote: Hi Zoogie, First of all, congratulations on making the right decision with Pylons (not saying other choices are wrong... :), whose learning curve _will be_ steeper than those of its peers, but its payoff will more than offset the investment. Back when I started, I had to Dive Into Python [http:// diveintopython.org/] before anything else. I particularly like its approach of being pragmatic, i.e., demonstrating incremental steps of a (semi-)real life project, rather than showing Hello-World examples chapter after chapter, and it even has a nice blend of some best practice (TDD!). Then I read from cover-to-cover the Pylons Wiki [http:// wiki.pylonshq.com/dashboard.action], following every step of the tutorials. Of course nowadays a nicer trail is laid out in The Pylons Book [http://pylonsbook.com/]. I chose Genshi as my template engine and found Christopher's Geddit Tutorial [http://genshi.edgewall.org/ wiki/GenshiTutorial] of great help. While trying to grasp the WSGI concept, I had to read PEP 333 [http://www.python.org/dev/peps/pep-0333/] more than 10 tens (seriously, and still not digesting 100% its concepts). As for database/SQL, I read half of Joe Celko's SQL for Smarties: Advanced SQL Programming [http://www.amazon.com/Joe-Celkos-SQL- Smarties-Programming/dp/1558605762], which prepared me for the more advanced topics (Joe Celko's Trees and Hierarchies in SQL for Smarties [http://www.amazon.com/Hierarchies-Smarties-Kaufmann- Management-Systems/dp/1558609202/ref=pd_sim_b_1/181-5524468-1861956]). I subscribe to the pgsql.sql Google Group [http://groups.google.com/ group/pgsql.sql/topics], a low-volume news group for intermediate to advanced (pl)SQL related discussions. I also read RESTful Web Services [http://www.amazon.com/RESTful-Web- Services-Leonard-Richardson/dp/0596529260/ref=sr_1_1? ie=UTF8s=booksqid=1225817701sr=1-1] to acquire basic understanding of REST before designing my routes. Frontend side, I chose jQuery so Learning jQuery [http://www.amazon.com/Learning-jQuery-Interaction-Development-JavaScript/dp/...] becomes a must-read. From not too long ago I started to subscribe to unofficial planet python [http://www.planetpython.org/] and find it worth recommending. Last but not the least, how can I leave out the classic Test Driven Development: By Example [http://www.amazon.com/Test-Driven- Development-Addison-Wesley-Signature/dp/0321146530/ref=sr_1_1? ie=UTF8s=booksqid=1225817901sr=1-1] -- just wish it comes with an automatic cane that will whip me every time that I fail to write a test first. Learning is an arduous process, but every sequoia starts from a tiny seed, all we need to do is stand taller than yesterday, in good times or not [http://venturebeat.com/2008/10/10/the-sequoia-rip-good-times- presentation-get-your-copy-here/]. Jerry On Nov 3, 8:07 pm, [EMAIL PROTECTED] wrote: Jerry, very inspiring. Well done. I am where you were a year and a half ago. Trying to learn Pylons , but realizing I have to learn cgi (at least to get a better understanding of the big picture), sql etc. It gets a little confusing. Do you mind sharing some of your learning resources, and probably even the order of learning that made most sense? thanks Zoogie --~--~-~--~~~---~--~~ 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: Announcement of Pylons Powered Site
Hi MilesTogoe, Honestly, who has 6 mos to do all that reading ? While I do understand and appreciate some of the real-life constraints, I strive to fight similar opinion whenever I see one. Unfortunately, I can't do a direct strong counter-argument, but I can show how evil can creep in faster than you realize by bringing up the following -- Who has time to do a scalable architecture? -- Friendster (OK, you can argue that Twitter said the same thing, but few actually use Twitter as an excuse when questioned by a VC) Who has time to learn Python, let's just keep using Perl/VBScript! -- Joel the programmer And if it cannot get running in 10 minutes - scrap it and start over. For seasoned developers like you who have rich experience in other frameworks, I think it's possible. Jerry On Nov 4, 5:56 pm, MilesTogoe [EMAIL PROTECTED] wrote: Garland, Ken R wrote: Hey Jerry, I've read and follow most of what you listed and found it all most helpful. Another HUGE help for me were IRC channels like #pylons, #python, #sqlalchemy and others on freenode. This allowed me to learn from others and pass on knowledge. It is surprising how helpful it is to help others in that not only do you add another way in which to retain the knowledge but also realize things you might not have known by helping others that think differently and need things explained in different ways. Honestly, who has 6 mos to do all that reading ? A framework with a heavy learning curve doesn't imply it's more professional, just a harder to use package. Hey, you need to get a site up and running as quick and agile as possible to see if it even will work market or client wise. Most fail so where's the ROI with a heavy learning curve? I've been watching and hoping for an improved, easier to use Pylons (why I follow this list) but in the meantime, I'm getting stuff running after days using the Werkzeug stack and yes, even Rails. Learning curves cost serious money and opportunity cost - until you know that you really need a high horsepower site - get something running quick - besides, it's a lot more fun. So yes, Pylons does need a 10 minute blog tutorial! And if it cannot get running in 10 minutes - scrap it and start over. On Tue, Nov 4, 2008 at 2:40 PM, jerry [EMAIL PROTECTED] wrote: One day, I'm going to start my own blog, even if just for correcting all those broken links. Jerry On Nov 4, 2:23 pm, jerry [EMAIL PROTECTED] wrote: Hi Zoogie, First of all, congratulations on making the right decision with Pylons (not saying other choices are wrong... :), whose learning curve _will be_ steeper than those of its peers, but its payoff will more than offset the investment. Back when I started, I had to Dive Into Python [http:// diveintopython.org/] before anything else. I particularly like its approach of being pragmatic, i.e., demonstrating incremental steps of a (semi-)real life project, rather than showing Hello-World examples chapter after chapter, and it even has a nice blend of some best practice (TDD!). Then I read from cover-to-cover the Pylons Wiki [http:// wiki.pylonshq.com/dashboard.action], following every step of the tutorials. Of course nowadays a nicer trail is laid out in The Pylons Book [http://pylonsbook.com/]. I chose Genshi as my template engine and found Christopher's Geddit Tutorial [http://genshi.edgewall.org/ wiki/GenshiTutorial] of great help. While trying to grasp the WSGI concept, I had to read PEP 333 [http://www.python.org/dev/peps/pep-0333/] more than 10 tens (seriously, and still not digesting 100% its concepts). As for database/SQL, I read half of Joe Celko's SQL for Smarties: Advanced SQL Programming [http://www.amazon.com/Joe-Celkos-SQL- Smarties-Programming/dp/1558605762], which prepared me for the more advanced topics (Joe Celko's Trees and Hierarchies in SQL for Smarties [http://www.amazon.com/Hierarchies-Smarties-Kaufmann- Management-Systems/dp/1558609202/ref=pd_sim_b_1/181-5524468-1861956]). I subscribe to the pgsql.sql Google Group [http://groups.google.com/ group/pgsql.sql/topics], a low-volume news group for intermediate to advanced (pl)SQL related discussions. I also read RESTful Web Services [http://www.amazon.com/RESTful-Web- Services-Leonard-Richardson/dp/0596529260/ref=sr_1_1? ie=UTF8s=booksqid=1225817701sr=1-1] to acquire basic understanding of REST before designing my routes. Frontend side, I chose jQuery so Learning jQuery [http://www.amazon.com/Learning-jQuery-Interaction-Development-JavaScr..] becomes a must-read. From not too long ago I started to subscribe to unofficial planet python [http://www.planetpython.org/] and find it worth recommending. Last but not the least, how can I leave out the classic Test Driven Development: By Example [http://www.amazon.com/Test-Driven- Development-Addison-Wesley-Signature/dp/0321146530/ref=sr_1_1? ie=UTF8s
Re: Javascript library
Hi Rech, jQuery + markitup [http://markitup.jaysalvat.com/examples/] Jerry On Nov 4, 5:43 pm, Mr.Rech [EMAIL PROTECTED] wrote: Hi all, I'm starting to play with Pylons since I need to develop a web app here at work. I've been reading the Pylons book, a lot of documentation, many threads on the forum etc. I enjoy Pylons, it's much better than other tools I'm used to. Anyway it has a lot of different components and it's not always so easy to choose the right one. So I decided to stick with those components that come with Pylons out of the box: Mako, SQLAlchemy, WebHelpers and so on, and I must say that I'm happy with them. However, I'm a little bit lost about Javascript library, since, as far as I can understand, from version 0.9.7 there is no default Javascript library. So, I'm asking you which library you are using and why. As for me, I have only few major needs: 1) I need a WYSIWYG editor like Tinymce (http:// tinymce.moxiecode.com/) for textareas 2) I'd like the Javascript framework can save me as much as possible from digging into javascript code (I'm worried about javascript tricks and compatibility isssues) 3) I need AJAX and some Javascript visual effects to make the application more appealing 4) The Javascript framework should let me develop fast (sorry, but I've some strict time constraints and my boss is not very patient ;) I've looked at MochiKit that seems quite promising, but I haven't heard anyone here using it. In the Pylons Book James Gardner introduces YUI that seems quite good, but I've tried its WYSIWYG editor and it has some glitches. I wouldn't start a religious war here, I'd just like to know what Pylons people are used to use in their applications and why. Hope you can help me. Thanks in advance, Andrea --~--~-~--~~~---~--~~ 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: unknown database
sqlalchemy.exc.OperationalError: (OperationalError) (1049, Unknown database 'mytest'') None None .^ [app:main] ... sqlalchemy.url = mysql://mysqluser:[EMAIL PROTECTED]:3306/mytest' .^ Isn't there a redundant single quote character there? Jerry On Nov 1, 7:05 pm, [EMAIL PROTECTED] wrote: Hi all, I'm new to pylons and getting the following error while trying to follow the SQLAlchemy tutorial. $ paster setup-app development.ini 17:48:27,604 INFO [im.websetup] Creating tables Running setup_config() from im.websetup Traceback (most recent call last): File /usr/bin/paster, line 8, in module load_entry_point('PasteScript==1.6.3', 'console_scripts', 'paster') () File /usr/lib64/python2.5/site-packages/PasteScript-1.6.3-py2.5.egg/ paste/script/command.py, line 79, in run invoke(command, command_name, options, args[1:]) File /usr/lib64/python2.5/site-packages/PasteScript-1.6.3-py2.5.egg/ paste/script/command.py, line 118, in invoke exit_code = runner.run(args) File /usr/lib64/python2.5/site-packages/PasteScript-1.6.3-py2.5.egg/ paste/script/appinstall.py, line 68, in run return super(AbstractInstallCommand, self).run(new_args) File /usr/lib64/python2.5/site-packages/PasteScript-1.6.3-py2.5.egg/ paste/script/command.py, line 213, in run result = self.command() File /usr/lib64/python2.5/site-packages/PasteScript-1.6.3-py2.5.egg/ paste/script/appinstall.py, line 456, in command self, config_file, section, self.sysconfig_install_vars(installer)) File /usr/lib64/python2.5/site-packages/PasteScript-1.6.3-py2.5.egg/ paste/script/appinstall.py, line 598, in setup_config mod.setup_app, command, filename, section, vars) File /usr/lib64/python2.5/site-packages/PasteScript-1.6.3-py2.5.egg/ paste/script/appinstall.py, line 612, in _call_setup_app func(command, conf, vars) ... (cut to shorten output) File /usr/lib64/python2.5/site-packages/SQLAlchemy-0.5.0rc2- py2.5.egg/sqlalchemy/pool.py, line 280, in __connect connection = self.__pool._creator() File /usr/lib64/python2.5/site-packages/SQLAlchemy-0.5.0rc2- py2.5.egg/sqlalchemy/engine/strategies.py, line 80, in connect raise exc.DBAPIError.instance(None, None, e) sqlalchemy.exc.OperationalError: (OperationalError) (1049, Unknown database 'mytest'') None None My myapp.model.__init__.py is ... import sqlalchemy as sa from sqlalchemy import orm from myapp.model import meta def init_model(engine): sm = orm.sessionmaker(autoflush=True, autocommit=True, bind=engine) meta.engine = engine meta.Session = orm.scoped_session(sm) t_item = sa.Table('item', meta.metadata, sa.Column('id', sa.types.Integer, primary_key=True), sa.Column('name', sa.types.String(32)), sa.Column('description', sa.types.String(32)), sa.Column('quantity', sa.types.Integer)) class Item(object): def __str__(self): return self.title orm.mapper(Item, t_item) And in my development.ini I have the database listed as ... ... [app:main] use = egg:im full_stack = true sqlalchemy.url = mysql://mysqluser:[EMAIL PROTECTED]:3306/mytest' sqlalchemy.pool_recycle = 3600 cache_dir = %(here)s/data beaker.session.key = im beaker.session.secret = somesecret Anyone have an idea what's going on? --~--~-~--~~~---~--~~ 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: Announcement of Pylons Powered Site
Hi Matt, It _is_ a lot of effort. Forgot to mention back 1.5 years ago I started from _absolute scratch_ that I had never written a Python program before, never written an full HTML page before, never written a single line of JavaScript program before, never used a web framework before, never used PostgreSQL and never even worked to join more than 2 tables before... And the feeling of learning all those is really good, as good as launching a site. :) Jerry On Oct 29, 6:27 pm, Matthew Woolnough [EMAIL PROTECTED] wrote: Wow. That's quite a lot of effort. I know how it is to work on a long project like that on your own. You must feel very relieved to have it in production now. Congrats! On 30/10/08 8:18 AM, jerry [EMAIL PROTECTED] wrote: Hi Matt, I did it alone part-time during the past 1.5 years, that's probably 2500+ man hours. Jerry On Oct 29, 6:03 pm, Matthew Woolnough [EMAIL PROTECTED] wrote: Hey Jerry, Well done! I've been lurking in the sidelines for sometime now, and am yet to dip my toes in the Pylons pool. Its its not too much to ask, approx how many man hours did it take to get this site to this state? I'm interested in doing a baby site also! Matt On 30/10/08 7:47 AM, jerry [EMAIL PROTECTED] wrote: pher Lenz, and many others who have brought these fantastic tools and patiently answered my n --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Pylons under fapws(2)
Hi, As my paster server, no matter how its thread and process config values are tweaked, can't even get above 20 [#/s], I've been struggling to run my Pylons app under fapws2. Does any kind soul have a quick Pylons+fapws2 configuration/tutorial to share? Thanks in advance. Jerry --~--~-~--~~~---~--~~ 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 jquery - restricting POST calls
With your current design, you can't. For my site, I do not have separate controllers/routes for AJAX, instead, different values are returned from a generic controller according to request type -- class ElementController(BaseController): def get(self, id): populate_c(id) if request.is_xhr: return render('ajax_fragment_template') return render('full_page_template') Jerry On Oct 15, 10:26 am, przemek.ch [EMAIL PROTECTED] wrote: Hi, I've build two select boxes. Onchange method on the first selectbox I fill with ajax the second one using the selected value as a parameter. It works. function loadElements(groupID){ $(#secondSelectDiv).load(${h.url_for(controller='ajax', action='getElements', id='')}+groupID); } The problem is that an url is generated to my method. for examplehttp://localhost:5000/ajax/getElements/1 And it can be called directly from the browser. How can I hide or block that. If I'll use from pylons.decorators.rest @restrict('POST') on the method then it will also be blocked for the jquery load method. Any ideas? --~--~-~--~~~---~--~~ 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: Dynamic Template Inclusion in Genshi
Hi EricHolmberg, Thank you very much for the tip. On Genshi group, kindy offered a similar, but somewhat more concise, solution (http://groups.google.com/group/genshi/msg/c47bca2e4b0fd996), which I adopted as -- Pylons controller WidgetController(BaseController): def index(self, id): c.widget_template = ( '''?xml version=1.0 encoding=utf-8?''' '''div xmlns=http://www.w3.org/1999/xhtml; ''' '''xmlns:py=http://genshi.edgewall.org/;''' '''${h.url_for(controller='item', action='index', id=c.id)}''' '''/div''') return render_genshi('master_template') Genshi master_template.html ?xml version=1.0 encoding=utf-8? ?python from genshi.template import MarkupTemplate ? html xmlns=... xmlns:py=... head / body div${MarkupTemplate(c.widget_template).generate(c=c, h=h)}/div /body /html How about documenting this recipe on the PylonsHQ? Jerry On Oct 8, 1:29 am, EricHolmberg [EMAIL PROTECTED] wrote: to insert arbitrary literal XML markup fragments. However, I still haven't figured out a way to _process_ the Genshi sub-template string _from inside another Genshi template_, i.e., I want the following to come out as '''/ widget''' -- ${_some_uber_magic_(h.url_for(controller='widget', action='index', id=None))} when dynamically included in another Genshi template. Ah, now that is a good question! I was thinking that you might be able to use the recursive='true' attribute, but I tested it and it doesn't work. I'm not sure if there is another clever way to do it. So off hand, the only thing I can think of is to either recursively render until the output doesn't change (really nasty for performance) or do a pre-render of the stuff from the database. See if this code might help: from genshi import XML from genshi.template import MarkupTemplate def get_url(): return '/widget' def PreRender(xml): # wrap in html tags to make genshi happy tmpl = html xmlns:py=http://genshi.edgewall.org/; xmlns:xi=http://www.w3.org/2001/XInclude; py:strip= %s /html % (xml) return MarkupTemplate(tmpl).generate(get_url=get_url) db_string = 'a href=${get_url()}Widget/a' strTemplate = html xmlns:py=http://genshi.edgewall.org/; xmlns:xi=http://www.w3.org/2001/XInclude; span py:replace=PreRender(db_string)/ /html tmpl = MarkupTemplate(strTemplate) stream = tmpl.generate(db_string=db_string, PreRender=PreRender) output = stream.render('xhtml') print output --~--~-~--~~~---~--~~ 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: Dynamic Template Inclusion in Genshi
Thank you (for being the first one to reply to my question :). I think what you meant was what can possibly be your problem querying a DB?. Well, there is no problem querying a DB -- either from inside the template or not. It's also trivial to do a -- ${Markup(divThis string comes from the DB/div)} to insert arbitrary literal XML markup fragments. However, I still haven't figured out a way to _process_ the Genshi sub-template string _from inside another Genshi template_, i.e., I want the following to come out as '''/ widget''' -- ${_some_uber_magic_(h.url_for(controller='widget', action='index', id=None))} when dynamically included in another Genshi template. Jerry On Oct 7, 8:03 pm, EricHolmberg [EMAIL PROTECTED] wrote: Forgive me if I misunderstood, but couldn't you either query the DB before the template is run or simply query the DB in the template? Just put in the ${query code here} construct... -Eric --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Dynamic Template Inclusion in Genshi
Hi, Sorry this is not a strict Pylons question, but I've got no answer from the Genshi group for 2 days. Question: How to dynamically include non-file templates in Genshi? This is my master template -- ?xml version=1.0 encoding=utf-8? html xmlns=... xmlns:py=... xmlns:xi=... head / body py:for each=widget_template in widget_templates xi:include href=[How to include widget_template here?] / /py:for /body /html where widget_template is a _string_ retrieved from a database -- ?xml version=1.0 encoding=utf-8? div xmlns=... xmlns:py=... py:strip=True div a href=${h.url_for(controller='...', action='...', id='...')} widget /a /div /div Any pointer will be greatly appreciated. Many thanks in advance! Jerry --~--~-~--~~~---~--~~ 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: how to rename and deploy a pylons app?
Hi, You don't rename your project, you name it anything and distribute it (http://wiki.pylonshq.com/display/pylonsdocs/Distributing+Your +Project), or add its absolute path (quick hack!) to your Python distribution/site-packages/easy-install.pth As for production deployment, there have been multiple related lengthy threads in this group. Proxy passing (Nginx) to paster serve is working fine for me. Jerry On Sep 22, 2:52 pm, wellhong [EMAIL PROTECTED] wrote: Hi all, I'm new to pylons and python web development. I've started working on an application on my workstation but: 1. would like to know how to rename the app (since I had come up with a random name). i've tried searching for this but nothing comes up 2. how to deploy an app to a production machine. i've gotten as far as just installing python 2.5 and mod_wsgi for apache 2. some of the examples aren't real clear as to some steps i should do next such as how to create the appropriate wsgi file to deploy the app and what not. also, has anyone done any comparisons as to which deployment scenario is the best? proxy pass? mod_wsgi? or fast cgi? Thanks! Dave --~--~-~--~~~---~--~~ 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: Cron jobs
I'm using No. 1, which I consider the (preferably only one) obvious way. No. 2 is too monkey-patching to me. No. 3 is not really about auxiliary cron jobs for your application. Jerry On Sep 1, 7:17 am, Pavel Skvazh [EMAIL PROTECTED] wrote: There seam to be different ways to get cron jobs with Pylons. In my case model has to be accessible in it. Found three articles on the wiki describing different approaches, which is rather confusing http://wiki.pylonshq.com/display/pylonscookbook/Cron+jobs+and+command...http://wiki.pylonshq.com/display/pylonscookbook/Running+cron+jobshttp://wiki.pylonshq.com/display/pylonscookbook/Scripts+for+paster+serve If anyone, who had experience getting this done, can please share a best practice on this matter? Thanks! --~--~-~--~~~---~--~~ 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: expiring cookie based session after a preset amt of time
This is what I do: set session['cookie_expires'] in login controller, then modify session.cookie_expires accordingly in lib/base.py -- def __before__(self, action): if not session.get('cookie_expires', True): session.cookie_expires = False else: session.cookie_expires = True Jerry On 6 Jul, 23:42, kevin [EMAIL PROTECTED] wrote: hello all, thanks for the great help so far. my first pylons project is going really well. i'm looking for a way to make the session/session cookie expire after a certain amount of time. an example of this behavior would be eBay, which expires a cookie session after 24 hours. i was looking at thishttp://wiki.pylonshq.com/display/beaker/Configuration+Options beaker.session.cookie_expires is probably what i want, but i am not sure how to set the time period in my .ini file. i see that it's supposed to take a timedelta object, but i can't instantiate one within the context of a config file (can i?). other docs i've seen only describe the session.cookie_expires option as only taking a boolean value. there's also beaker.session.timeout but that depends on the session being idle. am i missing something totally obvious? a follow-up to this question is, what's the proper way to implement the user's remember me preference checkbox. these are global settings for the server, i have poked around looking for the answer on the user's ability to set session.cookie_expires to True (session goes away on the closing of the browser), but my keywordese isn't good enough. --~--~-~--~~~---~--~~ 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: How to update data with sqlalchemy
I suggest putting an import pdb; pdb.set_trace() before the execute statement to inspect the type of WHChapter (and see for yourself that it is incorrect :) Jerry On Jul 15, 1:12 pm, JOLINY [EMAIL PROTECTED] wrote: Since i develope my application with pylons ,i have this question. when i want to do the update action to database. i use this method like this: def delt(self,id): systemtime=h.getSystemTime() userid=session['USER_KEY'].wh_userid meta.Session.execute(wh_chapter.WHChapter.update(values={del_flg:'1',update_time:systemtime})) meta.Session.commit() return redirect_to('/ma003') there is an error like this: type 'exceptions.AttributeError': type object 'WHChapter' has no attribute 'update' but i read the doc inhttp://www.sqlalchemy.org/docs/05/sqlexpression.html#sql_updatehas the same operate. I want to do this operation: update whchapter set del_flg='1', update_time=systemtime where userid=001 and chapterid=0003 who can tell me how to do it. thanks very much. joliny --~--~-~--~~~---~--~~ 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: How to pass (one-time) message to redirect_to page?
1. Thanks Mike, awesome! 2. messages stored in sessions mapped to a certain url -- I don't get it. 3. Thanks Jonathan (and silly me for not knowing/being able to come up with such a simple idea). Sincerely, Jerry On Jul 10, 11:11 pm, Jonathan Vanasco [EMAIL PROTECTED] wrote: There are 3 ways: 1- Use that new flash functionality. neat. 2- Do a session based message yourself. I often have messages stored in sessions mapped to a certain url, and visiting that url will display + clear out. 3- Have the redirect have an arg like ?success=1 or action=success As a rundown of the options. 1. I don't know how flash works. Mike will have to comment. 2. I prefer this, because I get a bit of control and can do custom validation and actions by storing retrieving info as i see fit. 3- This is honestly the most popular version - every large webapp, social network, even sites like facebook google myspace all go for that route. There's no sort of sessioning or validation, it just displays a standard 'success!' message on display. --~--~-~--~~~---~--~~ 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: Exposing database Id via URL
Thanks Jonthan. However, I wonder how an md5 string can be squeezed into a 10, or even 6-character field with no concern of (future) collision -- or am I mis- understanding your db schema? Sincerely, Jerry On Jul 5, 1:57 pm, Jonathan Vanasco [EMAIL PROTECTED] wrote: On Jul 4, 8:58 pm, jerry [EMAIL PROTECTED] wrote: But how? What encryption/hashing method could be used to transform the numeric IDs to something less obvious? all my apps have somthing like this in the db: table hexkey_types id , len , name --- 1, 10, useraccount:hex_id 2, 6, group:hex_id 3, 6, assetname:hex_id table hexkey hex_id primary, hexkey_type (fkey on hexkey_type(id)) table useraccount id , hex_id fkey on hexkey10 i just create random md5s whenever i make an entry into the db. when someone requests i record, i validate to make sure the hexid matches for the function ( are we requesting a 10char hex for a user? if so check memcached with db failover. if not , then don't bother ). storing a hex-to-numeric mapping in memcached makes it really low-impact. and no one knows what my internal mappings are. --~--~-~--~~~---~--~~ 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: Exposing database Id via URL
But how? What encryption/hashing method could be used to transform the numeric IDs to something less obvious? Sincerely, Jerry On Jul 4, 2:01 pm, Jonathan Vanasco [EMAIL PROTECTED] wrote: just some points on 'hiding' ids- - if you're doing a social media site, with numeric ids your competitors and the annoying industry blogs will be judging and guaging your popularity and success by sequence ids - by using the ids, you're good on a pylons app... but lets say you need to offload something onto php or another system accesses the same database -- one that is not hardened against sql injection attacks. you have now exposed your ids - which are fkeys and indexes - to the public through pylons and have a vulnerability elsewhere. the security risk might not be in pylons, but you've opened the door for abuse on your db through other apps. our practice has needed us to ensure security to clients, and i'm sick of reading bloggers judging the success of sites based on sequence numbers and not on the spirit and activity of the active members. so we hide that, and in all companies i consult to, i insist that they hide numeric ids on everything. --~--~-~--~~~---~--~~ 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: How to pass image?
class ImageController(BaseController): def view(self): image_content = binary data of your (generated) image / app = DataApp(image_content, content_type='image/jpeg') app.content_disposition(filename='%s.jpg' % image_name) return app(request.environ, self.start_response) Jerry On Jun 3, 5:05 pm, deezee [EMAIL PROTECTED] wrote: Hello everybody! I'm pretty new in Pylons world - today i downloaded and installed software. So, some stupid question: How to send (simplest way) image from PIL to template (browser) without saving file? I'm playing around helloworld sample, but i want to see picture instead of text. I can generate one by PIL, and send by c.image, but till now i just have PIL.Image.. marker, no image itself. In PHP it's quite simple, don't believe something newer is more complicated.. Ł --~--~-~--~~~---~--~~ 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: How to pass image?
from paste.fileapp import DataApp Jerry On Jun 3, 8:38 pm, jerry [EMAIL PROTECTED] wrote: class ImageController(BaseController): def view(self): image_content = binary data of your (generated) image / app = DataApp(image_content, content_type='image/jpeg') app.content_disposition(filename='%s.jpg' % image_name) return app(request.environ, self.start_response) Jerry On Jun 3, 5:05 pm, deezee [EMAIL PROTECTED] wrote: Hello everybody! I'm pretty new in Pylons world - today i downloaded and installed software. So, some stupid question: How to send (simplest way) image from PIL to template (browser) without saving file? I'm playing around helloworld sample, but i want to see picture instead of text. I can generate one by PIL, and send by c.image, but till now i just have PIL.Image.. marker, no image itself. In PHP it's quite simple, don't believe something newer is more complicated.. Ł --~--~-~--~~~---~--~~ 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: Controller name
Hi Mike, c.controller auto-assignment doesn't seem to be implemented in Routes1.8 -- (Pdb) list 22 def index(self): 23 import pdb; pdb.set_trace() 24 - #c.url_for_action = 'index' (Pdb) !c.controller 16:15:01,505 DEBUG [pylons.util] No attribute called controller found on c object, returning empty string '' Jerry On May 28, 11:30 am, Mike Orr [EMAIL PROTECTED] wrote: On Wed, May 28, 2008 at 3:50 AM, Christoph Haas [EMAIL PROTECTED] wrote: Hi, Antonia... first of all: please don't hijack threads. Start a new thread if you want to post to this list. Don't just reply to a random posting. On Mittwoch, 28. Mai 2008, Antonio Beamud Montero wrote: How I can get the controller name in the actual template context. For example, a site.mako template used by several controllers, I want to show the controller name with something like this: ${c.name} It's possible or I must define a property for every controller with it's name? The routes dictionary contains the information you are after: request.environ['pylons.routes_dict'] You cann add a def __before__(self) in the lib/base.py and fill a template variable with it to be used in the templates: c.routes = request.environ['pylons.routes_dict'] That would allows you to access the current controller's name in the template as: ${c.routes['controller']} Actually, it's easier than that: ${c.controller} Routing variables are automatically added to 'c'. -- Mike Orr [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Paste unquote/unquote_plus Question
Michi's post (http://groups.google.com/group/pylons-discuss/msg/ 325fedbbd2bc8163) repackaged (Let's see if we can attract Ian's attention :) I recently posted this message: http://groups.google.com/group/pylons-discuss/msg/fa8507fbb7ea6173 I think the issue is webhelper uses quote_plus to encode url while Paste uses unquote to decode url. So 1 + 1 gets encoded to 1+%2b+1 and it gets decoded to 1+++1. Is there any particular reason Paste doesn't use unquote_plus? Thanks! --Michi Jerry --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Routes (1.8) quote_plus issue?
Hi (Ben, Mike :), First of all, excuse me for not digging into the issue deeply enough myself (will do that when I reach home.) Routes 1.8 takes a href=/one+%2B+oneone + one/a and passes to my controller the undesirable id u'one+++one' I did notice from a quick grep through my site-packages/ that there are only a few quote_plus with no unquote_plus -- ~/lib/python2.5/site-packages$ grep --include=*.py -r quote_plus . | egrep -i paste|pylons|routes ./Routes-1.8-py2.5.egg/routes/util.py:A Unicode handling version of urllib.quote_plus. ./Routes-1.8-py2.5.egg/routes/util.py:return urllib.quote_plus(s, '/') ./Routes-1.8-py2.5.egg/routes/util.py: urllib.quote_plus(unicode(key).encode(encoding)), ./Routes-1.8-py2.5.egg/routes/util.py: urllib.quote_plus(unicode(value).encode(encoding ./Routes-1.8-py2.5.egg/routes/util.py: urllib.quote_plus(unicode(key).encode(encoding)), ./Routes-1.8-py2.5.egg/routes/util.py: urllib.quote_plus(unicode(val).encode(encoding Could that be a (known) Routes bug? Many thanks in advance! Jerry --~--~-~--~~~---~--~~ 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: url_for() constrcut URL with MultiDict parameters?
Hi Mike, Thanks for the response. I mentioned MultiDict as a convenient term to convey the idea in my question, not that I know or thought it would help with the implementation. As for the demand, I have a form with a list of checkbox input items for viewing the details of selected one(s). The receiving controller will naturally have multi-parameter URL like /details?q=1q=2 . Now I want to further enable adding more items in the details viewing list and need to have another form with probably hidden input items q=1 and q=2, finally when paging is involved for this form, the pager links will have to inherit the information of the existing parameters q=1q=2, hence the demand. However, it really doesn't seem to be an appealing design and I think I'm probably better off sticking with the more RESTful URL like details/1;2 Cheers, Jerry On Apr 29, 12:38 am, Mike Orr [EMAIL PROTECTED] wrote: On Mon, Apr 28, 2008 at 6:19 PM, jerry [EMAIL PROTECTED] wrote: Is there a way to construct URLs like /controller/action/id? q=1q=2 with url_for()? I don't think so. If there's demand for this we can turn a list of values into multiple parameters. Does MultiDict offer anything that would help with this? -- Mike Orr [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
url_for() constrcut URL with MultiDict parameters?
Hi, Is there a way to construct URLs like /controller/action/id? q=1q=2 with url_for()? Thanks in advance! Jerry --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Missing nose version on the cheeseshop breaks pylons
Hi, I just tried installing Pylons using the directions on the Pylons website - it failed because nose version 0.9.2 is no longer available on the cheeseshop, and Pylons requires a nose version between 0.9.2 and 0.9.9. Is there any chance you can put this version back up on the cheeseshop? I have the file in case you need it. Thanks, Jerry Seutter --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---