Re: Are there references yet for SQLalchemy reflection and using multiple engines under pyramid ?
Thanks. This ended up helping quite a bit! I haven't gotten into multiple databases yet, but I think it should be supported trivially I refactored your code for re-use into this pastebin - https://gist.github.com/1556734 I tried to make it simpler, but there is a bit of a janky hack in there. 1. I stripped the ReflectedTable down to just being an inherited class type , and one which defines a __tablename__ 2. The map_tables routine now just takes an app_model directory and looks for items that have both a) inherited from ReflectedTable and b) define __tablename__ To make it work, just replace models/__init__.py with this This obviously needs a few more passes, but I'd like to really abstract this into something that can just be a standalone module to handle all this stuff. -- 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
I ran into similar confusions as you a few weeks back. What I realized is that Velruse - and some other packages - kind of exist as standalone authentication micro-apps that wrap other auth libraries, and not as libraries to build that functionality into your own app as you would want. For some projects, that works perfect. For others, you might want a specific user experience -- which will necessitate rolling a bit more code yourself around the auth libraries they wrap. -- 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: SQLAHelper 1.0 released, and a proposal
I wish I was online over the holidays to take part in this discussion. Here's my .02¢ : - I think SqlAlchemy is the best ORM out there, and it's honestly been the deciding factor for me going with Pylons and sticking with Pyramid. - I think Pyramid core really needs to have a concrete DB/ORM plugin functionality / method / api / style. Whether you use SqlAlchemy or ZopeDB or something else, I think Pyramid should have a standard / recommended and documented place + support for starting up the DB connectivity. This doesn't need to be lines of code , it could just be a very well documented coding style / paster template. - I think the SqlAlchemy support needs to handle one or more databases , and both declaritive and reflective styles ( is there a third kind )? Pyramid is simply too free / open ended right now in regards to database support. It has the most potential out of all the frameworks, but its just frustrating at times. I started with the stock sqlahelper, and have been hacking at my integration to get more core SqlAlchemy functionality that it no longer resembles anything in published docs... if i had to hand this project over to someone else, i'd be worried that its so custom. -- 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 Dynamic/Template js files
I *think* wyatt might be referencing a technique similar to how Facebook Connect works. - In your templates, you can just set a JS variable/object in JSON , and then have your external JS files reference it on load. - Between using that, and a lot of callbacks in your JS code, you can keep most of your client side scripting as a library that can be aggressively cached. On Dec 19, 12:32 am, Ahmed ahmedba...@gmail.com wrote: Also, another disadvantage is that inline code in script tags does not get run when it is loaded via a jquery AJAX. The opposite (as in a separate js file) however is true. And I wonder if it is better to be able to serve these small snippets as separate js files rather than inline, so that they get loaded even if downloaded via AJAX. I guess then I will have to assign a special view/route to these dynamic snippets, and render via a template. -- 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.
Are there references yet for SQLalchemy reflection and using multiple engines under pyramid ?
I'm now using pyramid for some projects. Under Pylons I would almost always do the following: 1. Use multiple Engines ( Write, Read, Config, Log ) which each had different permissions in PostgreSQL. 2. Have my models reflect the database. With some custom routines, I largely just had to pass in a string for the tablename and a sometimes primary key . I'm not sure how to do that under Pyramid ( I am using the Akhet scaffold ). I might just use MongoDb for a bit, but would love to figure this out. -- 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: Model validation
I've built dozens of sites over the past 14 or so years , with Ad Agencies, Large Brands, Tech Startups, Major Media companies. Doing this, I've learned that Frameworks are really really great for the run-of-the-mill project that has a quick deadline, doesn't do anything new exciting, and has a shelf-life ( ie, it's expected to last 6-18 months and then it gets turned off ). For anything that needs constant improvement, nurturing, active product development and scaling of user interactions... frameworks have always been a complete fucking nightmare. Time and time again, I've seen my colleagues hit their heads against a wall ( often literally ) and wasting countless cycles trying to get around a 'design' or 'convenience' of a framework. I've also often seen months of work for projects that built on a framework thrown out and replaced with entirely custom Java/C/Python/etc code to solve the issues. I'm a big fan of using the right tool for the right job. If I'm needing to do a simple project that a 'framework' can quickly get off the ground and not need to maintain/grow it outside of that framework -- fine! But I'm well past the point in my career where I can justify saving an extra week off the initial launch plan to go with a convenience framework, when I know that I'm damning my dev staff to mundane and crap tasks like spending a week to customize a pagination plugin to work within the confines of that framework. I became a huge fan of Pylons/Pyramid , because a large majority of the stuff that lead people tend to abandon frameworks during project growth can be - and is easily - done within the environment. On Dec 13, 4:59 am, rihad ri...@mail.ru wrote: So it's a perfect tool for writing a framework :) Lightweight in my understanding means few features, mostly glue code. Just like Pyramid. All other meaty, but nonetheless important features, are meant to be chosen by a developer using that framework, and plugged in. For example, AFAIK Pyramid has no Form/validation subsystem in its core, or even an official plug-in that it endorses. Through trial and error, you have to just pick the missing part from the plethora of what's available, that would suit you functionally and esthetically. Maybe in the long run this would make you a more savvy, professional developer. But you'll have to agree with me, that if our goal is to build bigger, less buggy programs, we're gonna have to abstract from smaller details, use bigger bricks, so to speak. That's why people have chosen C, not assembly to write most parts of a larger OS; PHP, Perl or Python over C for web work, Frameworks over plain PHP, Perl or Python to facilitate building even larger programs. And that's because a human, however smart he or she is, cannot hold all the miniscule details in his head. People can see the bigger picture more clearly. So unless there's a larger framework built on top of Pyramid, as it is now the learning curve of getting the needed tools and do some CRUD/DB/auth/form edit/add, lists/pagination with some custom functionality - is pretty slow. -- 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 add query parameters to the current url in view code?
Exactly what do you want to do - and why ? You're talking about adding a new sort parameter to the current url. If you meant that you want to change the URL, then you have two options: 1. return a pyramid.httpexceptions.HTTPFound . you'd want to do this before you touch the database or any other code 2. in the html template, have some javascript that will update the window.location to reflect changes That being said, I suspect you might be going about this wrong. I don't understand why you would want to change a URL , or create a new sort parameter for the URL. In this scenario, as long as there isn't a sort parameter, you'll always execute that default code. I see little benefit in redirecting to a new URL if you already have code to correct for it. You should also check the user submitted param , to ensure that it is valid or allowed. i showed this in the 2nd example. = from pyramid.httpexceptions import HTTPFound @view_config(route_name=countries_list, renderer=countries/ list.html) def list(request): countries list - with HTTPFound if request.GET.get(sort): sort = request.GET.get(sort) else: new_url = 'whatever code you want here' return HTTPFound(location=new_url) dbsession = DBSession() countries = dbsession.query(Country).order_by(sort) #TODO:how to return current url with new sort parameter ? return {countries: countries} = @view_config(route_name=countries_list, renderer=countries/ list.html) def list(request): countries list, condensed, and with some sort of check sort= 'default_sort_order' if request.GET.get(sort): submitted_sort = request.GET.get(sort) if submitted_sort in [list,of,valid,sorts]: sort= submitted_sort dbsession = DBSession() countries = dbsession.query(Country).order_by(sort) return {countries: countries} -- 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.
Odd error from WebOb if you set a cookie value to be an Int and not a String
The following line works fine: self.request.response.set_cookie( 'fb-loggedin', value='1', max_age=None, path='/' ) However, this line creates an interesting error self.request.response.set_cookie( 'fb-loggedin', value=1, max_age=None, path='/' ) IOError: [Errno 20] Not a directory: '/Users/jvanasco/webserver/ environments/python-virtualenv-pyramid/lib/python2.6/site-packages/ WebOb-1.2b2-py2.6.egg/webob/cookies.py' Full stack trace is below. I've never seen this sort of thing before. Obviously the fix is to pass in a string, it's just odd that specific error 'Not a directory' was called. For whatever reason it was trying to read the non-existent /webob/cookies.py ( the .egg is a single file ) Exception happened during processing of request from ('127.0.0.1', 49195) Traceback (most recent call last): File /Users/jvanasco/webserver/environments/python-virtualenv- pyramid/lib/python2.6/site-packages/Paste-1.7.5.1-py2.6.egg/paste/ httpserver.py, line 1068, in process_request_in_thread self.finish_request(request, client_address) File /System/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/SocketServer.py, line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File /System/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/SocketServer.py, line 615, in __init__ self.handle() File /Users/jvanasco/webserver/environments/python-virtualenv- pyramid/lib/python2.6/site-packages/Paste-1.7.5.1-py2.6.egg/paste/ httpserver.py, line 442, in handle BaseHTTPRequestHandler.handle(self) File /System/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/BaseHTTPServer.py, line 329, in handle self.handle_one_request() File /Users/jvanasco/webserver/environments/python-virtualenv- pyramid/lib/python2.6/site-packages/Paste-1.7.5.1-py2.6.egg/paste/ httpserver.py, line 437, in handle_one_request self.wsgi_execute() File /Users/jvanasco/webserver/environments/python-virtualenv- pyramid/lib/python2.6/site-packages/Paste-1.7.5.1-py2.6.egg/paste/ httpserver.py, line 287, in wsgi_execute self.wsgi_start_response) File /Users/jvanasco/webserver/environments/python-virtualenv- pyramid/lib/python2.6/site-packages/WebError-0.10.3-py2.6.egg/weberror/ evalexception.py, line 233, in __call__ return self.debug(req)(environ, start_response) File /Users/jvanasco/webserver/environments/python-virtualenv- pyramid/lib/python2.6/site-packages/WebError-0.10.3-py2.6.egg/weberror/ evalexception.py, line 245, in debug return method(req) File /Users/jvanasco/webserver/environments/python-virtualenv- pyramid/lib/python2.6/site-packages/WebError-0.10.3-py2.6.egg/weberror/ evalexception.py, line 398, in source_code f = open(filename, 'rb') IOError: [Errno 20] Not a directory: '/Users/jvanasco/webserver/ environments/python-virtualenv-pyramid/lib/python2.6/site-packages/ WebOb-1.2b2-py2.6.egg/webob/cookies.py' -- 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 can i access config settings in my pyramid app handlers/templates ?
in pylons , i only had to do : from pylons import config and then all my (development|production).ini info was available what is the equivalent under pyramid ? i can't seem to figure it out. -- 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 can i access config settings in my pyramid app handlers/templates ?
thanks kindly! i probably glanced over that line a dozen times. On Dec 6, 1:32 pm, Chris McDonough chr...@plope.com wrote: On Tue, 2011-12-06 at 10:28 -0800, Jonathan Vanasco wrote: in pylons , i only had to do : from pylons import config and then all my (development|production).ini info was available what is the equivalent under pyramid ? i can't seem to figure it out. In a view function: request.registry.settings .. gives you back all this info. Seehttp://docs.pylonsproject.org/projects/pyramid/en/1.2-branch/narr/sta... -- 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.
enabling json under akhet ?
i'm using pyramid with akhet according to the docs, i should be able to do something like this: @view_config(renderer='json') def login_status(self): rval= [1,2,4] return rval That creates an error for me: ValueError: Could not convert view return value [1, 2, 4] into a response object is there something in the akhet config that disabled the ability to handle json like the normal docs ? -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: enabling json under akhet ?
dicts and lists don't work. i posted a list to the group, because its the simplest object. On Dec 4, 7:08 pm, John Anderson son...@gmail.com wrote: You should return a dictionary not a list. rval = {'values': [1,2,4]} On Sun, Dec 4, 2011 at 5:34 PM, Jonathan Vanasco jonat...@findmeon.comwrote: i'm using pyramid with akhet according to the docs, i should be able to do something like this: @view_config(renderer='json') def login_status(self): rval= [1,2,4] return rval That creates an error for me: ValueError: Could not convert view return value [1, 2, 4] into a response object is there something in the akhet config that disabled the ability to handle json like the normal docs ? -- 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: enabling json under akhet ?
so you sort of solved this. you at least pointed me in the right direction to experiment! works: @action(renderer='json') doesn't work: @view_config(renderer='json') On Dec 4, 8:11 pm, Mike Orr sluggos...@gmail.com wrote: I don't think so, but akhet does use pyramid_handlers, so it's attuned to @action rather than @view_config. Still, I doubt that would sabotage @view_config. Do you have a config.scan() line in your init file? If not, it's possible that config.add_handler() is registering the view but misinterpreting the view options. There may be problems with mixing add_handler and @view_config in the same view class. If you don't have config.scan() and config.add_handler() is not registering the view, then I don't see how the view would be accessible at all. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: enabling json under akhet ?
On Dec 4, 8:11 pm, Mike Orr sluggos...@gmail.com wrote: By the way, I'm working on Akhet 2 which will not have an application scaffold, but expanded docs instead. So the days of the 'akhet' scaffold are numbered. Sigh. I do like the scaffold. It's mostly going to be replaced with pyramid_sqla though - right ? Is akhet2 on your bitbucket ? i've been planning on making a sample application that is mostly docs/reference of different ways to do things in pyramid - i'm trying to teach a few former colleagues it, and it would make sense to just open source it. -- 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: Strange paster serve behavior
No idea. Is there any way to log/debug what is happening within vim? FYI: My normal workflow though is: Terminal window 1: $ paster serve --reload development.ini Terminal window 2-10 vim, postgres, etc + textwrangler windows On Dec 2, 10:47 am, Mark Erbaugh m...@microenh.com wrote: I'm developing with pyramid (1.2) on a Mac with Snow Leopard (OSX 10.6.8). I've set up a virtualenv with all the libraries I need. I'm doing my editing in vim. When I want to see the results in a web browser, I issue :!paster serve development.ini inside vim. Most of the time the server starts right up and I see the messages: Starting Server in PID serving on 0.0.0.0:6543 view athttp://127.0.0.1:6543 immediately. But sometimes, there is a significant (30 seconds or more) delay between those two messages. My normal development process is edit the code, launch the server, play with the website, ctrl-c out of the server, edit, repeat. I could be in and out of the server rapidly (especially when my code for the web page raises an exception g). Any idea why I sometimes get a delay in launching the server? Thanks, Mark -- 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.config - what is _ainfo ?
On Nov 29, 9:23 pm, Michael Merickel mmeri...@gmail.com wrote: Regardless, I hope this is way too much information about Pyramid internals and I'm curious what you're planning on doing that you'd need to trace the undocumented apis. First, thanks a TON! This is *way* too much info indeed! I just wanted to take a stab at trying to make decorators like: @require_logged_in which I did, below! Under Pylons, I used different base handlers that handled the login/ logout requirements For a new project, there are more classes / 'url namespaces' that require both loggedin and logged out. I didn't want to use the auth that comes with Pyramid - as its a bit above my needs - so I just wanted to hack something simple. I was looking at a few different ways to build this. i decided the 2 simplest decorators to model after were action_method and view_config(). I've always found it easiest to look at the internals when i get stuck on something. i was a bit worried that i might have needed the _ainfo stuff - and I thankfully don't! def require_logged_in(wrapped): def wrapper(self, *arg, **kw): try: if not is_logged_in(): result= HTTPFound(location='/account/login') else: result = wrapped(self, *arg, **kw) except: raise return result wrapper.__name__ = wrapped.__name__ wrapper.__doc__ = wrapped.__doc__ wrapper.__docobj__ = wrapped # for sphinx return wrapper -- 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: Production.ini
You may be over-thinking this. The only good reason I've encountered to not have the passwords within the codebase, is worries of : 1. a web config makes the file viewable as plaintext 2. a web config makes the file's revision control info viewable as plaintext 3. not trusting the source control management server to be secure 4. not trusting team-members who have source access The *easiest* ways i've found to overcome this are : 1. stuff the login/passwords into a file that is not in source control 2. stuff the login/passwords into environment variables You can also code your apps so development servers pull the dev logins out of the codebase, but the production servers use the not-under- source-control files or environment variables. Forcing a 'person' to provide this info will hurt your ability for automatic deployments, make scalability a mess, and a host of other issues. This is just my 2¢, but it applies equally to any programming language or web framework i've encountered. I've had to deal with systems were they tried to encrypt code/passwords or forced people to provide them manually - those situations always created multiple problems. -- 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.config - what is _ainfo ?
@John Anderson You could do that, but then you're using the Pyramid auth/security framewor - and i want to stay away from it. i'm not a fan of its design, and it won't work easily/quickly with how I like to build apps. -- 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 can I map a dash/hyphen in a route 'action' under pyramid ?
Thanks Michael and Chris! Michael's solution worked instantly. I was having trouble getting Chris's to work... then realized that I was running pyramid_handlers 0.1 , not 0.4. instant gratification after upgrade! -- 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.config - what is _ainfo ?
it's in the Configurator an the action_method decorator just wondering what it is, i'm knee deep trying to understand the architecture -- 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 Browser Detection
thanks all for the insight. a couple of quick responses : 1. i like to put 'device' and feature detection client-side as much as possible, but i've encountered situations where you need to implement a server-side solution: a) the webpage is too large , and you want to keep all JS running until the 'onload'. b) you want to block out devices from certain incompatible features as much as possible, but still allow a use the regular html site button 2. it might make sense to craft a solution that is a plugin , to bridge one or more actively maintained projects into pyramid via easy hooks. the number of these projects, and the not-insignficant percentage of them being framework specific, show that its very desirable to make a quick framework 'hook' for developers to make their applications mobile-aware. i don't really care how this works - and I'm willing to do the work to make this happen. -- 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 can I map a dash/hyphen in a route 'action' under pyramid ?
Pylons had a nice little convenience method under the hood... If i had the equivalent of: config.add_handler(account, /account/{action}, myapp.handlers.account:AccountHandler,) a request to- account/sign-up would map to- class AccountHandler: def sign_up(): pass are there any similar conveniences in Pyramid ? -- 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: Akhet status (Pyramid newbies and Carlos d.l.G., read me)
when is a good time for us to connect on aim/irc/etc and plan some integration stuff out ? -- 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: Porting a Pylons app to Akhet
I think pyramid_simpleform is the easiest. I forked it and added a method to handle form reprints. I think its in that sqla fork I shared with you too. if you stick to the following paradigm, it works well: def form_dispatch: if request.submit: return self._form_submit return self._form_print def _form_print: return render(form) def _form_submit: try: form.validate except FormError: return self._form_print() redirect( form_success_url ) -- 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.
question about middleware
i'm trying to port an old perl project ( which was essentially middleware for the mod_perl environment ) to Pyramid/WSGI The basic premise is that it: - migrates the x-fowraded-for header into remote-addr - but only from accepted servers by ip - but only from accepted servers with a lan secret this way, your app functions as normal with no necessary logic needed, and you can toss it behind as many loadbalancers or proxies you need. the 2 issues i've been running into are: 1. how should I configure this? Should I have the middleware import config stuff ( if so, is there a reference ?) or should that all happen in the pyramid app when I layer in the middleware ? 2. is it even possible to raise a 403 in middleware and prevent the app from running ? -- 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: question about middleware
thanks. the accepted ips don't need to be db based. the notion is that you can trivially ensure that a request is through your gateway and doesn't have spoofed headers if the application recognizes both a the ip of the server and a secret that only those ips would know. for example, you would configure nginx working as a load balancer onto 4 machines in round-robin style... and have it add a header of (QU#EKJHADS to each request. so long as your app recognizes the header and the ip, it processes it as normal. otherwise, its either a spoof or some local traffic that you don't want to code for. -- 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-discuss and pylons-devel
i've noticed a lot of -discuss items being spoken about in -devel lately... i had often thought that -discuss was for people /using/ pyramid, and -devel was for people /building/ it. if that is still the case, can i suggest the -devel list make a firm policy of having people repost here? -- 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.
are there pyramid analogues to AttribSafeContextObj ?
just noticed that ContextObj and AttribSafeContextObj are not in pyramid. are there versions in pyramid, or are they gone ? -- 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.
are there pyramid analogues to AttribSafeContextObj ?
just noticed that ContextObj and AttribSafeContextObj are not in pyramid. are there versions in pyramid, or are they gone ? -- 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/Pylons Project status update...
Great news to see traction! I've been busy porting over a microframework we used under Pylons for many projects to Pyramid and shared with some trusted friends. The application design is changing quite a bit due to pyramid, so its a complete rewrite. I'm taking this as an opportunity to just start publicly releasing stuff now, and not worry about security issues ( which kept back public release of the previous framework). The goal is to build out a framework for very quick prototyping of web applications, while not enforcing any requirements on the database or overall application design. https://github.com/jvanasco/pyramid_opensocialnetwork -- 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 serve content of the database field as a file for download.
you should ask on the cherrypy list. that is another webserver, different than pylons. On Feb 24, 3:48 am, Sandeep Kulkarni sandeep.kulka...@bsil.com wrote: Hi, Following is my back end code in python. def download_key(self): import cherrypy cherrypy.response.headers['Content-Type'] = application/octet-stream cherrypy.response.headers['Content-Disposition'] = 'attachment; filename=myfile.pem' return These are file content And the front end code is as follows in extjs. function downloadFile(){ var url='/download_key'; var ajaxReq=ajaxRequest(url,0,GET,true); ajaxReq.request({ success: function(xhr) { Ext.MessageBox.alert(_(Success), xhr.responseText); }, failure: function(xhr){ Ext.MessageBox.alert( _(Failure) , xhr.statusText); } }); } I am getting response at front end in a message box. But I need that response text in a file. Please help me if you know the solution. Regards, Sandeep On Tue, 2011-02-22 at 23:30 +0530, Eric Rasmussen wrote: I am not familiar with extjs, but in your example it appears that the success scenario is commented out. Also, should the response variable be xhr.response? response will evaluate to undefined in the function as you pasted it (unless it's a magic variable that is part of extjs?), and if it's a global variable declared elsewhere, it's probably not the response text from the AJAX call. Otherwise it would definitely help to see the server-side code you're using for the file content. Best, Eric On Tue, Feb 22, 2011 at 2:40 AM, Sandeep Kulkarni sandeep.kulka...@bsil.com wrote: Hi, Thanks but I have already tried this solution. I didn't get file downloaded on client machine. I have following code at client side. Is any thing lacking there? I am using AJAX here in extjs. function downloadFile(){ var url='/download_key'; var ajaxReq=ajaxRequest(url,0,GET,true); ajaxReq.request({ success: function(xhr) { //Ext.MessageBox.alert(_(Success), response); }, failure: function(xhr){ Ext.MessageBox.alert( _(Failure) , xhr.statusText); } }); } Regards, Sandeep On Tue, 2011-02-22 at 13:28 +0530, Graham Higgins wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, On 22 Feb 2011, at 07:01, Sandeep wrote: I have some text content in database field. I want to download that text content from database field on client machine. http://stackoverflow.com/questions/790019/how-do-i-return-a-csv-from-... shows how to do this for a .csv file. I want this text content in a file at client side. This isn't really related to Pylons, you just need to set the relevant HTTP response headers: http://www.webmasterworld.com/forum88/12908.htm - -- Cheers, Graham http://bel-epa.com/gjh/ -BEGIN PGP SIGNATURE- iEYEARECAAYFAk1jbJAACgkQOsmLt1Nhivzv/gCfUEtz6r6GeIb+kM+5s9XsUx9E 1nAAoNhiV5LKetd8RaUMd9mQZOxQExe3iQCVAgUBTWNskFnrWVZ7aXD1AQJcYQP9 Ebu6uZNyQVpw9ZBB1M3i3laoaYrIN6vecg0DLV9h77Nzx+oGbQ/VntEG2If33j91 jBgTScRn8ZTvfKagQUKW/kqjVNc3w9Kqo3e+iSPaV/zE3PmUPfSxJ9nhkTOgqbNH z18t54X8PeViAfMgvnhg9ntzWYGohW9tdNyHt/IxJ1U= =+FQx -END PGP SIGNATURE- -- 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. -- 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
Re: Attach SQLAlchemy Session to settings object instead of creating module global?
have you looked at the pyramid_sqla stuff ? i think mike orr may have done some of this. in my pylons apps, ive never needed sessions to persist between requests.. so i looked more at global settings and request based stashes. On Feb 24, 9:51 pm, Wyatt Baldwin wyatt.lee.bald...@gmail.com wrote: In Pylons, there's a recommended SQLAlchemy setup where the Session is created as a module global and then configured by a call to a function in the model package. I've been using a variation of this setup in my Pylons apps, but as I've been porting to Pyramid, I've been thinking it would be cleaner to attach the Session to some application object. One possibility is attaching it to the settings dict. I wouldn't want to add it to the WSGI app returned by `main` because that app may be wrapped by other middleware and then the Session would be hard or impossible to access. I'm thinking it would look something like this: def main(global_config, **settings): settings = init_settings(global_config, settings) config = Configurator(settings=settings) settings['db.Session'] = make_session_factory(settings) # ... return config.make_wsgi_app() def make_session_factory(settings): engine = engine_from_config(settings, prefix='sqlalchemy.engine.') Session = scoped_session(sessionmaker(bind=engine)) return Session What I think is preferable here is that there is a single place where the database stuff is set up and there is no possibility of using the Session before it's fully configured. Also, accessing the Session in a controller wouldn't require an import, which is slightly more convenient though not really a big advantage. So, my questions are: - Has anyone tried a setup like this? - Are there any down sides I'm not thinking of? - Is there maybe a better high level application object to attach the Session to? - Am I over-thinking this? After I wrote all this, I found something in the cookbook about using a non-global session: http://docs.pylonsproject.org/projects/pyramid_cookbook/dev/sqla.html Seems like basically the same idea except that I'm using the standard thread-local Session factory. -- 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 it possible to do a redirect in a pyramid handler's __init__ ?
rad. thanks! On Feb 22, 2:52 pm, Chris McDonough chr...@plope.com wrote: FTR, this is an answer to the broader question how do I make it possible to return a response by raising an exception: http://docs.pylonsproject.org/projects/pyramid_cookbook/dev/exception... Do this, then use raise pyramid.httpexceptions.HTTPFound(location='http://...') wherever you need to do a redirect. On Tue, 2011-02-22 at 09:06 -0800, Jonathan Vanasco wrote: i'm trying to port some custom pylons authentication , which had redirects in __init__ and __before__ -- 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: a few more pyramid questions
To be clear: This works: @action(renderer='/test_a.mako') def test_a1(self): return {'project':'myapp'} @action(renderer='/test_b.mako') def test_b1(self): return {'project':'myapp'} def test_c1(self): return render_to_response('/test_b.mako', self.test_b1(), request=self.request) But this doesnt: @action(renderer='/test_a.mako') def test_a2(self): return {'project':'myapp'} @action(renderer='/test_b.mako') def test_b2(self): return HTTPFound(location='/account/login') def test_c2(self): return render_to_response('/account/test_b.mako', self.test_b2(), request=self.request) Based on this pattern, I don't think it would be possible to migrate any of my Pylons apps to Pyramid -- this behavior would require a substantial rewrite of most controllers. 1- The way redirects / 404s are currently implemented creates a need for additional logic in a dispatching function ( the results would need to be tested, not handled by the framework ) 2- There looks to be a duplication in labor - a call to a dispatched function would also require noting the template as well. So instead of just noting the template at the function, you're also noting it at anything that dispatches it. -- 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: a few more pyramid questions
after fighting for a while, i got the functionality i needed , and integrated it with form processing i forked pyramid_simpleform on bitbucket and refactored `_form_reprint` into `handler_reprint`. it was pain to figure out how to munge the response object correctly... and i should probably change the response code to a 202 -- but this should make form processing much easier for pylons people. def _form_reprint( self , form , print_method ): form_response= print_method() form_response.unicode_body= form.htmlfill(str(form_response.body)) return form_response def login(self): if self.request.method == 'POST' : return self._login_submit() return self._login_printform() def _login_submit(self): myForm = Form( self.request , schema=LoginForm ) if not myForm.validate(): #return myForm.handler_reprint( self._login_printform ) return self._form_reprint( myForm , self._login_printform ) myapp.lib.helpers.do_login() return HTTPFound(location='/account/home') def _login_printform(self): return render_to_response('/account/login/form.mako', {'project':'myapp'}, self.request) -- 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: Form handling in Pyramid
personally, think it would be best to decouple the moving parts as much as possible to me, there is : html form creation - great if this is baked-in, but it shouldn't be required form validation - i think formencode is fine, but i often use it as a first-pass and then handle things in my controllers too form submission - validation is only a portion of submission. what is triggering the validation ? what happens when its a success ? how about a failure ? anything else could/should be a module that plugs into the forms. the old @validate had some issues, but could have been extended into something more powerful. at least in my usage i was able to separate out the various phases and provide hooks back into it. -- 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.
a few more pyramid questions
i'm trying to figure out some paradigms in pyramid using the pyramid_sqla template... if i have: @action(renderer='/account/test_a.mako') def test_a(self): return {'project':'myapp'} @action(renderer='/account/test_b.mako') def test_b(self): return {'project':'myapp'} how can i do something like: def test_c(self): if 1: return self.test_a() else: return self.test_b() i've tried this with @action and @view_config ; i'd love to figure out how to do using either. I spent about 30 minutes playing around with Response, render_to_response, and hacking on the core... and no luck. i can't figure out how to do this cleanly. -- 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: a few more pyramid questions
sorry, let me rephrase - is it possible to dispatch to another function and have it handle the render + define the template ? -- 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: some thoughts on pyramid
I've forked Mike's pyramid_sqla , and have been extending the templates to be more familiar to pylons users. Namely: 1- making the app structure seem more like a more mature pylons 1.0 app 2- added some reference functions around form submissions , beaker session usage , etc 3- integrated some routines and designs from the pylonshq source code ideally, someone would be able to create a new project and see a reference of how to do most things right in the source. They only need to delete a few lines and files in order to get going on their on stuff. perhaps this template should have a different name -- but it seemed to me like a mechanism was needed so people could get up running in a manner of minutes, without reading a ton of docs. The fork is here: https://bitbucket.org/jvanasco/pyramid_sqla On Feb 19, 2:29 pm, Mike Orr sluggos...@gmail.com wrote: By the way, could we have a little Git-for-Pyramid tutorial at the PyCon sprint? -- 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: some thoughts on pyramid
1. I think it would be better if everything related to Pyramid/Pylons were on a single system ( ie: GitHub or BitBucket ). 2. The Pyramid stuff should have better linkage on PylonsHQ.com ; its a text-link buried in paragraphs. 3. I'm looking at the pyramid_sqla template. question.. i see stuff like this in the 'handlers': @action(renderer='index.html') def index(self): log.debug(testing logging; entered MainHandler.index()) return {'project':'myproject'} does this mean you can't switch out the templates in these handler methods ? ie: when you need to display different templates based on conditions ? -- 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: some thoughts on pyramid
On Feb 18, 12:21 pm, Ben Bangert b...@groovie.org wrote: Getting there got the Pylons framework on there, and most everything is on GitHub that the Pylons Project encompassas. Which projects were you referring to that aren't? pyramid_sqla isn't. If Mike Orr wants help learning git/github , i'd be happy to help him convert and get acclimated via AIM . serious. Ah, yes. I'll try and get something up there shortly. thanks! even its its just changing documentation up top to pylons documentation and a link to Pyramid Project, i think that would make things much clearer. -- 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: some thoughts on pyramid
On Feb 14, 10:08 pm, Mike Orr sluggos...@gmail.com wrote: Have you seen the pyramid_sqla package, which includes an application template? It addresses these three. Nope. Took a lot of combing to find. It was kind of hidden under some text on the Pyramid intro. Would be great to see that in another tool tip style text-treatment like the item above it. Will be going through it tonight. When Pylons was created in 2005, every framework had to be like Rails and MVC in order to succeed. Yet Django became the most-used Python framework in spite of being MV rather than MVC. The main issue for developers is ignorant managers who say It must be Django (or Rails/PHP/Java) -- without knowing anything about these technologies, just that these are the popular buzzwords. It's much less common to hear Must be MVC. For developers who can choose their own framework, again they are swayed more by these Django/Rails/PHP/Java buzzwords than by MVC. So Pyramid's most direct competitor nowadays is Django, not MVC. I know that too well and can give a few perspectives: I took over as Acting CTO at TheDailyBeast.com a few months ago. My predecessor committed the org down a Rails path that I needed to finish up ( legacy on php ). Then we merged with Newsweek. I was in meetings with the rest of the management teams nonstop for months. When execs hear words like typical/standard MVC , its a few points in your favor. When there are words like MV or just like Django - it falls on deaf ears. I do A LOT of consulting with startups and ad agencies in the NYC area. 9/10 times they have a MVC framework or experience. it's not just Rails, but there's also: CakePHP, Symfony, CodeIgnighter, Kohana, etc. Django can look slightly alien to folks because of the paradigms it's chosen, but its also got some familiar elements. Pyramid has less of the familiar elements, because like Pylons its more for power users and engineers than webapp developers. Only 1/10 people I meet would even be interested in Pylons; for the rest - they're looking for familiar ground. The developers went back and forth on this but in the end went with single modules. i'd really suggest revisiting this. showing multiple files gives a clear idea and example how to scale. programmers looking at multiple files can more easily see how to collapse into a single file, than looking at a single and trying to figure out if there's any special stuff needed to use multiple files in the module. This is also in the pyramid_sqla manual. rad. -- 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.
some thoughts on pyramid
I spent some time today with Pyramid. It was a bit of a rollercoaster -- at times I was very excited, at others very stressed. i figured i'd share my thoughts here for the maintainers. 1. on setting up an app, there were no instructions on how to setup for a postgres 'url' in sqlalchemy ; in fact - there was nothing in there regarding this setup. i pulled it out of an existing project; one could probably look at pylons 1.0 (not pyramid) docs. 2. i assume this is part of the template designed to show how to do stuff... however creating the initial 'models' table, with a sample entry, is misleading and not clear. i'd suggest changing it to sample_model or something that is very clearly not needed for the application. 3. i haven't figured out yet if its possible to handle multiple db connections in pyramid. in pylons i have sqlalchemy.write.url and sqlalchemy.read.url and handle multiple databases due to master/ slave clustering. in order to get widespread appeal, something like this needs to be very apparent and easy to do - Rails accomplishes this in a few lines of configs. 4. i'm not sold on the MV design. personally, I think it was risky departing from MVC, which has become the de facto standard and super familiar for developers across the web. django has had issues selling people on their MVT , and its just an uphill battle. i'm sure it has many advantages, i'm just speaking from a 'marketing ' view. 5. the default application template should really generate a multiple views models structure. most people i've worked with strive very hard to keep the entirety of their models/views from being a single file. 6. also on the migration point, it would be good to discuss sqlalchemy reflection. The code looks solid, and I understand the rationale behind a lot of design choices... but from an adoption view, i think there's a lot of work to be done. -- 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 for Pylons users guide
i'm looking at porting some stuff over, and after reading the docs have a few concerns: - under pylons i have multiple db connections : read, write, log, admin-write, etc. each has different db permissions to ensure security and tie in with clustering. all the Pyramid examples I've seen revolve around a single db connection. - the docs talk about not using pylons globals. would love an overview of their counterparts or deprecations. i'm quite worried about g and some other .97 conventions that are abundant in my apps. On Jan 14, 10:53 pm, Mike Orr sluggos...@gmail.com wrote: Hi all, I'm starting an article on Pyramid for Pylons 1 users, focusing on the differences between the frameworks and how to do familiar things in Pyramid. It'll also cover add-on stuff like forms and auth, or at least list the alternatives available. I'm wondering if there are any particular questions people would like included. If so, please email them to me. -- 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: Pylons for Facebook apps
I've done a lot of cross-language systems. They're really quite easy. The main issue with them is session data, but everyone can read YAML and JSON. while they're not as fast as natively pickled/packed data, even the slowest systems around can process them with ease. -- 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.
has anyone seen pinax before ?
http://pinaxproject.com/ i've been working on something similar that is pylons based for a while; but they're already up and running -- 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: How to strip HTML tags?
beautiful soup lets you do it too, and fixes the document while its at it... -- 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 for Facebook apps
i tried it a while back, and then gave up. i don't think its worth it, because facebook has changed the way the apps work so many damn times i think you'd be better off just using one of the many full-featured, mature, has-tons-of-people-maintaining-it php libraries that are out there , and let that handle all the integration crap. then your pylons app can just sit on the site, and do what it needs to do regardless of facebook. -- 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: Hiring Pylons Devs in NYC
On Aug 12, 9:33 pm, Mike Orr sluggos...@gmail.com wrote: Hooray. I'm not in NYC but I've heard most of the jobs there are Java, so I'm glad more Python employers are appearing. Maybe you can hire me in a few years if I ever move there. :) Let me know if you do! But I'll probably be living in SF by then ! -- 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.
Hiring Pylons Devs in NYC
Hi all- One of the startups that I'm working with will be starting a round of hiring in the next 2-6 weeks. We're in NYC. I'm effectively the director of product engineering... or something like that. The CTO is focused on RD, so I'm dually the product manager and building out the development engineering teams. There's a full posting here: http://jobs.nytm.org/job/multiple-developer-engineering-opportunities-new-york-ny-5ad6b2edb5/?d=1source=site_home The nitty gritty you'll care about before clicking the above: - Our webapps are being rebuilt on Pylons Postgres , using a microframework that started out at FindMeOn and has been used at ArtWeLove and a few other projects. They were php+mysql until i yelled profusely. - I'm projecting that we're going to have serious scaling issues in 3 months, based on some partnership contracts that we're working on - We're looking at building out a service oriented architecture -- the main user interface will be in Pylons and we'll store transactional data in Postgres... but we're going to need some fancy shit behind-the- scenes as well as a decent API for partners. So in addition to Pylons folks, I'm also on the lookout for people with experience/aptitude for Erlang, Scala/Lift, and custom C/C++ servers, as well as nosql experience. - I'm looking for folks at all levels. I'd definitely love some folks who are much smarter and better than me on the team, and we're totally open to smart folks with great aptitude that don't have much experience. There's more info on the link above. -- 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: Hiring Pylons Devs in NYC
On Aug 12, 6:54 pm, Wojtek Augustynski waugustyn...@gmail.com wrote: Nice to see. Wish there were more Pylons jobs in the SF Bay Area! :) ?!? There are TONS. a lot of the 'hot' and well funded startups are hiring pylons people. -- 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.
OT -- odd mac issue - pylons stopped serving
this just happened today, its driving me crazy all of my (local) pylons apps won't respond on my mac. the browser pause for a few seconds, and then i see: RTSP/1.0 404 Not Found Content-Length: 0 it's happening with all browsers. anyone have an idea what setting I messed up ? -- 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: OT -- odd mac issue - pylons stopped serving
On Jun 16, 2:23 pm, cd34 mcd...@gmail.com wrote: Are you running the Darwin/Quicktime Streaming Server on your machine? figured it out! VLC had crashed earlier in the week, and somehow grabbed a slew of ports. thanks for pointing me in the right direction. i couldn't figure out what / why RTSP was running ( sadly not a pirate, though genetic testing may prove i come from a line of them! ) -- the reply about Streaming Server reminded me that VLC has something like that built in and sure enough there were some stray processes while no active VLC app. -- 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: FormEncode inadequate?
I use FormEncode very happily... along with a custom solution. 1. For multiple-step logic, I use multiple FormEncode forms. 2. For advanced formatting, my stuff looks like this: def form(self): if request.params.get('m') == 'submit': return self._form__submit() return self._form__print() def _form__print(): return render('form.mako') @custom_validate(form='_form__print') def _form__submit(self): try: if i_encounter_error: raise GetPost_Form_Error(value) except GetPost_Form_Error, e: tweak_c_or_form_results_with( e.value ) return form_reprint( self, '_form__print' ) except: raise return 'yay' that lets me handle a lot of situations. if i'm dealing with formatting multiple error fields, i just populate a dict with errors and raise at the end. -- 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: Developing with paste http only
just make a function in helpers: def my_url( u ): u2= url(u) if config['site_url_scheme'] == 'https': something else: somthing and call h.my_url() wherever you need it you could even redefine url() and then access the original, but stuff like that can be a PITA to debug when something goes wrong and you forget that you did that ( from experience ;) ) -- 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: application deployment question about nginx and pylons
I'm of this school of thought: if you're doing anything with moderate to high traffic, you should be running NGINX on port 80 , with a proxypass to something else. What you proxypass to, however, is up to you. 1- paster 2- wsgi 3- apache the important thing is to get Apache off of port 80 , its really just not a great performer. you *especially* don't want to run apache on port 80 if you're using a single apache configuration. the mod_perl folks did the math and wrote a chapter or two about it, which may have wound up online... it was called vanilla apache + mod perl or something like that. you basically want the lightest and leanest server running on port 80 as possible (nginx, or a stripped down apache with as few DSOs loaded as possible) . you can then proxy back to other servers as needed. if you decided to stay apache, you DEFINITELY want to run a vanilla instance on port80 to handle static files and proxy back. the reasons for this are twofold: 1- IIRC, a stripped down apache process is 500k or so of memory; a mod_* will grow to 3-5MB, and then compile in your application code and allocated/reserved memory... which often ends up at 20-30MB per process. if you run your app on port 80, both static files and dynamic content will be served by these apache processes - which means you'll tie up the 20-30mb processes with tasks a 500k one could do. if you profile your app correctly, you can find the right types of servers to run that will easily allow you to increase your throughput by 10-20x -- if not more -- just by smarter resource allocation. 2- if a client is slow, or drops a connection without being detected, your dynamic apache ( or anything else ) just sits there slwly serving a file until a timeout is reached. if you put a 'vanilla' server on port 80, the dynamic server instantly returns the result to it... and it can handle the timeout/slowdown issues... freeing up the memory and processor for the dynamic server to process another request. -- 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 hosting on a VPS (memory usage)
i'm running pylons apps on a few VPS my issues have been this: - the database takes up a lot of ram - the search engine takes up a lot of ram pylons app performance has been better as more ram is tossed in. if you're running a DB like postgres or mysql on the same vps, i would probably use 512mb ram as a minimum... 256 could work. if you're running anything like solr/lucene as well, i'd defintely consider 512 a minimum in terms of the apache issues indicated above -- were they on the master or child processes ? you should be able to mitigate that behavior on the children by tweaking max_requests also, as i remember from my mod_perl days, apache doesn't like to free memory on a restart. you need to explicitly stop then start. -- 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.
is there a way to access the db connection handle of a sqlalchemy object , from the object ?
i never had to do this before. some sample code is below; basically in a function i need to 'expire' some looped items , so i pull fresh from the db. my problem is that i don't know how to access the db from within the model ; i could pass-it-in explicitly from the controller... but i'd really like to fetch whatever dbhandle the object was retreived with controller: jonathan= dbSession.query( model.person ).filter( id=1 ) model: class person(object): def fun(self): for item in self.items: db.expire( item ) # what is the db here? was it associated within dbSession.query() ? -- 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: best practices when writing controllers
On Apr 4, 4:28 pm, cd34 mcd...@gmail.com wrote: While the controller is cleaner, does that really make it more readable? From a maintainability standpoint, would someone new to the code be able to see what that action was doing reasonably quickly? If i were going for code readability, I don't know. Usually I go for application maintainability. Looking at the original code , this bigtask() class looked to be a logging functionality that is used across multiple controllers and actions. i'm inclined to refactor code like that into helper functions , so I only need to update them in the smallest amount of places when the objects interface / methods change. assuming bigtask() adds a new column, and is called in a dozen places, I'd rather only edit 1 invocation of the method to pull the request params -- not 12. -- 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: best practices when writing controllers
On Apr 3, 2:51 pm, cd34 mcd...@gmail.com wrote: (task_id,status) = task().bigtask().add(get_client_id(), \ request.params['device_id'], \ request.params['username'], \ request.params['ip'], \ request.params['email'], \ request.params['path'], \ request.params['include']) I could be wrong, but this looks just like the stuff that i'd put into a helper library to keep my controllers a bit cleaner... (task_id,status) = h.newtask('add') helpers/tasks.py def newtask( method ): t= task().bigtask(). if method == 'add': return t.add(get_client_id(), \ request.params['device_id'], \ request.params['username'], \ request.params['ip'], \ request.params['email'], \ request.params['path'], \ request.params['include'] ) -- 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: Include return value of other controllers in template
i handle this two different ways: 1- I'll use a helper function to handle this /lib/helpers/comments def list_comments( object , offset=0 , limit=10 ): # stuff here to grab the comments # return fragment or populate c? who knows 2- I'll use a shared inheritance class def _list_comments( self , offset=0 , limit=10 ): # stuff here to grab the comments # return fragment or populate c? who knows # self has a class var that tells what kind of object we're looking at i really dislike the idea of using a subquery: - if your app is transaction safe, you just complicated stuff a lot - if your app has any sort of auth or setup overhead on the request, you're now running it again ( ie: BaseController's __init__ and __before__ ) - you're having a controller's public method that also acts as private. methods should really be public or private. i think helper functions and inherited classes are more appropriate. -- 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: reference to app
slightly off topic... my app/__init__.py file always has this bit: import sys appdir= sys.path[0] appexternals= %s/##APPNAME##/lib/externals % appdir sys.path.append(appexternals) import OpenSocialNetwork OpenSocialNetwork.appname= '##APPNAME##/' osn is a microframework that's in lib/externals ( as are various other modules ; i find it easier to maintain apps like this ) ; this code does nothing special, other than stashing the appname -- however once that's done, it makes life a whole lot easier trying to access different modules within the app from the microframework , which is what I think you're trying to do ? -- 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.
any good references / best practices for Test Driven Design and Integrated Testing with Pylons ?
I really do love the fact that Pylons offers the unit tests ; however as others have mentioned - they can be really difficult to use when session based data is concerned ( or when forms require access to Globals ,etc etc ) I pretty much stopped using them a while back, and just started doing everything with selenium. I'd like to transition back into using them though - so i can have automated testing and deployment. I'm wondering if anyone has a reference for some examples and best- practices on Pylons testing. -- 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: Versioned routes
routes allows for functions to be used - you could match on the / app, and then use a function to determine the function. there are a few examples in this mailing list archives, the docs on routes don't really make this feature clear ( or even how to use it ) -- 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: which is the best ORM recommended?
for what its worth... I find ORM useful for three things: - inserts of new records - updates of single records - displaying data in templates i find ORM a hassle on larger items. i'd much rather write SQL myself , that i know is optimized and i have control over. A great middle ground which I've found, is that in many instances an ORM allows you to supply the raw SQL, or you can do manual SQL queries and 'bless' ( to borrow from Perl ) the results into an object. With situations like this, you can get the benefit in the View/templates that the ORM provides, while keeping your model and controller much more sane and optimized. -- 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: Link to files stored in data directory
i store the files into a top-level directory called user_uploads ( ie. on the same level as data and public ) i do this, only because i find it easier to handle backups / redundancy when the images are 'public', i have a symlink from public/_img/NAME into that directory. just to note, i never have pylons serve these files - i have nginx serve those directories itself. and when files are not public, i can still access them with pylons too. -- 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: redirect and template_context
just to add... the return in return redirect is unnecessary. a simple redirect will suffice. redirect raises an exception, which Pylons itself catches. as wyatt stated, the script is terminated, and the user is redirected to a new page with the c context tossed out. i usually toss any necesary vars for the redirect into a session or url message as well. -- 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.
looping sqlalchemy attributes
my code is still running on sqlalchemy .48, so if this has been addressed in future versions - let me know! lets say i have a one-to-many sqlalchemy relation, and loop an attribute called items: def cleanup( cart ): for item in cart.items: if item.qty == 0 : self.dbSession('write').delete( item ) once i call cleanup(cart) , how can i ensure that looping through cart.items will not bring up the deleted items ? if i loop through the cart.items again, I'll have None types where I deleted i found that if i do a flush() and expire() , i can avoid this for item in cart.items: ... self.dbSession('write').flush() self.dbSession('write').expire(cart) Is this the best way to handle the situation ? is there something better ? -- 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: Validating a select box
Mike danced around a good point above which he didn't explictly mention - for most formencode validators the results will be Strings -- both in the validator and form_result. So they may mess up your comparisons or validations. -- 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: Validating a select box
sorry, i'm sick and really loopy... let me rephrase ( and this may have changed since last i tested a while bac ) everything that comes through request.params / submitted to your pylons app is a string there are some neat validators that will handle conversions for you, so everything is seamless / painless however, lets say that your select field has only these valid ids, which you know of as constants from your database: valid_ids= [0,1,2,3,5,8,13,21,34] but if you choose something like: valid= formencode.validators.OneOf( valid_ids ) most will be invalid , because this is really what we want: valid= formencode.validators.OneOf( [ %s%i for i in valid_ids] ) so... enter things like mike's neat validator, which is A combination of the Int and OneOf validators with a custom message and now you're able to do valid= formencode.validators.SelectInt( valid_ids ) -- 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.
unexpected behavior of request.params after validate ; is this intentional of webob (not @validate)?
i spent the past 3 hours going through my own validate code, and the original pylons that i forked off of, trying to figure out why params is always empty on a form error. i finally tracked down the issue. @validate has this line, so that the form can be re-run as a GET with htmlfill args: request.environ['REQUEST_METHOD']= 'GET' and this is the weird behavior: once this is set, it appears to be impossible to access any POST vars via : request.params.get(var) # makes sense request.params.POST(var) # empty request.params.POST # empty however if i run this: request.environ['REQUEST_METHOD']= 'POST' then all my data is accessible again. this seems to happen because of this line in webob: if self.method not in ('POST', 'PUT'): return NoVars('Not a form request') i'm not sure if this was intentional , or some sort of optimization. -- 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: Validating whether a field value is equal to another
personally, i keep anything that could hit the database away from formencode i use formencode to validate presence and formatting / regex, and keep the db logic within a try/except block. if i have an error, i'll raise a SubmissionError - or similar - and then return the form. i do this for a few reasons: a_ i find fancy validation schemes to be a (*((*...@## (*...@# ))@# and generally not worth time doing b_ i find putting db logic and advanced stuff in the main controller record to be much much easier c_ i dont want to touch the db unless the form content is valid. nearly every form i use would need a WRITE handle on the database. a precious, precious, write handle. i don't like tying up a write handle when not needed, nor do i like the idea of locking tables on something that is more likely to fail (than other operations). i could go on, but you get my point ;) -- 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: @validate revisited, JSON support, content negotiation
ah, interesting -- so the validation becomes a function of the controller. i'd like to make a suggestion to your then. i have an arg to validate called gatekeeper , which is enabled as True by default ( along with post_only ) In conjunction with one another, gatekeeper just makes sure that if you GET a form that is post_only ( or: not on_get ) , you automatically raise an error. in the original pylons distro, it was possible to GET a post_only form and have things not work out the way you would want them to. personally i thought it opened the door to security issues, others disagreed. ``gatekeeper`` Default True. Boolean to raise an error on form submission if not complete. the code in mine/patch to distribution is : if request.environ['REQUEST_METHOD'] == 'GET' and not on_get: if gatekeeper: ControllerInstance.osn_form.is_error= True raise ValidationStop() I'm not sure how it would work on yours. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Pylons and images from database
if you store things on the filesystem, you'll need to use a hashing algorithm to bucket it effectively -- filesystems don't like too many files in a directory. you don't need to rename the file to a hash -- you could just store that in the db -- but I'd advise renaming the file to a hash, because then you can write a regex rule or something super simple to serve it. ie: a file named aabbccddeeff.jpg would end up as aa/bb/cc/dd/ee/ff/ aabbccddeeff.jpg ; a rewrite rule could easily map requests for http:/ img .site.com/aabbccddeeff.jpg to that folder ; you wouldn't have to include the actual filepath. in my years i've learned a few things: 1- hashing to md5 base 16(hex) is fine. if you do 3 chars per directory, you have 4096 buckets in each level; going 3 deep gives you a ton of directories. if you do base32, you can do 2 chars per directory, and have 1024 in each level. a couple of filesystems start to degrade around 1k and 10k files - so this could improve performance. 2- if you bucket items by numeric id, bucket backwards. ie: 123456789 - 9/8/7/6/5/4/3/2/1/123456789. there's a math law about this, i can't remember the title, but basically points out that you'll round- robin evenly if you bucket from the back, but you'll have a new bucket every power-of-10 if you bucket forwards.. On Feb 24, 12:59 pm, Matt Feifarek matt.feifa...@gmail.com wrote: If you're worried about filename integrity (including full path) you can hash the files and store the fingerprints. I've done that before; works nice. While not secure (whatever) md5 is so fast that even a several meg file can be hashed in so little time you kinda don't notice it unless you're doing something really big. But if you know that nobody will ever mess with the actual filesystem storage, you can probably rely on the filenames. -- 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: does session.save() not work if you raise an exception? is there a way to override ?
just to clarify, this is beaker sesssions -- not SA -- 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: @validate revisited, JSON support, content negotiation
does this new approach allow for form errors to be re-triggered in the controller like my stab ( http://groups.google.com/group/pylons-discuss/browse_thread/thread/4269ca745e31793 ) ? because that's the only thing i care about. example: from OpenSocialNetwork.lib.decorators import osn_validate , osn_form_error from OpenSocialNetwork.lib.errors import SubmissionError @osn_validate( schema=Forms_Checkout.Shipping_1() , form='_checkout_shipping__print' , post_only=True ) def _checkout_shipping__submit(self): try: raise SubmissionError('Whatever') except SubmissionError , e : h.formerrors_set( message='!!!' ) return osn_form_reprint( self , '_checkout_shipping__print' ) except : raise -- 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: Writing a web app as a series of plugins
I tried to do this before, and gave up. It became WAY too confusing and difficult to manage as WSGI components. What I ended up doing is creating a single WSGI component to 'plugin' and bootstrap some special variables into 'c'. I then created a series of Libraries that offer functions and basic controllers. So a basic myspace style site would just inherit from the superclasses as below. I also have each 'plugin' controller use the controller name as a prefix to the classmethod, so its clear where stuff comes from when you have multiple plugins in the same controller. controllers/account.py - import opensocialnetwork from app.lib.base import BaseControllerInheritsFromOSN class AccountController( opensocialnetwork.lib.controllers.account_home.AccountHomeController, opensocialnetwork.lib.controllers.account_photos.AccountPhotosController, opensocialnetwork.lib.controllers.account_password.AccountPasswordController, BaseControllerInheritsFromOSN ): pass -- 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: My experience upgrading to Pylons 1.0b
On Feb 12, 3:33 pm, Wyatt Baldwin wyatt.lee.bald...@gmail.com wrote: The only other thing that threw me off (just a little) was `app_globals`. It was clear that `pylons.c` and `pylons.g` are gone, but it wasn't clear that `g` is no longer available in *templates*, partly because `c` still is and partly because the 1.0 docs (http:// pylonshq.com/docs/en/1.0/) say the `g` alias is available. Thanks for the update! This sounds annoying to me. I use g quite a bit, to preload config stuff /db constants at startup, and display them throughout templates. not having this in templates will be an issue. sigh. -- 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: handling secure information
Showing the last 4 digits and Card type is common , and the industry standard in business in the US. It's what every large online retailer /biller does, its what credit receipts do -- its generally fine for users and companies alike. Usually its shown as VISA : 1234 What you need to check with , however, is what your Credit Card processing agreement states. They often state what can and can't be shown to the client -- and showing those 4 digits /might/ make your company liable for credit card fraud. Personally, I try to avoid stuff like that by using 3rd party checkouts. I don't want to deal with the liability on CC numbers, I'd rather Yahoo/Paypal worry about that. Under $20k/month in transactions, and its cheaper than a merchant account anyways. -- 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: writing to g/app_globals -- is it safe for caching info after startup ?
On Feb 9, 10:19 am, Damian damiandimm...@gmail.com wrote: app globals is not thread safe - if you write to it concurrently you will be in trouble. I keep a lot of stuff in app globals that is set on startup and never changed. Thanks for that :( I'm wondering... maybe there is a way to handle this with semaphores ? ie - one could 'queue' up some variables to be updated into app_globals, and set a semaphore. eventually a process would come in , see the queued request, and act on it. that could eliminate race conditions. -- 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: writing to g/app_globals -- is it safe for caching info after startup ?
On Feb 9, 6:15 am, Pēteris Caune cuu...@gmail.com wrote: One thing to keep in mind is that if you'll deploy your webapp with Apache and mod_wsgi, Having spent much time with Apache's internals and mod_perl, I never use Apache unless I have to. Which means I only use it for running mod_perl apps. -- 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: writing to g/app_globals -- is it safe for caching info after startup ?
On Feb 9, 2:57 pm, Mike Orr sluggos...@gmail.com wrote: The reason the SQLAlchemy Session was moved from app_globals to the model was not because it's unsafe, but so that the model can be used standalone without depending on the rest of the application or Pylons. When did that happen? If its post 0.9.7 , are there docs on that ? -- 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: writing to g/app_globals -- is it safe for caching info after startup ?
On Feb 9, 5:04 pm, Mike Orr sluggos...@gmail.com wrote: It was earlier, in 0.9.6 or 0.9.7 that it happened. Yay! -- 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: Caching in pylons?
On Feb 8, 9:16 am, gazza burslem2...@yahoo.com wrote: I can just use the autocomplete=off for selected fields. i didn't know browsers respected that. neat! with the prefix concept above, every request would have a different prefix... so autocomplete/autofill wouldn't know how to use browser cached information. the mozilla version, for example, autofills 'address' forms based on previous address forms. if you can change the field names enough, and keep them from repeating (by using a different random prefix each time) you should be able to trick the autocomplete option. -- 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.
writing to g/app_globals -- is it safe for caching info after startup ?
i have some data that I cache on startup -- mostly config info and misc database intensive stuff. i need to reload every so often. is it safe to reload it into g ? or should i cache this in memcached or similar ? -- 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: Caching in pylons?
beaker has an invalidate call which will expire the cached it. if you're trying to turn caching off for the pages, caching is explicit -- so just don't call it. -- 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: Caching in pylons?
On Feb 7, 8:32 pm, Mike Orr sluggos...@gmail.com wrote: You may be observing a different phenomenon, where the browser saves the values input into forms, and offers to re-enter them later if the form looks similar enough. This is not related to the cache settings. It's related to the form-data preference. This is what this sounds like to me. It's a client-side issue , most browsers call this Auto Fill and a feature. I find it annoying. If you really want to get rid of this, you'd have to use different fieldnames on each form. Maybe do something like: input type='hidden' name='prefix' value='1we' input type='text' name='1we-name' value='' input type='text' name='1we-prefix' value='' -- 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: Do your models handle all the data logic?
On Feb 3, 12:28 pm, Haron Media i...@haronmedia.com wrote: But if you have the constraints, you're doing the checks twice. First from your application, and then the db engine does it anyways since there are constraints. Perhaps you don't have a performance hit, but I can assure you, if you had a (highly) concurrent system and lots of rows to check and lock through (because you need SELECT ... FOR UPDATE; alternatively just lock the entire table) the performance hit would become significant and visible. Absolutely -- one would have a significant performance hit on a highly concurrent system. However I've only worked on a handful of sites in my entire life where this would cause a noticeable issue. Very few folks deal with this amount of traffic, and approaches like yours are premature optimization for most folks. It's great that this is a real issue for you. -- 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: Do your models handle all the data logic?
I use PostgreSQL exclusively too, and rely on tons of constraints within the db - from unique indexes built through functions, to actual functions themselves. I still, pretty much, always query the db to check for a duplicate value or possible constraint violation. 1- It's easier than parsing errors. plus you don't have to continually flush() or save() to trap the error. 2- There's really not much of a performance hit on any site i've ever worked on. In terms of the MVC debate - I've gone through the entire array of options that Mike Orr has illustrated ( though not all in Pylons ). I've had Models that have most of the logic, and the Controllers just call them... I've had Models that have no logic... and I've had Models that wrap ORMs as an abstraction layer, so I can use multiple backends (or ORMs ) easily. After years of struggle, I've ended up with this approach: - I put 'search' and 'new' functions in the model. I also put 'render' functions too ( like model.F_url() to display a url ) - If more than one controller needs to do similar operations on the model, I break it out into a helper method and stash it as a library function. The problem I encountered with putting too much logic in the models, is that MANY of my models were highly interrelated with other models. From a maintenance and testing standpoint, this created too many headaches. I really don't like 'horizontal' interactions of models creating and modifying one another. So many issues arose. Examples that caused issues for me were Group creates / controls Members ( and vice versa ); or if Account creates AccountAsset or ApiKey. I can't recall if I had the most issues with Python or Perl or something else... but with horizontal interaction within the model, I always had issues of inclusion order / dependencies / etc. So I've found it simpler that each Model is only concerned with a representation of One member of its own class -- and that a Controller , or helper function , handles the interrelation of all of them. -- 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: Caching all but 1 variable.
On Feb 2, 3:07 pm, Andy (Zenom) stress...@gmail.com wrote: Someone in IRC said write a wrapper, but having a hard time wrapping my head around this, since the data I need to cache is all in the controller and there could be multiple queries etc. If I wrap the render method somehow, then the queries are still going to run before the cache render function would run. I do almost the same thing in a few places on ArtWeLove.com The two techniques I use: - In most instances, Pylons writes a .php file. Yeah, I hate that damn language too -- but running php through nginx+fcgi with a couple of optimizations makes it considerably faster than Pylons. Nginx just knows which directories to serve as php, and which to not. If there are a handful of variables , i'll often have pylons write out a php file that is just a dict/array of the variables in php. - In some instances, I just use beaker caching. this is confusing to explain, so i'll try to illustrate with code that handles 1 'heavy db call' fragment. In practice, our splash page has 3 zones that we do this to. index-fragment-a.mako % for item in dbcall: do stuff index.mako %inherit file=/@site-template.mako/ ${h.literal(c.rendered_fragment__a)} splash.py def splash(self): page_cache= cache.get_cache('awl.page',cache_type='memory') c.rendered_fragment__a = page_cache.get_value( 'splash:a', createfunc= self._splash_generate_fragment_a , expiretime=g.awl_cache_expiry_page ) c.code= CODE return render ('/index.mako') def _splash_generate_fragment_a(self): self._dbSessionSetup('read') lots of db calls return render ('/index-fragment-a.mako') does that make sense? There's a third technique you could do as well -- you could just render the page and store in beaker , and either have that template generate a mako template ( by escaping certain interpolation stuff ) or just some raw html with a string like CODE# then do def splash(self): page_cache= cache.get_cache() template= page_cache.get_value( 'splash:a', createfunc= self._generate ) template= template.replace( 'CODE', code ) return template i think there's a way to render() on a string too (instead of a file ) so it could be... c.code= CODE return render( string_template= template ) i have no idea what the params would be -- i made up string_template... but i'm pretty sure i've seen that in the templating source code. -- 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: two routes / dispatch questions
On Jan 30, 2:06 am, Mike Orr sluggos...@gmail.com wrote: I consider such slash manipulation to be highly unorthodox and undesirable, but that's how you can do it if you want to. Thanks Mike! I find the slash manipulation to be standard. The default behavior for static webservers has been: filesystem: /folder/index.html urls: /folder/index.html /folder/ /folder ( redirects to /folder/ ) -- 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.
two routes / dispatch questions
using Routes 1.10 and 1.11 ... 1) how can i match to a single controller's /admin - def index /admin/ - def index /admin/$action$ - def $action must i do this explicitly in two calls ? because /admin/{action} requires the / 2) is it possible to use the {action} as a string component of the action name ? or would i have to make a custom routes implementation.. or dispatch to a method that can re-dispatch within the controller i.e. /error/{action} - def error__$action$ -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Lazy Registration
On Jan 25, 4:36 am, Wichert Akkerman wich...@wiggy.net wrote: Beaker sessions. either beaker sessions, or just use a beaker session id as the shopping cart / user id you could do a dbtable that has this: table: cart id bigserial primary key not null, session_id char(32) unique , useraccount_id bigint references useraccount(id), allow null in session_id and useraccount_id , so that session carts can be merged into useraccount carts after registration, and vice- versa. -- 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: How extensible is AuthKit?
i don't like AuthKit ( no offense James ! - it's just never served my needs ) and have had to integrate with systems like you describe. so the tips i can give are this: - create your validation and cookie-set/expire functions in something like app/lib/helpers/auth.py - put the logic you need in an abstract BaseController that your real base controllers inherit from - use class variables like self._auth_required to turn the auth routine on/off on the BaseController if you contact me offlist, I can give you my BaseController and sample derivative classes -- 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: Roadmap / 0.10 / 1.0 (resource routes)
On Dec 21, 3:54 pm, Mike Orr sluggos...@gmail.com wrote: def resource2(self, name, path, new=True, edit=True, delete=True): GET /myresource : view index GET /myresource/new : new form POST /myresource/new : new action GET /myresource/1 : view record 1 GET /myresource/1/edit : edit form POST /myresource/1/edit : edit action GET /myresource/1/delete : delete form POST /myresource/1/delete : delete action I don't like stuff like this, so I could care less. But... If you're going this route, it might make sense to do canned conditions for the most likely implementations, like ned=True would set up new, edit and delete. i've seen that in a few different settings. most notably the Amazon S3 implementation -- where that option really does clean up a lot of code and make it easier to work with. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Calling a controllers method from another method? Is there a 'safe' way without redirecting?
First, thanks all. Subrequests in Apache are weird. IIRC, they appear to be a new request - but something in mod_perl's request context object will note that it is a subrequest, and provide a facility to access the 'top level' context object information. this is in line with what Shailesh stated. Mike- you bring up return self.othermethod() as an alternative. do you think this would work : return OtherController().othermethod() Wichert- 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-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Calling a controllers method from another method? Is there a 'safe' way without redirecting?
mike- on the subject... does Pylons have a subrequest facility ? Some platforms , like mod_perl , offer it: http://perl.apache.org/docs/2.0/api/Apache2/SubRequest.html internal_redirect Redirect the current request to some other uri internally $r-internal_redirect($new_uri); * obj: $r ( Apache2::RequestRec object ) The current request * arg1: $new_uri ( string ) The URI to replace the current request with * ret: no return value * since: 2.0.00 In case that you want some other request to be served as the top-level request instead of what the client requested directly, call this method from a handler, and then immediately return Apache2::Const::OK. The client will be unaware the a different request was served to her behind the scenes. -- 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: clearing out old cache/session files from beaker
to be honest... a while back, i set my sessions to be flat-file based, just because I didn't want to deal with the stuff you're going through ;) i had sessions in postgres at one time, but i don't think they were beaker based. it was a tie-in to some mod_perl legacy apps. for them i did this paradigm: session_write to memcached , if there is any data-change other than accessinfo, wrte to postgres too session_read from memcached, failover to postgres, failover to new session a cronjob would clear out old session stuff from both . it was really fast , because the timestamp column was just 1 line. i don't recall how the bdb / dbm stuff works. you may have to inspeact/loop sessions. but it should still be lightning fast. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Calling a controllers method from another method? Is there a 'safe' way without redirecting?
On Dec 6, 1:40 pm, jnowl john_now...@carleton.ca wrote: Ha! O.k. I think it's pretty clear who is confused. :) ha! just to reiterate on mike's point above, please don't take any of my curt responses as being insensitive, mean or condescending. i just meant for you to read up on that stuff yourself -- since that's really going to be the best/only way to learn. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Calling a controllers method from another method? Is there a 'safe' way without redirecting?
On Dec 5, 3:37 pm, Mike Orr sluggos...@gmail.com wrote: Ouch, that sounds like I'm better than you but I'm not going to tell you why. In other words, it may or may not be true, depending on whatever he might be basing it on. That's supposed to sound like Every website on the internet follows a certain paradigm. If you don't know why, you should be searching to learn -- because everyone will be wasting their time trying to teach you the right thing and you're not going to listen until you read it elsewhere as that's how people who ask for help always act . In terms of login actions ( as referenced above ) it is absolutely true. Getting back to the issue... as I said before , render just returns the value of the render. the reason why the code does not work, is because the OP is not calling return class AController(BaseController): def foo(self): #do stuff print 'in foo' return render(/foo.html) def bar(self): 'v' in request.params or self.foo() # foo should not return, it is calling render print 'what am i doing here?' v = request.params['v'] #attribute error if I visithttp://localhost/pylons/a/bar/. Why doesn't it render foo? #continue doing stuff However this code prints 'in foo' then 'what am I doing here?' and I think its because the request cycle is getting things confused (kind of jumping into another one before finishing first). While perhaps not a bug (but I'm not sure of that, it is indeterminate what will happen), it could be handled better and would be if I could throw out the response so far and restart with the new method (be more performant as well). self.foo() does not dispatch a new request, it merely calls the foo() method of self inline the request cycle is not getting confused. the dispatcher called self.bar() , and that is it. self is just a python object. if you want to return the output of foo, the code should be def bar(self): if 'v' not in request.params: return self.foo() print 'what am i doing here?' v= request.params['v'] #continue doing stuff Why doesn't it render foo? the original code did render foo. however it did nothing with the output. calling self.foo() doesn't create a new request / re-dispatch , it just runs foo() like any other python object woud. if you want to do that, you need to redirect or subrequest. in order to foo() and stop and return the output of foo() to the browser, you would call return self.foo() Look through my first example, and Graham's later example -- which both addressed this pattern. -- 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.