Re: sqlalchemy objects in beaker cache
Previously Tomasz Narloch wrote: Andrey Plotnikov pisze: Hi, Is it safe to cache objects getting from sqlalchemy session query in beaker cache? I was done that but in that way I loose connection with sqlalchemy (Session) so You can re-associate an object with a new session. See http://www.sqlalchemy.org/docs/05/session.html#merging Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Running a program without waiting for it to finish
hello everybody, I am somewhat confused about the number of ways you can run an external program from python/pylons. I need my app to be able to compile and run a performance test. then gather the results and display the results in a relevant way. the tests are written in autoHotKey which is a windows scripting program. so to run a test all i need to do is call the file from the command line. I have a controller that kicks off the test using the subprocess module. class PerformancetestrunnerController(BaseController): def index(self): self.compileTest('/perfTests/fx-quick-trade-verify.mako') self.runTest('fx-quick-trade-verify.ahk') return 'run' def compileTest(self, testPath): c.loopCount = 10 c.GBPUSD_buyButton = '100, 100'; render(testPath) f = open('fx-quick-trade-verify.ahk', 'w') f.write( render(testPath) ) f.close() def runTest(self, testPath): path = os.path.join('C:','Program Files','AutoHotkey','AutoHotkey.exe') process = subprocess.Popen([path, testPath]) This does start the test running, but the page does not finish loading until the tests have finished. the tests themselves can call back to the pylons app to record cpu and memory metrics. I guess there must be a NO_WAIT flag or something i can put in to achieve my goal. This page (http://docs.python.org/library/subprocess.html) suggests pid = Popen([/bin/mycmd, myarg]).pid As a no_wait example, but that didn't work for me either. if any one has any ideas how i can achieve this, i await with baited breath. thanks toby --~--~-~--~~~---~--~~ 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: Testing a controller with upload_files ?
On Wed, Dec 17, 2008 at 3:54 AM, Kurt kurt.haeus...@gmail.com wrote: Hi, I have a controller, that takes a normal param, as well as a couple of files as input. It works fine when called from a client, but I am having trouble getting a unit test to work. response = self.app.post(url_for(controller='ff', action='upload'), params={'packxml': packxml}), \ upload_files = [(tempimageid + '.image', tempimagefilename, 'IMAGECONTENTS'), \ (tempimageid + '.icon', tempiconfilename, 'ICONCONTENTS')]) If i only pass in the params, but no upload_files then the packxml param is correctly passed to the controller in request.params. However when I try either the upload_files by itself, or both the params and upload_files, then request.params is empty. My controller would like to access the files as request.params ['id'].value Whats going on here? Are file params passed into the controller in some other structure than request.params? If files are passed in, are normal params also passed in differently? Can both types of params be passed in in the same request using self.app.post? Any tips would be appreciated. are you using webtest?I got equivalent code and it works fine. does it works with only one file? --~--~-~--~~~---~--~~ 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: If you HAD to use Java...
Thanks for the replies. I spent an inordinate amount of time evaluating Java frameworks, etc. As it turned out, I didn't end up having to use Java (though I could have), so I went with Python, and I'm very glad I did. Today I launched the first version of an internal app built on Pylons/ SQLAlchemy/Ext. At least one person seems impressed with how fast I've been able to develop this app (though it's nowhere near done). I plan to release as much of the code as possible, once I refactor things to a point where this would make sense. Deployment to the production server in a virtualenv was a breeze. Downloading and compiling Python seemed to take the most time. On Nov 4, 8:30 pm, tauzell tauz...@gmail.com wrote: You might want to take a look at the Stripes web framework:http://www.stripesframework.org/display/stripes/Home. Otherwise I'd go with Spring web over struts2. -Dave On Oct 31, 12:05 pm, Wyatt Baldwin wyatt.lee.bald...@gmail.com wrote: So, let's say you're a dedicated Python programmer and your Web framework/stack of choice is Pylons/Mako/SQLAlchemy (declarative, thank you very much). Let's also say that you're working on a project where you have, or are at least strongly compelled, to use Java. (And we'll also assume that you're sneaking Python in through back door whenever possible.) On top of all that (or maybe beneath it), you're a RESTafarian (but not a dogmatic practitioner) who prefers JSON over XML and has written your own RESTful base controller for Pylons (Restler) that follows the Rails/ATOM style. It's probably obvious where I'm heading with this--what libraries, tools, etc would you choose in JavaLand to get as close as possible to the feel of your preferred platform? Perhaps there's no way to even approach this in JavaLand, but let's be resourceful (ha ha) and give it a go. Here's a first pass: * Python = Java * Pylons = Spring or Struts 2 * SQLAlchemy = Hibernate * Paste Server = Tomcat * Mako = FreeMarker * Wing IDE = Eclipse What would you add to, remove from, and/or change in this list? I'm more interested in equivalences than opinions, although I'm sure what's equivalent is somewhat a matter of opinion. Any thoughts at all will be appreciated. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Testing a controller with upload_files ?
Hi, I have a controller, that takes a normal param, as well as a couple of files as input. It works fine when called from a client, but I am having trouble getting a unit test to work. response = self.app.post(url_for(controller='ff', action='upload'), params={'packxml': packxml}), \ upload_files = [(tempimageid + '.image', tempimagefilename, 'IMAGECONTENTS'), \ (tempimageid + '.icon', tempiconfilename, 'ICONCONTENTS')]) If i only pass in the params, but no upload_files then the packxml param is correctly passed to the controller in request.params. However when I try either the upload_files by itself, or both the params and upload_files, then request.params is empty. My controller would like to access the files as request.params ['id'].value Whats going on here? Are file params passed into the controller in some other structure than request.params? If files are passed in, are normal params also passed in differently? Can both types of params be passed in in the same request using self.app.post? Any tips would be appreciated. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Flickr tutorial under 0.9.7?
2008/12/16 Mike Orr sluggos...@gmail.com: By the way, Pylons homepage says: AJAX: Rails-style WebHelpers based on Prototype, or Mochikit, jQuery, Dojo, Ext more. I'm wondering what that means. I've been curious about that too, since the JavaScript helpers are implemented with Prototype. I think the intent, though, is just to indicate that it's easy to use any of those libraries with Pylons or to create your own helpers based on those libs. It indicates the website is out of date. :) OK it used to be true for Prototype, but what about the other ones? I'm a bit worried about newcomers getting exciting at reading this and then finding out that there isn't really such a thing in Pylons. Is it going to be possible to keep the current Rails-style WebHelpers while using newer versions of Pylons or will we definitely have to port our code? You'll have to make some adjustments at least. The easiest is to copy the old helper modules into your application and adjust the imports in helpers.py. You can do that any time in the next several months. Alternatively, you could hack Pylons' egg-info to not require the newer version, but that would be overwritten if you reinstall or upgrade Pylons. Thank you for the hint, copying the old module seems to be simpler indeed. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
pylons + cheetah
Hi all, I'm new to pylons. Please help to find information how to connect pylons with cheetah thank you for help, Vadim --~--~-~--~~~---~--~~ 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 + cheetah
On Dec 17, 2008, at 8:55 PM, Vadim wrote: Hi all, I'm new to pylons. Please help to find information how to connect pylons with cheetah thank you for help, Vadim The Templating part of the cookbook? http://wiki.pylonshq.com/display/pylonscookbook/Templating mario --~--~-~--~~~---~--~~ 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 mulitple versions of Pylons apps with shared hosting.
Thanks, I was using a single virtual python install for all my sites. I'll switch to a virtualenv for each one, that sounds like it'll work. Cheers, Dave On Dec 1, 3:22 pm, Jorge Vargas jorge.var...@gmail.com wrote: On Mon, Dec 1, 2008 at 7:52 AM, Dalius Dobravolskas dalius.dobravols...@gmail.com wrote: Any help would be appreciated. virtualenv should help you. I have not used myself virtualenv for hosting yet but I think that's one purposes it is created for. yes totally, I don't deploy anymore without venv. Hey they even have docs on ithttp://wiki.dreamhost.com/Python --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
SMTPHandler not working
Trying to use SMTPHandler for logging with Pylons trunk version. [handler_smtp] class = SMTPHandler args = ('localhost','err...@my.com', ...', '...') formatter = generic File D:\Python25\Scripts\paster-script.py, line 8, in module load_entry_point('pastescript==1.7.3', 'console_scripts', 'paster') () File d:\python25\lib\site-packages\pastescript-1.7.3-py2.5.egg\paste \script\c ommand.py, line 84, in run invoke(command, command_name, options, args[1:]) File d:\python25\lib\site-packages\pastescript-1.7.3-py2.5.egg\paste \script\c ommand.py, line 123, in invoke exit_code = runner.run(args) File d:\python25\lib\site-packages\pastescript-1.7.3-py2.5.egg\paste \script\c ommand.py, line 218, in run result = self.command() File d:\python25\lib\site-packages\pastescript-1.7.3-py2.5.egg\paste \script\s erve.py, line 271, in command self.logging_file_config(log_fn) File d:\python25\lib\site-packages\pastescript-1.7.3-py2.5.egg\paste \script\c ommand.py, line 757, in logging_file_config fileConfig(config_file) File d:\python25\lib\site-packages\pastescript-1.7.3-py2.5.egg\paste \script\u til\logging_config.py, line 85, in fileConfig handlers = _install_handlers(cp, formatters) File d:\python25\lib\site-packages\pastescript-1.7.3-py2.5.egg\paste \script\u til\logging_config.py, line 155, in _install_handlers klass = _resolve(klass) File d:\python25\lib\site-packages\pastescript-1.7.3-py2.5.egg\paste \script\u til\logging_config.py, line 95, in _resolve found = __import__(used) ImportError: No module named SMTPHandler Exception in thread Thread-1 (most likely raised during interpreter shutdown): Traceback (most recent call last): File D:\Python25\lib\threading.py, line 460, in __bootstrap File D:\Python25\lib\threading.py, line 440, in run File d:\python25\lib\site-packages\paste-1.7.2-py2.5.egg\paste \reloader.py, line 86, in periodic_reload type 'exceptions.AttributeError': 'NoneType' object has no attribute '_exit' --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Problem with pylons install on win XP 32
Hi All, I've been trying to get pylons up and running on a win 32bit XP box under python 2.6.1. Easy install worked up until the json errors, I then manually installed the rest of the dependancies. JSON I ran without speedups, and therefore bypassed the failure to install. When I try and setup a project paster dies on me with the following traceback: C:\paster create -t pylons ark Traceback (most recent call last): File c:\python26\scripts\paster-script.py, line 8, in module load_entry_point('pastescript==1.3.6', 'console_scripts', 'paster')() File c:\python26\lib\site-packages\pastescript-1.3.6-py2.6.egg\paste\script\comm and.py, line 77, in run command = commands[command_name].load() File build\bdist.win32\egg\pkg_resources.py, line 1913, in load File c:\python26\lib\site-packages\pastescript-1.3.6-py2.6.egg\paste\script\crea te_distro.py, line 8, in module import copydir File c:\python26\lib\site-packages\pastescript-1.3.6-py2.6.egg\paste\script\copy dir.py, line 384, in module class LaxTemplate(string.Template): File C:\Python26\lib\string.py, line 119, in __init__ cls.pattern = _re.compile(pattern, _re.IGNORECASE | _re.VERBOSE) File C:\Python26\lib\re.py, line 188, in compile return _compile(pattern, flags) File C:\Python26\lib\re.py, line 236, in _compile raise ValueError('Cannot process flags argument with a compiled pattern') ValueError: Cannot process flags argument with a compiled pattern Any pointers into why this is occurring would be much appreciated. Jules --~--~-~--~~~---~--~~ 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: Testing a controller with upload_files ?
I am using nosetests. If I only pass one file in it does not work. The only combination that works is params only without the upload_files. I also tried wrapping the file contents in a StringIO but only a string or unicode is accepted. I also tried writing a real file to disk first and only providing the tag and filename but that didn't help either. On Wed, Dec 17, 2008 at 12:52 PM, Jorge Vargas jorge.var...@gmail.com wrote: On Wed, Dec 17, 2008 at 3:54 AM, Kurt kurt.haeus...@gmail.com wrote: Hi, I have a controller, that takes a normal param, as well as a couple of files as input. It works fine when called from a client, but I am having trouble getting a unit test to work. response = self.app.post(url_for(controller='ff', action='upload'), params={'packxml': packxml}), \ upload_files = [(tempimageid + '.image', tempimagefilename, 'IMAGECONTENTS'), \ (tempimageid + '.icon', tempiconfilename, 'ICONCONTENTS')]) If i only pass in the params, but no upload_files then the packxml param is correctly passed to the controller in request.params. However when I try either the upload_files by itself, or both the params and upload_files, then request.params is empty. My controller would like to access the files as request.params ['id'].value Whats going on here? Are file params passed into the controller in some other structure than request.params? If files are passed in, are normal params also passed in differently? Can both types of params be passed in in the same request using self.app.post? Any tips would be appreciated. are you using webtest?I got equivalent code and it works fine. does it works with only one file? --~--~-~--~~~---~--~~ 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 + cheetah
Mario, thank you for quick response. I did look into this coockbook page... but this page looked to me outdated. For example: config.init_app() call is not in middleware.py, but in environment.py and when I tried to use: config.add_template_engine(cheetah, myapp.templates, {}) I got error message that add_template_engine is outdated. the correct way to use it now - config['buffet.template_engines'] ...so, I just hoped there is a straightforward tutorial on cheetah usage with pylons. thanks again, Vadim From: ma...@ruggier.org To: pylons-discuss@googlegroups.com Subject: Re: pylons + cheetah Date: Wed, 17 Dec 2008 21:18:09 +0100 On Dec 17, 2008, at 8:55 PM, Vadim wrote: Hi all, I'm new to pylons. Please help to find information how to connect pylons with cheetah thank you for help, Vadim The Templating part of the cookbook? http://wiki.pylonshq.com/display/pylonscookbook/Templating mario _ Send e-mail anywhere. No map, no compass. http://windowslive.com/Explore/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_anywhere_122008 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Flickr tutorial under 0.9.7?
On Wed, Dec 17, 2008 at 3:32 AM, Alex Marandon alex.maran...@gmail.com wrote: 2008/12/16 Mike Orr sluggos...@gmail.com: By the way, Pylons homepage says: AJAX: Rails-style WebHelpers based on Prototype, or Mochikit, jQuery, Dojo, Ext more. I'm wondering what that means. I've been curious about that too, since the JavaScript helpers are implemented with Prototype. I think the intent, though, is just to indicate that it's easy to use any of those libraries with Pylons or to create your own helpers based on those libs. It indicates the website is out of date. :) OK it used to be true for Prototype, but what about the other ones? I'm a bit worried about newcomers getting exciting at reading this and then finding out that there isn't really such a thing in Pylons. Plays Well With Others Pylons is built on Paste and allows and encourages use of your favorite Python components and libraries: * Models: SQLAlchemy, SQLObject, plain old DB-API * Templating: Mako, Genshi, Jinja, Kid, Cheetah, or whatever you like - using Buffet * AJAX: Rails-style WebHelpers based on Prototype, or Mochikit, jQuery, Dojo, Ext more * Request Dispatching: Routes by default, or plug in your favorite This should really be reworded because it mixes things that are Pylons dependencies, vs things that are supported alternatives in the official docs, vs things that are possible but not actively supported. Models: (0.9.7 0.9.6) basic support for a SQLAlchemy configuration; SQLObject and DB-API unsupported. Templating: (0.9.7) Mako is built-in. Genshi Jinja are supported alternatives (though not all of Genshi's options are supported). Others are unsupported but simple to configure. Buffet is deprecated. (0.9.6) Buffet is standard. Buffet has some issues with Kid and Cheetah and, well, everything, but we've managed to tame it for Mako and at least part of Genshi. AJAX: (0.9.7) New helpers. No Javascript. (0.9.6) Rails helpers, Prototype, Scriptaculous. Neither version has specific support for MochiKit, JQuery, Dojo, ExtJS, etc. webhelpers.paginate did have some support for various AJAX libraries at one point, but you'd have to look in the source to see if it's still there. Request dispatching: (0.9.7) Routes 1.10 series is standard. 1.10 introduced some new syntax and changed some default options, but is basically backward compatible. (0.9.6) Routes 1.7.5 is standard. -- 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: If you HAD to use Java...
On Oct 31, 2008, at 11:05 AM, Wyatt Baldwin wrote: So, let's say you're a dedicated Python programmer and your Web framework/stack of choice is Pylons/Mako/SQLAlchemy (declarative, thank you very much). Let's also say that you're working on a project where you have, or are at least strongly compelled, to use Java. (And we'll also assume that you're sneaking Python in through back door whenever possible.) On top of all that (or maybe beneath it), you're a RESTafarian (but not a dogmatic practitioner) who prefers JSON over XML and has written your own RESTful base controller for Pylons (Restler) that follows the Rails/ATOM style. It's probably obvious where I'm heading with this--what libraries, tools, etc would you choose in JavaLand to get as close as possible to the feel of your preferred platform? FYI I've been working on making the answer to this question Use Pylons.. with Jython. Initial Jython 2.5 support is coming in the 0.9.7 release. Here's our Pylons on Jython buildbot: http://pylonshq.com:8014/ The few remaining failures on there are unimportant, minus the lack of elementtree, which is already being worked on and will land on Jython trunk very soon. The next step is to provide a way to create .war files from a Pylons project, which I'm tackling now. Then, support for more of the common optional libraries like SQLAlchemy, Genshi/Jinja2, etc. -- Philip Jenvey --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Flickr tutorial under 0.9.7?
That .6 vs .7 status list is very helpful, esp for a Pylons newbie struggling with documentation which is part .6 and part .7, thanks. Are there any docs or examples for the new .7 helpers? I want to work towards the Pylons 1.0 Factory approved usage for helpers and templating, but am challenged figuring out what that will be. Specifically, I'm trying to work through the tutorials without the deprecated helpers, and still take advantage of helpers that will be in the forward releases. But, I look in webhelpers-0.6.3-py2.6.egg/webhelpers/html/form_layout.py and I see Helpers for laying out forms (EXPERIMENTAL) **This module is experimental and subject to change or deletion!** If you want to use it in an application, please copy it to the application. --~--~-~--~~~---~--~~ 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 + cheetah
On Wed, Dec 17, 2008 at 1:15 PM, Vadim Khaskel vkhas...@hotmail.com wrote: Mario, thank you for quick response. I did look into this coockbook page... but this page looked to me outdated. For example: config.init_app() call is not in middleware.py, but in environment.py and when I tried to use: config.add_template_engine(cheetah, myapp.templates, {}) I got error message that add_template_engine is outdated. the correct way to use it now - config['buffet.template_engines'] ...so, I just hoped there is a straightforward tutorial on cheetah usage with pylons. thanks again, Vadim You're suffering multiple levels of deprecation and a very out-of-date HOWTO. Also, Cheetah was designed for a very different kind of web framework, and thus doesn't fit very well with Pylons. I was one of Cheetah's developers and could explain explain to you why this is, but it would be a long discussion delving into template caching, search paths, manually-compiled base templates, Unicode issues, auto-escaping HTML, dotted template notation, etc. I'd highly recommend Mako instead, which is based on Cheetah's design but includes recent techniques for dealing with all these issues. These things can't be retrofitted into Cheetah without totally restructuring it. But if you want to use Cheetah anyway, for Pylons 0.9.7rc4 you'd write a render_cheetah() function similar to render_mako in pylons.templating. Essentially it would have to calculate the template path based on the template search path in pylons.config, put the Pylons globals into a dict (especially including 'c'), instantiate Cheetah.Template with the template path and search list, call template.render() and return the result. For Pylons 0.9.6, just ignore the warning and use whichever way works. You'll have to upgrade to 0.9.7+ at some point anyway, and you can implement a better solution then. You'll probably need an empty __init__.py file in myapp/templates and every subdirectory under it, and you may need to specify templates as package.template instead of /directory/filename.html, and you may need to compile the templates manually before running the application. A lot of this is due to the fact that the Cheetah-Buffet plugin was the second Buffet plugin to be written (after the original one for Kid), and it was thought at the time that a Kid-like API was best. In either version, if you're using template inheritance (#extends), you'll definitely have to compile the base templates manually (cheetah compile) and put them in an importable package. This means that if you put them under maypp/templates/, you definitely need the __init__.py files. Cheetah's template inheritance does not use a search path or compiling templates, it merely imports a precompiled template module which it assumes exists. Again, this made sense in the kind of web framework Cheetah was originally designed for. (WebWare for Python, which was based on the Java servlet pattern. Precompiled templates were structured so that they could function as servlets without needing wrappers.) -- 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: Flickr tutorial under 0.9.7?
On Dec 17, 2008, at 3:01 PM, Rod Morison wrote: That .6 vs .7 status list is very helpful, esp for a Pylons newbie struggling with documentation which is part .6 and part .7, thanks. Are there any docs or examples for the new .7 helpers? I want to work towards the Pylons 1.0 Factory approved usage for helpers and templating, but am challenged figuring out what that will be. Specifically, I'm trying to work through the tutorials without the deprecated helpers, and still take advantage of helpers that will be in the forward releases. But, I look in webhelpers-0.6.3-py2.6.egg/webhelpers/html/form_layout.py and I see I've updated the front page in the codebase which will soon be up at http://beta.pylonshq.com/ , to properly reflect what's in Pylons 0.9.7. Should be deployed there shortly. I'm also getting most of the links fixed up so the site can be ready for launch with 0.9.7 final rather soon. - Ben smime.p7s Description: S/MIME cryptographic signature
Re: Flickr tutorial under 0.9.7?
I didn't have the beta docs url, looks like there's enough to get me going with the intrinsic helpers. I like the Pylons platform a lot already, and have only done minor experiments. When everything is ironed out, it's really gonna rock. Great project! Rod --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Flickr tutorial under 0.9.7?
On Wed, Dec 17, 2008 at 3:01 PM, Rod Morison r...@morison.biz wrote: That .6 vs .7 status list is very helpful, esp for a Pylons newbie struggling with documentation which is part .6 and part .7, thanks. Are there any docs or examples for the new .7 helpers? The documentation is in the source code, and is now available under the modules section of beta.pylonshq.com. The section in the reference manual (Forms, Validation, and Helpers) is very minimal (and misses the HTML helpers entirely) because something needs to be configured in Sphinx, and I'm hoping Ben knows what it is. I want to work towards the Pylons 1.0 Factory approved usage for helpers and templating, but am challenged figuring out what that will be. Specifically, I'm trying to work through the tutorials without the deprecated helpers, and still take advantage of helpers that will be in the forward releases. But, I look in webhelpers-0.6.3-py2.6.egg/webhelpers/html/form_layout.py and I see Helpers for laying out forms (EXPERIMENTAL) **This module is experimental and subject to change or deletion!** If you want to use it in an application, please copy it to the application. The form_layout module has already been removed in WebHelpers 0.6.4. It was the only experimental helper that was released; everything else is either officially supported or deprecated. Pylons 1.0 will be close to 0.9.7. The main thing is to avoid anything marked deprecated. There are plans for a more modular @validate but it will be backward compatible. Routes 2 may actually appear someday, with a slightly incompatible syntax. However, the new optional syntax in Routes 1.10 was backported from Routes 2, as was pylons.url (which will gradually replace url_for). So these are forward compatibilities. Because Routes is only lightly coupled to the rest of Pylons, it should be feasable to use Routes 1 even if the default switches to Routes 2, though you may have to hack Pylons' egg-info to change the dependency or import Routes 1 via a different package name; we're not sure yet. Those are the upcoming changes I can think of, so you can see there's not many. -- 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: Testing a controller with upload_files ?
On Wed, Dec 17, 2008 at 6:22 AM, Kurt Häusler kurt.haeus...@gmail.com wrote: I am using nosetests. If I only pass one file in it does not work. The only combination that works is params only without the upload_files. nose it's a test runner finder not a testing engine in itself, the feature you want to use is either part of webtest or paste.fixture I also tried wrapping the file contents in a StringIO but only a string or unicode is accepted. I also tried writing a real file to disk first and only providing the tag and filename but that didn't help either. On Wed, Dec 17, 2008 at 12:52 PM, Jorge Vargas jorge.var...@gmail.com wrote: On Wed, Dec 17, 2008 at 3:54 AM, Kurt kurt.haeus...@gmail.com wrote: Hi, I have a controller, that takes a normal param, as well as a couple of files as input. It works fine when called from a client, but I am having trouble getting a unit test to work. response = self.app.post(url_for(controller='ff', action='upload'), params={'packxml': packxml}), \ upload_files = [(tempimageid + '.image', tempimagefilename, 'IMAGECONTENTS'), \ (tempimageid + '.icon', tempiconfilename, 'ICONCONTENTS')]) If i only pass in the params, but no upload_files then the packxml param is correctly passed to the controller in request.params. However when I try either the upload_files by itself, or both the params and upload_files, then request.params is empty. My controller would like to access the files as request.params ['id'].value Whats going on here? Are file params passed into the controller in some other structure than request.params? If files are passed in, are normal params also passed in differently? Can both types of params be passed in in the same request using self.app.post? Any tips would be appreciated. are you using webtest?I got equivalent code and it works fine. does it works with only one file? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---