Re: running a controller method outside wsgi app
Previously Dalius Dobravolskas wrote: On Mon, Jan 19, 2009 at 9:34 AM, Wichert Akkerman wich...@wiggy.net wrote: Previously Dalius Dobravolskas wrote: Hello, On Mon, Jan 19, 2009 at 7:44 AM, Roberto Allende ro...@menttes.com wrote: My motivation is to write a unit testing but even in other cases it could have sense to use a controller function isolated. Or at least in my case, this is the only restriction. If your intention is unit-testing do it Pylons way: http://wiki.pylonshq.com/display/pylonsdocs/Unit+Testing That is not unit testing, that is functional testing. What's the difference except that your way might be a little bit more-efficient (like 20%)? I have seen several different ways of unit-testing pylons applications but basically they just help to do the same. What makes unit-testing functional testing in your opinion? I run the controller method in isolation, which means: - no other middleware that influences the result - I can put stuf in c before I call the controller method, and introspect c afterwards - no paste.fixture or WebTest influencing the result with a unittest you want to call something in isolation, without anything else being present. This is the only way to do that. Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: running a controller method outside wsgi app
On Mon, Jan 19, 2009 at 10:18 AM, Wichert Akkerman wich...@wiggy.netwrote: I run the controller method in isolation, which means: - no other middleware that influences the result - I can put stuf in c before I call the controller method, and introspect c afterwards - no paste.fixture or WebTest influencing the result with a unittest you want to call something in isolation, without anything else being present. This is the only way to do that. I see some value in that. Thanks. -- Dalius http://blog.sandbox.lt --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Is Django more popular than Pylons?
On Sun, Jan 18, 2009 at 6:05 PM, walterbyrd walterb...@iname.com wrote: And if so, why? yes, so does php, your 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-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 -~--~~~~--~~--~--~---
hasattr and context object
In interactive debugger: hasattr(c,'name') True hasattr(c,'nafssadffa') True Huh? Why does hasattr return True for attributes that clearly don't exist in c? On related note, how to check for existence of attributes in c in templates? I want to do smth like: %if c.hasattr('name'): c.name has no attribute 'name' %else: c.name has attribute ${c.name} %endif Regards, mk --~--~-~--~~~---~--~~ 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: hasattr and context object
P.S. If I try: %if c.hasattr('name'): in template, I get: TypeError: 'str' object is not callable Does that mean that c.hasattr tries to call 'name' for some reason? Regards, mk --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Redirect with additional headers for ajax
I use ajax for few pages in my app. Sometimes I need to redirect page from example: index to index2 The problem is when I get index with request.is_xhr == True and have to redirect to index 2. In next page request.is_xhr == False. jQuery do not add 'X-Requested-With': XMLHttpRequest' to redirected page. Is some possibility to add headers with XMLHttpRequest to method of controller: [...] # add header return redirect_to('page/index2') and then would be works when I check request.is_xhr? Best Regards, Tomek --~--~-~--~~~---~--~~ 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: hasattr and context object
OK this works only after adding config['pylons.strict_c'] = True to environment.py: %if not hasattr(c, 'name'): c.name has no attribute 'name' %else: c.name has attribute ${c.name} %endif I still don't get why hasattr on c has to return True if pylons.strict_c is turned off (well I do understand that if strict_c is turned off you can enter c.anynonexistentname in template and get empty string, but is it strictly necessary?) Regards, mki --~--~-~--~~~---~--~~ 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: Redirect with additional headers for ajax
Hi, You can do what you want with the response. In pylons, both request and response are webob objects (http://pythonpaste.org/webob/reference.html#id3) from pylons import response response.headers['Blah'] = 'blah' Regards, -- Gael On Mon, Jan 19, 2009 at 2:12 PM, Tomasz Narloch toma...@wp.pl wrote: I use ajax for few pages in my app. Sometimes I need to redirect page from example: index to index2 The problem is when I get index with request.is_xhr == True and have to redirect to index 2. In next page request.is_xhr == False. jQuery do not add 'X-Requested-With': XMLHttpRequest' to redirected page. Is some possibility to add headers with XMLHttpRequest to method of controller: [...] # add header return redirect_to('page/index2') and then would be works when I check request.is_xhr? Best Regards, Tomek --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Webhelpers question
Is there anyway to output forms fields without the table structure? Right now when I do this: snipping leading template stuff ${h.field( Document Title, h.text(name='title'), required=True )} ${h.field( Department, h.text(name='department'), required=True )} snip I get: td class=label valign=topspan class=required*/ spanlabelDocument Title:/label/td td class=field colspan=2 valign=topinput id=title name=title type=text //td /tr tr class=field td class=label valign=topspan class=required*/ spanlabelDepartment:/label/td td class=field colspan=2 valign=topinput id=department name=department type=text //td /tr I'd rather have something like this: labelspan class=required*/spanDocument Title:/labelinput id=title name=title type=text / labelspan class=required*/spanDepartment:/labelinput id=department name=department type=text / I looked at the webhelper docs at http://pylonshq.com/WebHelpers/ but they seem really out of date. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
how to - read uploaded images more than 1x
this is annoying me... just realized that some code has been failing because it is reading an image upload twice. the first time is fine. the second time is empty. it seems this is because the file is stored as a socket._fileobject ( http://epydoc.sourceforge.net/stdlib/socket._fileobject-class.html ) , and after being read the pointer ( obj._consumed ) is set to the length of the file. socket._fileobject doesn't accept seek() , so i can't manually reset this. anyone have a clue what 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-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 - read uploaded images more than 1x
just to add... i'm currently using a workaround of reading this into a cStringIO.StringIO object that supports seek(0) -- i just think its a little silly that I need to do 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-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: Django or Pylons - comparison details
Being a pylons newb myself, the first thing I did was write auth and registration. It took a day.Granted I wasn't trying to support every auth method I could think of like authkit does,but I learned lots.If you want auth (and other things) rolled in use use turbogears. But getting basic authentication and registration working is not that big of a deal. On Dec 8 2008, 8:50 am, Jorge Vargas jorge.var...@gmail.com wrote: that is because a) the author or authkit is never around b) authkit is way over complicated c) autukit sucks in other ways d) all of the above. that said, I do think that a default auth should be added to pylons, as it's a pretty common feeture but that's another discussion. if you hate your tool then change it. Now don't come back complaining that django wants you to do things in X,Y and Z way, and even if that's bad/dumb/not-the-best you will expend way way more time trying to get around 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: Django or Pylons - comparison details
The SQLAlchemy argument is a very compelling one. I have an application that, while being a CMS, has heavily relational data. I was urged by different people to do it either in Django or Plone, but went with Pylons. My domain objects are far easier to work with, though I did suffer from the authentication layer and a few other things I had to build from scratch. Django can use SQLAlchemy, but by doing so you pretty much nullify a lot of the things that are unique to that framework like their automatic admin interfaces. Django's object generation came nowhere near understanding my moderately-complicated data model and would have been much more difficult to develop with, as compared to Pylons with SQLAlchemy. On another note: I find it interesting that a lot of people recommend Django for CMS-type applications. I would think that Plone might be more far more suitable given that: 1. your data fits well with the hierarchical structure of the ZODB 2. your content is comparable to the content types already established in Plone 3. you don't have any legacy data or need to integrate with other systems 4. you don't need to do lots of custom UI/presentation layer work I'm curious if Django's CMS reputation comes from the fact that it's used by a lot of newspapers and content providers, or if there really is something that makes it advantageous over other frameworks. - Original Message From: chris.mol...@gmail.com chris.mol...@gmail.com To: pylons-discuss pylons-discuss@googlegroups.com Sent: Monday, January 19, 2009 11:17:23 AM Subject: Re: Django or Pylons - comparison details That's it.. that's the reason to use Pylons: SQLAlchemy. If you need to actually use a database correctly (which I'm guessing that you do), then you need to use Pylons. The db framework that ships with Django tries to be functionally compatible with RoR-style development... which is ok, as long you don't use your DB for anything more than 'select.. '. Totally brain-dead, IMO...and frankly targeted for people w/o DB experience. On Dec 6 2008, 4:42 pm, Noah Gift noah.g...@gmail.com wrote: On Sun, Dec 7, 2008 at 7:39 AM, Ben Bangert b...@groovie.org wrote: On Dec 6, 2008, at 9:31 AM, zunzun wrote: Comparison before starting a project, used to decide which framework to use. Django: according tohttp://groups.google.com/group/django-users/about Members 12,016 Group Activity is High Pylons: according tohttp://groups.google.com/group/pylons-discuss/about Members: 1,748 Group Activity is Low Really? That's how you decide? Then I believe you *must* choose PHP. It completely dwarfs Django and Python altogether, its the only choice really if you want to determine framework based on user-base (popularity). :) Also, Django just made a major release. The last (non-security fix) Pylons release is over a year old. Guido van Rossum has blessed Django here: http://www.djangoproject.com/weblog/2006/aug/07/guidointerview/ Before that release, they hadn't made a release in almost 2 years, and actually told everyone to run production websites on the development branch... Pylons 0.9.7 RC4 came out about 2 weeks ago. Guido is not a veteran web developer, nor does he actually use any of Django beyond Django templates, his apps have been generally built with pure WSGI and Django templates, the recent port of his Mondrian to a Django app was prolly his first actual Django project. Seems like I should use Django? Or should it be Pylons instead? Is a long-planned major release immediately forthcoming? What kind of app/site are you building? What tools matter to you? Do you think you'll need to scale heavily? Are you talking to a legacy database? etc. Those questions are the ones you should be asking yourself, then seeing which framework has the tools you need to accomplish your task. Otherwise, merely posting some mail list numbers and that Guido likes Django seems to be awfully trollish as it doesn't seem to be a serious attempt to evaluate the frameworks benefits for the task you're actually trying to complete. I'd highly suggest searching the mail list for some previous threads on the subject, as this doesn't really need rehashing again. http://markmail.org/search/?q=list%3Apylons+django+pylons I wouldn't necessarily agree that it doesn't need rehashing, at least from a marketing and documentation perspective. I just talked with some co-workers last week, that are very experienced Python programmers and they asked me why they hadn't heard about Pylon's much. One person mentioned he looked at it about a year and half ago, and decided to go with Django. Now he ran into a problem that only SQLAlchemy can solve, and after he went through the new pylons book online he was quite impressed. In my opinion Pylons and Django solve two different problems, although there is some overlap, but even still many people don't know this. For
Re: hasattr and context object
hasattr returns true because of the way that tmpl_context (c) is implemented. https://www.knowledgetap.com/hg/pylons-dev/file/98d7b9278acd/pylons/util.py#l115 You have ContextObj, and AttribSafeContextObj. By default, Pylons uses AttribSafeContextObj. Looking at the code, you can see that the __getattr__ method is overridden. This returns an empty string. For more infoon __getattr__, see here: http://docs.python.org/reference/datamodel.html#object.__getattr__ Now, hasattr returns true because, no matter what name you put, if it is not found on the actual context, it will still be found since we are by default returning an empty string. When you use strict_c, you are using the ContextObj, which does not override __getattr__, and as such has the default behavior of raising an exception as well as returning false from hasattr when the attribute is not found. --~--~-~--~~~---~--~~ 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: memcached beaker support
any chance the next version of beaker will be better integrated with pylons so it doesn't flush to the datastore on ever save() --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Is Django more popular than Pylons?
On Sun, Jan 18, 2009 at 4:05 PM, walterbyrd walterb...@iname.com wrote: And if so, why? Everybody who uses Pylons knows that other frameworks exist and had maybe tried one or two others, but has made a conscious choice that they like Pylons' style better. A lot of Django fans have done the same of course, but a lot of other Django fans have not really looked into any other frameworks, they just came to Django from Rails or PHP because they heard about it first and didn't look any further. -- 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 -~--~~~~--~~--~--~---
use content of variable c in controller through h.url_for
Hi, in an .mako template I can use the global variable c. Is there a way to call an other controller from the template via h.url_for and still use the content of the variable c as in the template? In the called controller c seems to be empty again. Regards, Michael --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Cannot use pylons variables under project.lib subdirectory
Hello. I've quite standard Pylons project that I'm working on for last few months. Recently I've cleaned up the code and created project.lib.helperslib subdir where I have created multiple python modules with corresponding functions e.g. date.py, buttons.py, links.py, etc. When functions were under project.lib.helpers everything worked fine. However when I moved those functions to different modules under helperslib subdir I cannot use pylons variables anymore. For example. When I'm importing config like this: from pylons import config or trying to get _() function like this: from pylons.i18n import _ I'm getting errors like: File /usr/lib/python2.5/site-packages/Pylons-0.9.7rc4-py2.5.egg/pylons/i18n/translation.py, line 106, in ugettext return pylons.translator.ugettext(value) File /usr/lib/python2.5/site-packages/Paste-1.7.2-py2.5.egg/paste/registry.py, line 137, in __getattr__ return getattr(self._current_obj(), attr) File /usr/lib/python2.5/site-packages/Paste-1.7.2-py2.5.egg/paste/registry.py, line 194, in _current_obj 'thread' % self.name__) TypeError: No object (name: translator) has been registered for this thread Also. When I'm trying to use config.get('value') I'm getting null values. It worked fine with Pylons 0.9.6.1, but after updating to Pylons 0.9.7rc-4 it's not working anymore. Unfortunatelly I can't revert back to older version of Pylons, so I'm stuck. I thought maybe importing load_environment would do the trick, but unfortunatelly no. When I'm importing it like this: from project.config.environment import load_environment I'm getting this error: File /home/wolverine/development/project/project/lib/helperslib/date.py, line 6, in module from project.config.environment import load_environment ImportError: cannot import name load_environment Honestly. I'm stuck. I was looking for the answer on google and google groups, but I'm out of luck. Could someone shed some light on this issue? I would greatly appreciate your help. Best regards, Karol Tomala --~--~-~--~~~---~--~~ 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: hasattr and context object
Have you got strict_c set to False? http://wiki.pylonshq.com/pages/viewpage.action?pageId=11174779#What%27snewinPylons0.9.7?-ImplicitBehaviorchanges On Mon, Jan 19, 2009 at 12:19 PM, mk mrk...@gmail.com wrote: In interactive debugger: hasattr(c,'name') True hasattr(c,'nafssadffa') True Huh? Why does hasattr return True for attributes that clearly don't exist in c? On related note, how to check for existence of attributes in c in templates? I want to do smth like: %if c.hasattr('name'): c.name has no attribute 'name' %else: c.name has attribute ${c.name} %endif Regards, mk --~--~-~--~~~---~--~~ 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: Webhelpers question
On Mon, Jan 19, 2009 at 7:39 AM, Josh Winslow jwins...@gmail.com wrote: Is there anyway to output forms fields without the table structure? Right now when I do this: snipping leading template stuff ${h.field( Document Title, h.text(name='title'), required=True )} The field helper was added to WebHelpers 0.6.3 as an experimental module, and was removed in WebHelpers 0.6.4 for being insufficiently robust. There is no consensus on the best way to lay out form fields. Tables are evil but divs have browser-specific issues. And I can't properly set label for= because field() doesn't know what text()'s ID is unless it's specified redundantly, and making field() call text() turns out to be just as problematic, and parsing text()'s output is even worse, etc. Templates work better for field layout than WebHelpers can hope to do. So in the end I made a less ambitions helper, title() (in webhelpers.html.tags), which does part of the layout (placing the field title in required or not-required style), and just punts on the ID issue by taking a ``label_for`` argument. This should work under all layout strategies. There's another field() in the Pylons book. That one was originally intended for WebHelpers but ended up in a separate package instead, FormBuild. -- 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: Django or Pylons - comparison details
On Tue, Jan 20, 2009 at 5:28 AM, Jonathan Vanasco jonat...@findmeon.com wrote: Django is like Rails -- it forces you into building certain types of apps with certain styles. If you build a Django app , you're pretty much married to it -- and can expect it to work much like other apps. That's not necessarily a bad thing. Pylons SqlAlchemy offer a lot more control. One of my websites is 90% ModPerl with 10% pylons offloaded ; we use the same tables db seamlessly. I don't know if its possible in django - but it was too hard to get done. Another one of my projects is 60% Pylons, 20% PHP and 20% MovableType (Perl). Again, Pylons power and flexibility let me seamlessly get all of them working together. ( btw , we're *finally* about to release a web framework toolkit based on Pylons that lets people do all this . huge product launches in the next 6 weeks after 1yr of development and testing ). Jonathan, This seems like a very interesting set of projects. I wonder if there is somewhere people could here, customer stories like this in one spot. I had no idea people where doing this with Django. --~--~-~--~~~---~--~~ 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: Cannot use pylons variables under project.lib subdirectory
On Mon, Jan 19, 2009 at 4:52 AM, Wolverine ktom...@gmail.com wrote: Hello. I've quite standard Pylons project that I'm working on for last few months. Recently I've cleaned up the code and created project.lib.helperslib subdir where I have created multiple python modules with corresponding functions e.g. date.py, buttons.py, links.py, etc. When functions were under project.lib.helpers everything worked fine. However when I moved those functions to different modules under helperslib subdir I cannot use pylons variables anymore. For example. When I'm importing config like this: TypeError: No object (name: translator) has been registered for this thread It doesn't matter where the helpers are defined. What matters is the environment when they're called. The Pylons special globals (c, translator, etc) are valid only when a request is active. If you want to use them in other contexts, you'd have to put fake objects onto them. The testing thread today had an example. Also. When I'm trying to use config.get('value') I'm getting null values. It worked fine with Pylons 0.9.6.1, but after updating to Pylons 0.9.7rc-4 it's not working anymore. What does working fine mean. 'config.get'nonexistent_variable)' should return None. Like the other special globals, pylons.config is a StackedObjectProxy which has a value pushed onto it at the beginning of each request, and popped at the end. However, unlike the others, the configuration is also pushed at the beginning of the application so it's available outside a request. However, this happens at a certain point, after load_environment is finished I think. When I'm importing it like this: from project.config.environment import load_environment I'm getting this error: File /home/wolverine/development/project/project/lib/helperslib/date.py, line 6, in module from project.config.environment import load_environment ImportError: cannot import name load_environment Import errors can happen for a lot of reasons. Can you import anything from the project? However, a helper module should not be calling load_environment. Let's start from the beginning. Where are you calling this date function? Does the function have to use the Pylons globals directly, or could you pass the needed values as arguments? Most helpers do not use the globals directly, precisely because that limits where the helpers can be used. -- 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: use content of variable c in controller through h.url_for
On Mon, Jan 19, 2009 at 2:54 AM, Michael m...@micm.eu wrote: Hi, in an .mako template I can use the global variable c. Is there a way to call an other controller from the template via h.url_for and still use the content of the variable c as in the template? In the called controller c seems to be empty again. When you go to another controller via h.url_for, it's a separate request with its own 'c' context. If you want to call a controller action from a different controller, you'd instantiate it and call it. But Pylons does so much behind the scenes to set up the controller that I don't know if that would work. It would be better to put common code into a private method in a superclass controller or in a separate function. -- 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: Django or Pylons - comparison details
On Mon, Jan 19, 2009 at 6:20 PM, Colin Flanagan quadvill...@yahoo.com wrote: I'm curious if Django's CMS reputation comes from the fact that it's used by a lot of newspapers and content providers, or if there really is something that makes it advantageous over other frameworks. Django's admin is very handy for content based sites. We're developing the Italian PyCon website with Django. While we develop the webiste some people can upload and review documents, rollback and stuff like that. Very nice. Nothing you can't code in Pylons or CGI with C, but it's nice to have it for free. -- Lawrence, http://oluyede.org - http://twitter.com/lawrenceoluyede It is difficult to get a man to understand something when his salary depends on not understanding it - Upton Sinclair --~--~-~--~~~---~--~~ 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: hasattr and context object
On Mon, Jan 19, 2009 at 9:44 AM, Mark Hildreth mark.k.hildr...@gmail.com wrote: hasattr returns true because of the way that tmpl_context (c) is implemented. https://www.knowledgetap.com/hg/pylons-dev/file/98d7b9278acd/pylons/util.py#l115 You have ContextObj, and AttribSafeContextObj. By default, Pylons uses AttribSafeContextObj. Looking at the code, you can see that the __getattr__ method is overridden. This returns an empty string. For more infoon __getattr__, see here: http://docs.python.org/reference/datamodel.html#object.__getattr__ Now, hasattr returns true because, no matter what name you put, if it is not found on the actual context, it will still be found since we are by default returning an empty string. When you use strict_c, you are using the ContextObj, which does not override __getattr__, and as such has the default behavior of raising an exception as well as returning false from hasattr when the attribute is not found. This is a bit low level for mk's question. When strict_c is true, 'c' acts as a normal Python object, raising an error if a nonexistent attribute is accessed. When strict_c is false, nonexistent attributes return the empty string. This is partly to imitate other frameworks/languages, partly for backward compatibility, and partly because the main developers like it that way. I would argue for the opposite because it's hard to notice or debug a variable that magically defaulted to something unexpected. 'c' -- as well as the other context globals (request, response, session, cache, app_globals, and config) -- are StackedObjectProxy objects. This allows multiple instances of Pylons applications to exist in the same process and share the module globals. With StackedObjectProxy, 'c' is the proxy object, and 'c._current_obj()' is the actual value that was pushed onto it. Normally the proxy calls ._current_obj() behind the scenes so you don't have to, but in certain cases it doesn't. 'c.hasattr' doesn't; that's why you're getting the proxy object instead. 'dir(c)' also doesn't, so you have to call 'dir(c._current_obj())' if you want to know which attributes have been set. I suppose you could say that dict access is transparent while method calls aren't, but that may not cover all the cases. -- 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: Django or Pylons - comparison details
On Jan 19, 9:20 am, Colin Flanagan quadvill...@yahoo.com wrote: The SQLAlchemy argument is a very compelling one. I have an application that, while being a CMS, has heavily relational data. I was urged by different people to do it either in Django or Plone, but went with Pylons. My domain objects are far easier to work with, though I did suffer from the authentication layer and a few other things I had to build from scratch. Django can use SQLAlchemy, but by doing so you pretty much nullify a lot of the things that are unique to that framework like their automatic admin interfaces. Django's object generation came nowhere near understanding my moderately-complicated data model and would have been much more difficult to develop with, as compared to Pylons with SQLAlchemy. On another note: I find it interesting that a lot of people recommend Django for CMS-type applications. I would think that Plone might be more far more suitable given that: 1. your data fits well with the hierarchical structure of the ZODB 2. your content is comparable to the content types already established in Plone 3. you don't have any legacy data or need to integrate with other systems 4. you don't need to do lots of custom UI/presentation layer work I'm no Plone expert, but I don't think #4 is a problem for Plone. I think there are actually quite a few Plone sites with custom UIs (my company's new Intranet being one of them). And just to add another voice to this SQLAlchemy hurrah, like Colin, I'm also doing (complex) GIS stuff with PostGIS ( Shapely GeoJSON PyProj). Having a bit of experience with both Django and Rails, I don't know how I'd accomplish with their ORMs what I can with SA. I'm not saying it's not possible, but it seems nowhere near as straightforward or flexible. I'm also using Pylons/SA with a big, ugly, legacy Oracle schema. Fun, fun, fun. PS If anyone needs an SA type def for PostGIS geometry columns, give me a shout. I have one version based on PCL and another on Shapely. --~--~-~--~~~---~--~~ 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: Django or Pylons - comparison details
On Jan 19, 1:29 pm, Wyatt Baldwin wyatt.lee.bald...@gmail.com wrote: On Jan 19, 9:20 am, Colin Flanagan quadvill...@yahoo.com wrote: The SQLAlchemy argument is a very compelling one. I have an application that, while being a CMS, has heavily relational data. I was urged by different people to do it either in Django or Plone, but went with Pylons. My domain objects are far easier to work with, though I did suffer from the authentication layer and a few other things I had to build from scratch. Django can use SQLAlchemy, but by doing so you pretty much nullify a lot of the things that are unique to that framework like their automatic admin interfaces. Django's object generation came nowhere near understanding my moderately-complicated data model and would have been much more difficult to develop with, as compared to Pylons with SQLAlchemy. On another note: I find it interesting that a lot of people recommend Django for CMS-type applications. I would think that Plone might be more far more suitable given that: 1. your data fits well with the hierarchical structure of the ZODB 2. your content is comparable to the content types already established in Plone 3. you don't have any legacy data or need to integrate with other systems 4. you don't need to do lots of custom UI/presentation layer work I'm no Plone expert, but I don't think #4 is a problem for Plone. I think there are actually quite a few Plone sites with custom UIs (my company's new Intranet being one of them). And just to add another voice to this SQLAlchemy hurrah, like Colin, I'm also doing (complex) GIS stuff with PostGIS ( Shapely GeoJSON PyProj). Having a bit of experience with both Django and Rails, I don't know how I'd accomplish with their ORMs what I can with SA. I'm not saying it's not possible, but it seems nowhere near as straightforward or flexible. s/Colin/Chris --~--~-~--~~~---~--~~ 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: Django or Pylons - comparison details
On Jan 19, 12:26 pm, Noah Gift noah.g...@gmail.com wrote: On Tue, Jan 20, 2009 at 5:28 AM, Jonathan Vanasco jonat...@findmeon.com wrote: Django is like Rails -- it forces you into building certain types of apps with certain styles. If you build a Django app , you're pretty much married to it -- and can expect it to work much like other apps. That's not necessarily a bad thing. Pylons SqlAlchemy offer a lot more control. One of my websites is 90% ModPerl with 10% pylons offloaded ; we use the same tables db seamlessly. I don't know if its possible in django - but it was too hard to get done. Another one of my projects is 60% Pylons, 20% PHP and 20% MovableType (Perl). Again, Pylons power and flexibility let me seamlessly get all of them working together. ( btw , we're *finally* about to release a web framework toolkit based on Pylons that lets people do all this . huge product launches in the next 6 weeks after 1yr of development and testing ). Jonathan, This seems like a very interesting set of projects. I wonder if there is somewhere people could here, customer stories like this in one spot. I had no idea people where doing this with Django. With Django or with Pylons? --~--~-~--~~~---~--~~ 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: Django or Pylons - comparison details
On Mon, Jan 19, 2009 at 10:29 PM, Wyatt Baldwin wyatt.lee.bald...@gmail.com wrote: On Jan 19, 9:20 am, Colin Flanagan quadvill...@yahoo.com wrote: The SQLAlchemy argument is a very compelling one. I have an application that, while being a CMS, has heavily relational data. I was urged by different people to do it either in Django or Plone, but went with Pylons. My domain objects are far easier to work with, though I did suffer from the authentication layer and a few other things I had to build from scratch. Django can use SQLAlchemy, but by doing so you pretty much nullify a lot of the things that are unique to that framework like their automatic admin interfaces. Django's object generation came nowhere near understanding my moderately-complicated data model and would have been much more difficult to develop with, as compared to Pylons with SQLAlchemy. On another note: I find it interesting that a lot of people recommend Django for CMS-type applications. I would think that Plone might be more far more suitable given that: 1. your data fits well with the hierarchical structure of the ZODB 2. your content is comparable to the content types already established in Plone 3. you don't have any legacy data or need to integrate with other systems 4. you don't need to do lots of custom UI/presentation layer work I'm no Plone expert, but I don't think #4 is a problem for Plone. I think there are actually quite a few Plone sites with custom UIs (my company's new Intranet being one of them). And just to add another voice to this SQLAlchemy hurrah, like Colin, I'm also doing (complex) GIS stuff with PostGIS ( Shapely GeoJSON PyProj). Having a bit of experience with both Django and Rails, I don't know how I'd accomplish with their ORMs what I can with SA. I'm not saying it's not possible, but it seems nowhere near as straightforward or flexible. I'm also using Pylons/SA with a big, ugly, legacy Oracle schema. Fun, fun, fun. PS If anyone needs an SA type def for PostGIS geometry columns, give me a shout. I have one version based on PCL and another on Shapely. Hi, We also have this in MapFish. https://trac.mapfish.org/trac/mapfish/browser/trunk/MapFish/server/python/mapfish/sqlalchemygeom.py -- Eric --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Django or Pylons - comparison details
On Tue, Jan 20, 2009 at 10:40 AM, Wyatt Baldwin wyatt.lee.bald...@gmail.com wrote: On Jan 19, 12:26 pm, Noah Gift noah.g...@gmail.com wrote: On Tue, Jan 20, 2009 at 5:28 AM, Jonathan Vanasco jonat...@findmeon.com wrote: Django is like Rails -- it forces you into building certain types of apps with certain styles. If you build a Django app , you're pretty much married to it -- and can expect it to work much like other apps. That's not necessarily a bad thing. Pylons SqlAlchemy offer a lot more control. One of my websites is 90% ModPerl with 10% pylons offloaded ; we use the same tables db seamlessly. I don't know if its possible in django - but it was too hard to get done. Another one of my projects is 60% Pylons, 20% PHP and 20% MovableType (Perl). Again, Pylons power and flexibility let me seamlessly get all of them working together. ( btw , we're *finally* about to release a web framework toolkit based on Pylons that lets people do all this . huge product launches in the next 6 weeks after 1yr of development and testing ). Jonathan, This seems like a very interesting set of projects. I wonder if there is somewhere people could here, customer stories like this in one spot. I had no idea people where doing this with Django. With Django or with Pylons? Ah, I meant Pylons :) Maybe this could be done officially or unofficially. --~--~-~--~~~---~--~~ 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: Django or Pylons - comparison details
On Mon, Jan 19, 2009 at 3:15 PM, Lawrence Oluyede l.oluy...@gmail.com wrote: On Mon, Jan 19, 2009 at 6:20 PM, Colin Flanagan quadvill...@yahoo.com wrote: I'm curious if Django's CMS reputation comes from the fact that it's used by a lot of newspapers and content providers, or if there really is something that makes it advantageous over other frameworks. Django's admin is very handy for content based sites. We're developing the Italian PyCon website with Django. While we develop the webiste some people can upload and review documents, rollback and stuff like that. Very nice. Nothing you can't code in Pylons or CGI with C, but it's nice to have it for free. you should try out Catwalk2, tgext.admin and/or Rum. They are currently the competitors in TurboGears2 regarding this playing field. Catwalk2 and tgext.admin are build on top of Turbogears so you will need that dependency (totally worth it) or if you don't want that then Rum is a wsgi app http://pypi.python.org/pypi/Catwalk http://pypi.python.org/pypi/tgext.admin/ http://docs.python-rum.org/user/install.html Note: the author is catwalk and tgext.admin is the same guy, he is currently considering of folding one of the projects into the other as at this moment their only difference is that Catwalk2 is equivalent to django's autodiscovery while tgext.admin is the customizable by code type of thing Note2: I haven't used any of the 3 outside a turbogears project, but they will work in parallel --~--~-~--~~~---~--~~ 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: Django or Pylons - comparison details
On Mon, Jan 19, 2009 at 1:29 PM, Wyatt Baldwin wyatt.lee.bald...@gmail.com wrote: On Jan 19, 9:20 am, Colin Flanagan quadvill...@yahoo.com wrote: The SQLAlchemy argument is a very compelling one. I have an application that, while being a CMS, has heavily relational data. I was urged by different people to do it either in Django or Plone, but went with Pylons. My domain objects are far easier to work with, though I did suffer from the authentication layer and a few other things I had to build from scratch. Django can use SQLAlchemy, but by doing so you pretty much nullify a lot of the things that are unique to that framework like their automatic admin interfaces. Django's object generation came nowhere near understanding my moderately-complicated data model and would have been much more difficult to develop with, as compared to Pylons with SQLAlchemy. On another note: I find it interesting that a lot of people recommend Django for CMS-type applications. I would think that Plone might be more far more suitable given that: 1. your data fits well with the hierarchical structure of the ZODB 2. your content is comparable to the content types already established in Plone 3. you don't have any legacy data or need to integrate with other systems 4. you don't need to do lots of custom UI/presentation layer work I'm no Plone expert, but I don't think #4 is a problem for Plone. I think there are actually quite a few Plone sites with custom UIs (my company's new Intranet being one of them). Plone is certainly very complete. Its main problem is its Zope 2 legacy, which many people see as baggage. But if you ignore that, it's got many many things a content-based site needs. Pylons is clearly better for a calculation-based site with a lot of little pieces of data, although of course you can build any site in either. Django is in between, with some CMS-handy features built in, yet also capable of running a calculation-based site, but is perhaps not as attuned to it as Pylons is. PS If anyone needs an SA type def for PostGIS geometry columns, give me a shout. I have one version based on PCL and another on Shapely. I don't know this, but there are open-source GIS groups who probably do. http://groups.google.com/group/cugos -- 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: Django or Pylons - comparison details
On Mon, Jan 19, 2009 at 4:03 PM, Mike Orr sluggos...@gmail.com wrote: On Mon, Jan 19, 2009 at 1:29 PM, Wyatt Baldwin wyatt.lee.bald...@gmail.com wrote: On Jan 19, 9:20 am, Colin Flanagan quadvill...@yahoo.com wrote: The SQLAlchemy argument is a very compelling one. I have an application that, while being a CMS, has heavily relational data. I was urged by different people to do it either in Django or Plone, but went with Pylons. My domain objects are far easier to work with, though I did suffer from the authentication layer and a few other things I had to build from scratch. Django can use SQLAlchemy, but by doing so you pretty much nullify a lot of the things that are unique to that framework like their automatic admin interfaces. Django's object generation came nowhere near understanding my moderately-complicated data model and would have been much more difficult to develop with, as compared to Pylons with SQLAlchemy. On another note: I find it interesting that a lot of people recommend Django for CMS-type applications. I would think that Plone might be more far more suitable given that: 1. your data fits well with the hierarchical structure of the ZODB 2. your content is comparable to the content types already established in Plone 3. you don't have any legacy data or need to integrate with other systems 4. you don't need to do lots of custom UI/presentation layer work I'm no Plone expert, but I don't think #4 is a problem for Plone. I think there are actually quite a few Plone sites with custom UIs (my company's new Intranet being one of them). Plone is certainly very complete. Its main problem is its Zope 2 legacy, which many people see as baggage. But if you ignore that, it's got many many things a content-based site needs. Pylons is clearly better for a calculation-based site with a lot of little pieces of data, although of course you can build any site in either. Django is in between, with some CMS-handy features built in, yet also capable of running a calculation-based site, but is perhaps not as attuned to it as Pylons is. PS If anyone needs an SA type def for PostGIS geometry columns, give me a shout. I have one version based on PCL and another on Shapely. I don't know this, but there are open-source GIS groups who probably do. http://groups.google.com/group/cugos sorry for more TG propaganda, but one of our gsoc projects from last year was exactly this. I know the author and even though I haven't used the code for anything real, it looks very nice. His gsoc was really nice as it was mainly to try to get as much gis stuff working with tg as possible overview docs http://turbogears.org/2.0/docs/main/Extensions/Geo/ here is a demo app http://geo.turbogears.org/ and the project page http://code.google.com/p/tgtools/ Now keep in mind this was one of the goals for TG2, let pylons concentrate on the details of the framework while TG explored the extensions. --~--~-~--~~~---~--~~ 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: Django or Pylons - comparison details
On Tue, Jan 20, 2009 at 11:17 AM, Jorge Vargas jorge.var...@gmail.com wrote: On Mon, Jan 19, 2009 at 4:03 PM, Mike Orr sluggos...@gmail.com wrote: On Mon, Jan 19, 2009 at 1:29 PM, Wyatt Baldwin wyatt.lee.bald...@gmail.com wrote: On Jan 19, 9:20 am, Colin Flanagan quadvill...@yahoo.com wrote: The SQLAlchemy argument is a very compelling one. I have an application that, while being a CMS, has heavily relational data. I was urged by different people to do it either in Django or Plone, but went with Pylons. My domain objects are far easier to work with, though I did suffer from the authentication layer and a few other things I had to build from scratch. Django can use SQLAlchemy, but by doing so you pretty much nullify a lot of the things that are unique to that framework like their automatic admin interfaces. Django's object generation came nowhere near understanding my moderately-complicated data model and would have been much more difficult to develop with, as compared to Pylons with SQLAlchemy. On another note: I find it interesting that a lot of people recommend Django for CMS-type applications. I would think that Plone might be more far more suitable given that: 1. your data fits well with the hierarchical structure of the ZODB 2. your content is comparable to the content types already established in Plone 3. you don't have any legacy data or need to integrate with other systems 4. you don't need to do lots of custom UI/presentation layer work I'm no Plone expert, but I don't think #4 is a problem for Plone. I think there are actually quite a few Plone sites with custom UIs (my company's new Intranet being one of them). Plone is certainly very complete. Its main problem is its Zope 2 legacy, which many people see as baggage. But if you ignore that, it's got many many things a content-based site needs. Pylons is clearly better for a calculation-based site with a lot of little pieces of data, although of course you can build any site in either. Django is in between, with some CMS-handy features built in, yet also capable of running a calculation-based site, but is perhaps not as attuned to it as Pylons is. PS If anyone needs an SA type def for PostGIS geometry columns, give me a shout. I have one version based on PCL and another on Shapely. I don't know this, but there are open-source GIS groups who probably do. http://groups.google.com/group/cugos sorry for more TG propaganda, but one of our gsoc projects from last year was exactly this. I know the author and even though I haven't used the code for anything real, it looks very nice. His gsoc was really nice as it was mainly to try to get as much gis stuff working with tg as possible overview docs http://turbogears.org/2.0/docs/main/Extensions/Geo/ here is a demo app http://geo.turbogears.org/ and the project page http://code.google.com/p/tgtools/ Now keep in mind this was one of the goals for TG2, let pylons concentrate on the details of the framework while TG explored the extensions. Although, this might eventually move to an even more common United core that many web frameworks extend off of: http://www.openplans.org/projects/pypefitters/ We can only hope... --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Exploring ramework futures
On Mon, Jan 19, 2009 at 2:24 PM, Noah Gift noah.g...@gmail.com wrote: Although, this might eventually move to an even more common United core that many web frameworks extend off of: http://www.openplans.org/projects/pypefitters/ Well, that requires some explanation, Pypefitters is a group of WSGI framework developers (including Pylons developers) who are pondering the next generation of integrated tools. Recently ( 5 days ago), Pylons, TG, and Repoze.BFG developers have been kicking around an idea for a new framework that would take the best ideas of all three and have plug-in personalities (Routes vs attribute dispatching, 'return render' vs @expose, different styles of configuration, etc). The idea is that this might be Pylons' and TG's successor (after Pylons 1 and TG 2 are released), and that other frameworks (e.g., Werkzeug or Django) could build on top of it if they liked. The two basic ideas are that (1) WSGI/Paste was a wonderful idea in 2005 but now frameworks need more, and (2) WSGI will have to change somehow to be Python 3 compatible (i.e., it makes str/unicode assumptions that aren't valid under Python 3). So three strains are coming together: - post-Paste tools like WebOb, WebError, render_mako, the RoutesMiddleware abstraction, and (maybe!) repoze.who are showing promise as future standards. - it may be time to move to a post-WSGI standard a la the WSGI 2 proposals, since we'll have to change WSGI anyway. However, politically getting a WSGI update into the Python core is a long slow process, so maybe we should just do something under a new name. - Pylons 3 makes a good transition point, in that we can base the new tools on 2.6/3.0. So there's no code yet and the design is still up in the air, but it's an idea we're thinking about. The other aspect of Pypefitters is promoting the WSGI programming style, meaning small interoperable tools. So encouraging users to choose Pylons/TG style frameworks, and encouraging developers to build interoperability into their products. -- 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 -~--~~~~--~~--~--~---
What's my application version?
What's the blessed way for my application to get its version string (eg, the 0.1.0dev_r159 portion of the egg name application-0.1.0dev_r159-py2.4.egg) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: What's my application version?
On Mon, Jan 19, 2009 at 6:36 PM, will welch welch.quietple...@gmail.com wrote: What's the blessed way for my application to get its version string (eg, the 0.1.0dev_r159 portion of the egg name application-0.1.0dev_r159-py2.4.egg) I'm not 100% of the question but you are looking for setup.py and setup.cfg egg_info section --~--~-~--~~~---~--~~ 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: hasattr and context object
i believe AttribSafeContextObj are a convenience method for templates its really a PITA to look at and maintain % if hasattr( c , 'name '): so we have a cleaner % if c.name : if you'd rather the templates work as python does (and less like templating languages ) you can use the ContextObjm set strict_c to true, etc -- but i don't know why you'd want to. --~--~-~--~~~---~--~~ 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: Exploring ramework futures
Mike Orr wrote: On Mon, Jan 19, 2009 at 2:24 PM, Noah Gift noah.g...@gmail.com wrote: Although, this might eventually move to an even more common United core that many web frameworks extend off of: http://www.openplans.org/projects/pypefitters/ Well, that requires some explanation, Pypefitters is a group of WSGI framework developers (including Pylons developers) who are pondering the next generation of integrated tools. Recently ( 5 days ago), Pylons, TG, and Repoze.BFG developers have been kicking around an idea for a new framework that would take the best ideas of all three and have plug-in personalities (Routes vs attribute dispatching, 'return render' vs @expose, different styles of configuration, etc). The idea is that this might be Pylons' and TG's successor (after Pylons 1 and TG 2 are released), and that other frameworks (e.g., Werkzeug or Django) could build on top of it if they liked. The two basic ideas are that (1) WSGI/Paste was a wonderful idea in 2005 but now frameworks need more, and (2) WSGI will have to change somehow to be Python 3 compatible (i.e., it makes str/unicode assumptions that aren't valid under Python 3). So three strains are coming together: - post-Paste tools like WebOb, WebError, render_mako, the RoutesMiddleware abstraction, and (maybe!) repoze.who are showing promise as future standards. - it may be time to move to a post-WSGI standard a la the WSGI 2 proposals, since we'll have to change WSGI anyway. However, politically getting a WSGI update into the Python core is a long slow process, so maybe we should just do something under a new name. - Pylons 3 makes a good transition point, in that we can base the new tools on 2.6/3.0. So there's no code yet and the design is still up in the air, but it's an idea we're thinking about. The other aspect of Pypefitters is promoting the WSGI programming style, meaning small interoperable tools. So encouraging users to choose Pylons/TG style frameworks, and encouraging developers to build interoperability into their products. Interesting. I've tried all the python frameworks. I think there are really 2 markets - a simple to use framework and a highly optimized framework. Can they be the same ? Maybe. Frankly the way the economy is going (and will for a while), most projects (all but really big or demand sensitive) will need to be highly productive, favoring a fast and simple to market approach like Rails. For most power users, Django is awkward what with regex expressions, db, etc, Pylons is too damn confusing with all the different pieces not quite working together smoothly. Of all the python frameworks we like Werkzeug the best - nice clean views, works easily with sqlalchemy, fast, But frameworks with Werkzeug are missing a few key components: auth, sessions, testing And SQLAlchemy lacking a good migration system is a real negative to productivity. While I still prefer the python language, when it comes to getting stuff done, I think Rails still reigns supreme. Python needs something like Merb w/ sqlalchemy working like datamapper and with a good cloud option. Think productivity - fast, fast, fast to market. my 2 cents. --~--~-~--~~~---~--~~ 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: Django or Pylons - comparison details
On Mon, Jan 19, 2009 at 4:54 PM, Colin Flanagan quadvill...@yahoo.com wrote: - Original Message From: Jorge Vargas jorge.var...@gmail.com To: pylons-discuss@googlegroups.com Sent: Monday, January 19, 2009 4:45:35 PM Subject: Re: Django or Pylons - comparison details On Mon, Jan 19, 2009 at 3:15 PM, Lawrence Oluyede l.oluy...@gmail.com wrote: On Mon, Jan 19, 2009 at 6:20 PM, Colin Flanagan quadvill...@yahoo.com wrote: I'm curious if Django's CMS reputation comes from the fact that it's used by a lot of newspapers and content providers, or if there really is something that makes it advantageous over other frameworks. Django's admin is very handy for content based sites. We're developing the Italian PyCon website with Django. While we develop the webiste some people can upload and review documents, rollback and stuff like that. Very nice. Nothing you can't code in Pylons or CGI with C, but it's nice to have it for free. you should try out Catwalk2, tgext.admin and/or Rum. They are currently the competitors in TurboGears2 regarding this playing field. Catwalk2 and tgext.admin are build on top of Turbogears so you will need that dependency (totally worth it) or if you don't want that then Rum is a wsgi app http://pypi.python.org/pypi/Catwalk http://pypi.python.org/pypi/tgext.admin/ http://docs.python-rum.org/user/install.html Note: the author is catwalk and tgext.admin is the same guy, he is currently considering of folding one of the projects into the other as at this moment their only difference is that Catwalk2 is equivalent to django's autodiscovery while tgext.admin is the customizable by code type of thing Note2: I haven't used any of the 3 outside a turbogears project, but they will work in parallel These are really interesting. I'm especially curious to hear anyone's experience using Rum with Pylons. I'm getting ready to build something really similar but am now thinking otherwise. as I said rum is a wsgi app, so it runs standalone, rumAlchemy your dburi is enough. to try it out. As for the integration (running in the same process, theme sharing, etc.) that's another story, you could base yourself on the tg2 sample app. My impression of Django's admin was that, once you've replaced the native ORM, you no longer get it for free. That still holds true, no? yes, django admin is tied into django ORM. On the contrary rum has interfaces to use other ORMs, but so far it only has a SQLAlchemy backend. The same hold s true for catwalk2. Just to be clear, all 3 of these tools provide some how the same feature set of django admin. they are NOT django they are 100% TG/pylons code. Both use as base ToscaWidgets which ones was TruboGears widgets, catwalk2 and tgext.admin build on top of a second framework call sprox (which is somehow like formalchemy), The difference between the three is really set in internal components and some design issue, but to the end use they all should be quite alike. --~--~-~--~~~---~--~~ 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: Exploring ramework futures
On Mon, Jan 19, 2009 at 6:22 PM, MilesTogoe miles.to...@gmail.com wrote: Interesting. I've tried all the python frameworks. I think there are really 2 markets - a simple to use framework and a highly optimized framework. Can they be the same ? Maybe. That is one of the ideas, actually. If you imagine each personality as a paster template, one would be a souped-up Easy version like TurboGears for those who want features and don't want to know the internals (which is most people). The other would be a minimalist mode like Werkzeug/web.py where you have to choose the add-ons yourself. The Easy one would get a friendly book and marketing campaign, while the minimal one would appeal to tinkerers (and hopefully be state of the art). Like... Ubuntu and Xubuntu really. You can switch from one to the other by changing the configuration and installing some packages. I personally think three or four personalities are needed because a Pylons user, for instance, would want something in between these two extremes. But every personality needs a developer to support it, so in the end it comes down to who volunteers to support what. The benefit of TG partnering with Pylons has been a doubling of the developer base. Now we have a chance to do it with the Repoze folks, which will be a larger gap to bridge but with the same kind of benefit. (The differences are configuration/plugin/dispatching traditions. But both TG and BFG dispatch via cascading attributes so that could merge, and then the framework would just have to support both that and Routes via some lower-level dispatch API.) So much of the work is already done or is being done, and bridging the Pylons / Repoze gap would have to be done anyway if maximum interoperability is a goal. That just leaves the Pylons / Django gap, which we can't do much about that until/if their developers decide to participate. Currently they seem to prefer going their own way, but perhaps that might change once the trio framework becomes a reality. -- 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: Exploring ramework futures
awesome news we're tidying up the Open Social Network framework for its first public release right now. its built on top of pylons and would do well from many of these concepts. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: What's my application version?
On Mon, Jan 19, 2009 at 6:13 PM, Jorge Vargas jorge.var...@gmail.com wrote: On Mon, Jan 19, 2009 at 6:36 PM, will welch welch.quietple...@gmail.com wrote: What's the blessed way for my application to get its version string (eg, the 0.1.0dev_r159 portion of the egg name application-0.1.0dev_r159-py2.4.egg) I'm not 100% of the question but you are looking for setup.py and setup.cfg egg_info section To get the version in a program, you'd use a pkg_resources function. Which one... hmm... http://peak.telecommunity.com/DevCenter/PkgResources How about... version = pkg_resources.get_distribution(Pylons).version If you want to compare one version to another, use .parsed_version | parse_version() instead, which provide a normalized tuple. -- 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: hasattr and context object
On Mon, Jan 19, 2009 at 6:20 PM, Jonathan Vanasco jonat...@findmeon.com wrote: i believe AttribSafeContextObj are a convenience method for templates its really a PITA to look at and maintain % if hasattr( c , 'name '): so we have a cleaner % if c.name : if you'd rather the templates work as python does (and less like templating languages ) you can use the ContextObjm set strict_c to true, etc -- but i don't know why you'd want to. It all depends how you design your templates. I could ask the opposite question: why do you want an attribute that sometimes exists? Why can't the controller set 'c.name = None' to indicate there's no name? Then '% if c.name:' would work as normal. -- 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: Exploring ramework futures
On Jan 20, 10:31 am, Mike Orr sluggos...@gmail.com wrote: - it may be time to move to a post-WSGI standard a la the WSGI 2 proposals, since we'll have to change WSGI anyway. However, politically getting a WSGI update into the Python core is a long slow process, so maybe we should just do something under a new name. - Pylons 3 makes a good transition point, in that we can base the new tools on 2.6/3.0. I would agree that need to start looking towards WSGI 2.0 and Python 3.0 would be a good trigger for that. Not only would WSGI 2.0 be a good focus point for clarifying areas of current WSGI specification, would be a good point to look at more fundamental changes such as any required to support chunked request content and the concept of mutating input filters. It seems that chunked request content is becoming popular with mobile phone devices when posting data more than a certain size. At the moment WSGI cant handle chunked request content, so you can't use existing Python WSGI applications if you have a heavy focus on those sorts of clients. There are obviously various other things about current WSGI that people find annoying as well. Another area which needs to be fleshed out better is the initialisation of the environment that surrounds the application. In Paste server it does some initialisation of logging modules, mainly targeted at Pylons, which it can be argued it shouldn't. If hosting Pylons on another web hosting mechanism, you have to duplicate that internal initialisation that is being done by Paste server. So, some sort of abstraction for an application which ensures that such environment initialisation issues are also dealt with could be beneficial. Graham --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: What's my application version?
Bingo! Thanks! On Jan 19, 7:45 pm, Mike Orr sluggos...@gmail.com wrote: On Mon, Jan 19, 2009 at 6:13 PM, Jorge Vargas jorge.var...@gmail.com wrote: On Mon, Jan 19, 2009 at 6:36 PM, will welch welch.quietple...@gmail.com wrote: What's the blessed way for my application to get its version string (eg, the 0.1.0dev_r159 portion of the egg name application-0.1.0dev_r159-py2.4.egg) I'm not 100% of the question but you are looking for setup.py and setup.cfg egg_info section To get the version in a program, you'd use a pkg_resources function. Which one... hmm...http://peak.telecommunity.com/DevCenter/PkgResources How about... version = pkg_resources.get_distribution(Pylons).version If you want to compare one version to another, use .parsed_version | parse_version() instead, which provide a normalized tuple. -- 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: running a controller method outside wsgi app
Wichert Akkerman escribió: Previously Dalius Dobravolskas wrote: Hello, On Mon, Jan 19, 2009 at 7:44 AM, Roberto Allende ro...@menttes.com wrote: My motivation is to write a unit testing but even in other cases it could have sense to use a controller function isolated. Or at least in my case, this is the only restriction. If your intention is unit-testing do it Pylons way: http://wiki.pylonshq.com/display/pylonsdocs/Unit+Testing That is not unit testing, that is functional testing. If you want to unit test your controller and run it in isolation you need to do a bit of setup work in your test case. I use this: Thanks a lot Wiggy, your mails were very helpful. Although, it seems we're using different versions of Pylons (or i'm doing smt wrong) because following your approach i also needed wsgiapp variables Buffet, g and session at least. Just for the record, i'm using 0.9.6.2. By the other hand, in pylons.wsgiapp there's a method called load_test_env wich seems to use a test environment. If we're able to use that instead, we wouldn't be using a mock object but at least, we would use a test environment. I'll keep trying. Thanks again! Kind Regards r. -- http://menttes.com http://robertoallende.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: Django or Pylons - comparison details
On 20/01/2009, at 3:30 AM, Thomas G. Willis wrote: Being a pylons newb myself, the first thing I did was write auth and registration. It took a day.Granted I wasn't trying to support every auth method I could think of like authkit does,but I learned lots.If you want auth (and other things) rolled in use use turbogears. But getting basic authentication and registration working is not that big of a deal. Similar story, but I used repoze.who for authentication and am very happy with it. It is very customisable, which is what I needed; the app supports both form/cookie auth and HTTP basic auth simultaneously. repoze.who made this easy to configure in exactly the way I wanted. Cheers, Chris Miles --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
RegistryMiddleware is a major overhead
Benchmarks indicate it is taking as much as 20% of request handling time (not including the user action). The question is why is it even necessary to use this registry facility ? Similarly, other request handling operations such as creating the request object may also be redundant, because the user may not be interested in all the attributes of the request object. So wouldn't it be better to provide those things on-demand (that is using a call interface to get things such as params, etc) instead of creating all that stuff by default even when it may not be needed ? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---