Re: cleaner ToscaWidgets
On 10/22/07, Max Ischenko [EMAIL PROTECTED] wrote: Thanks a lot for your reply; it's very helpful. It looks like I should put aside a few hours and re-evaluate TW to have an up-to-date opinion. Hopefully Mike Orr could write some Pylons HOWTO by then. ;) I printed out the four existing Cookbook articles but haven't read through them yet. One problem is that some of them and the official ToscaWidgets doc are for Pylons 0.9.4, which is now long obsolete. Since I started with 0.9.5, I'll have to infer what 0.9.4 was like and then figure out what the equivalent is in 0.9.6. The Alternative ToscaWidgets with Mako article is fairly recent so it may be a good starting point. -- Mike Orr [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: UNS: Re: cleaner ToscaWidgets
On 10/22/07, Max Ischenko [EMAIL PROTECTED] wrote: On 10/23/07, Mike Orr [EMAIL PROTECTED] wrote: Glad to hear this. :) So maybe I should reduce the initial scope of the docs I have in mind and not dive directly into custom widgets but concentrate on how existing widgets are used? Yes. Think in terms of somebody who has used another Python form library or has handcoded all their forms, and just wants to use the standard widgets at first. They'll be curious about any special widgets TW provides such as a date picker, WSIWYG editor, combo box, enhanced file uploader, etc -- things they've had to struggle with or do without in their other libraries. They don't want to build custom widgets yet; they just want to build forms that work. I'd say that even tutorial for a simple form (2-5 fields, nothing fancy) would work if it highlights how TW is different from other approaches, like handcoding, and what it can give you. Good point. Level 1: what Max said. Level 2: TW's megawidgets. Level 3: making your own widgets. Level 4: making your own composite widgets (if that is different). -- Mike Orr [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: cleaner ToscaWidgets
Mike Orr wrote: On 10/22/07, Max Ischenko [EMAIL PROTECTED] wrote: Thanks a lot for your reply; it's very helpful. It looks like I should put aside a few hours and re-evaluate TW to have an up-to-date opinion. Hopefully Mike Orr could write some Pylons HOWTO by then. ;) I printed out the four existing Cookbook articles but haven't read through them yet. One problem is that some of them and the official ToscaWidgets doc are for Pylons 0.9.4, which is now long obsolete. Since I started with 0.9.5, I'll have to infer what 0.9.4 was like and then figure out what the equivalent is in 0.9.6. The Alternative ToscaWidgets with Mako article is fairly recent so it may be a good starting point. The Alternative... one has just been obsoleted (for the good) by 0.1a2dev_r3534 which makes configuring it in Pylons much easier. I'm waiting for my forgotten wiki password (which confluence is refusing to email me) to update it. For the meantime this is the part in Pylons' sample app where it achieves the same effect: http://tinyurl.com/2ts8zs Alberto --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: ANNOUNCE: Gazest 0.3.7 -- a Pylons powered wiki
sjh24wvu [EMAIL PROTECTED] writes: I was wondering if we could find a way to either have Gazest use the local sendmail binary or do smtp_auth. I have ssmtp on my system to avoid running another daemon. Thus I don't have anything listening on localhost. My mail relay requires smtp_auth, which ssmtp does if you use the sendmail binary. Is this possible? There are two parts of gazest that sends emails: you get a backtrace by mail if there is a critical error and you get a mail to confirm the creation of a new account. For the backtraces, I have no idea how you'd tell Paste to use ssmtp. For the account creation mails, yeah it would be quite easy to either call sendmail or to use ssmtp. You could add a new param in the .ini and test it's value in gazest.lib.helpers.render_mail(). I don't have a ssmtp box handy so this is not something that I would code myself but I will merge any clean patch. -- Yannick Gingras --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: UNS: Re: cleaner ToscaWidgets
Mike Orr wrote: On 10/22/07, Max Ischenko [EMAIL PROTECTED] wrote: On 10/23/07, Mike Orr [EMAIL PROTECTED] wrote: Glad to hear this. :) So maybe I should reduce the initial scope of the docs I have in mind and not dive directly into custom widgets but concentrate on how existing widgets are used? Yes. Think in terms of somebody who has used another Python form library or has handcoded all their forms, and just wants to use the standard widgets at first. They'll be curious about any special widgets TW provides such as a date picker, WSIWYG editor, combo box, enhanced file uploader, etc -- things they've had to struggle with or do without in their other libraries. They don't want to build custom widgets yet; they just want to build forms that work. I'd say that even tutorial for a simple form (2-5 fields, nothing fancy) would work if it highlights how TW is different from other approaches, like handcoding, and what it can give you. Good point. Level 1: what Max said. Level 2: TW's megawidgets. Level 3: making your own widgets. Level 4: making your own composite widgets (if that is different). Ok, sounds good... I'll post in this thread a draft level 12 [1] tutorial later today. Alberto [1] Since using megawidgets, which I suppose refers to the WYSIWYG editor et al, is no different from a user's POV than using a simple text field. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Scheduling and monitoring
I read a lot about people using Cron to schedule the clearing out of dead sessions in Pylons apps, is there any reason why one cannot use the sched(http://docs.python.org/lib/module-sched.html) module to do the same and start if from pylons itself? Pylons has some kind of monitoring system, are there hooks or events that one could use to execute a few Pylons related tasks? Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Scheduling and monitoring
voltron wrote: I read a lot about people using Cron to schedule the clearing out of dead sessions in Pylons apps, is there any reason why one cannot use the sched(http://docs.python.org/lib/module-sched.html) module to do the same and start if from pylons itself? Pylons has some kind of monitoring system, are there hooks or events that one could use to execute a few Pylons related tasks? I've ported Turbogears' scheduler for use in a project using Pylons, I've uploaded it here: http://toscat.net/~alberto/scheduler.py Sorry, no docs. You'll have to look at the source and at TG's docs but it's pretty easy to grok. HTH, Alberto --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Scheduling and monitoring
Thanks Alberto, I´ll take a loo at that On Oct 23, 11:59 am, Alberto Valverde [EMAIL PROTECTED] wrote: voltron wrote: I read a lot about people using Cron to schedule the clearing out of dead sessions in Pylons apps, is there any reason why one cannot use the sched(http://docs.python.org/lib/module-sched.html) module to do the same and start if from pylons itself? Pylons has some kind of monitoring system, are there hooks or events that one could use to execute a few Pylons related tasks? I've ported Turbogears' scheduler for use in a project using Pylons, I've uploaded it here:http://toscat.net/~alberto/scheduler.py Sorry, no docs. You'll have to look at the source and at TG's docs but it's pretty easy to grok. HTH, Alberto --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Config question
As much as I've been hacking around Pylons this is an embarrassing question. In trying to clean up my app, I moved some config statements into the development.ini file. lines like: ## # some configuration for the crm114 classifier ## [crm] classifier =osb unique microgroom classes = dk is bs cf se dir =~/working/edgar/data/crm extension =.css logfile =%(dir)s/learning.log How can I get at them in my app. Do I need to call ConfigParser myself?? I think if I don't use the [crm] section they are available in config['app_conf'] but that seems wrong. Dam, feel like a newbie again :`( -- Phil --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Config question
On Oct 23, 2007, at 8:18 AM, Philip Cooper wrote: ## # some configuration for the crm114 classifier ## [crm] classifier =osb unique microgroom classes = dk is bs cf se dir =~/working/edgar/data/crm extension =.css logfile =%(dir)s/learning.log How can I get at them in my app. Do I need to call ConfigParser myself?? I think if I don't use the [crm] section they are available in config['app_conf'] but that seems wrong. Dam, feel like a newbie again :`( No worries, they're in the pylons.config object. pylons.config ['logfile'], etc. Cheers, Ben smime.p7s Description: S/MIME cryptographic signature
Re: Config question
Philip Cooper wrote: As much as I've been hacking around Pylons this is an embarrassing question. In trying to clean up my app, I moved some config statements into the development.ini file. lines like: ## # some configuration for the crm114 classifier ## [crm] classifier =osb unique microgroom classes = dk is bs cf se dir =~/working/edgar/data/crm extension =.css logfile =%(dir)s/learning.log How can I get at them in my app. Do I need to call ConfigParser myself?? I think if I don't use the [crm] section they are available in config['app_conf'] but that seems wrong. Are you asking how you can get to them outside of a web request? This is tricky, because as you have noticed the presence of middleware effects them. I personally would just use fake requests. I haven't written this up, but it's really a feature paster should have, and probably something wrappable so it can be provided natively for an application. I imagine something like: paster request config.ini /some_operation Which runs a request to /some_operation against the app described in config.ini, and outputs the result. That could be wrapped up a little so that it looks like a real command, and not like an internal request. It might also dispatch to a controller that is optimized for script-like output. Right now you could do it like: from webob import Request app = loadapp(config_filename) req = Request.blank() # Something to check for, so you can be sure it's not an external # request: req.environ['myapp.internal_request'] = True res = req.get_response(app) print res.body if res.status_int != 200: sys.exit(res.status_int) -- Ian Bicking : [EMAIL PROTECTED] : http://blog.ianbicking.org --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Config question
On Oct 23, 2007, at 9:41 AM, Philip Cooper wrote: Actually not. pylons.config.keys() shows me all of the things in the config file under the section [app:main] It would work if I DON'T put my crm stuff in a different section but I put it there because I have all kinds of apps that use this config stuff. If I don't put it in it's own section, I will likely have all kinds of name collisions. Things like logfile, dir, extension, classes are all too common. I'd rather not have to hack up my code with crm_dir, crm_extension etc. Otherwise my config life gets harder not easier. Ohh, sorry, I didn't notice the custom section header. I'm not sure how to get to these at all. Nor am I sure what Paste does with sections that aren't directly applicable to the application section. - Ben smime.p7s Description: S/MIME cryptographic signature
Re: Config question
Ben Bangert wrote: On Oct 23, 2007, at 9:41 AM, Philip Cooper wrote: Actually not. pylons.config.keys() shows me all of the things in the config file under the section [app:main] It would work if I DON'T put my crm stuff in a different section but I put it there because I have all kinds of apps that use this config stuff. If I don't put it in it's own section, I will likely have all kinds of name collisions. Things like logfile, dir, extension, classes are all too common. I'd rather not have to hack up my code with crm_dir, crm_extension etc. Otherwise my config life gets harder not easier. Ohh, sorry, I didn't notice the custom section header. I'm not sure how to get to these at all. Nor am I sure what Paste does with sections that aren't directly applicable to the application section. You have to use config:config.ini#csm, to refer to the [app:csm] section. -- Ian Bicking : [EMAIL PROTECTED] : http://blog.ianbicking.org --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: UNS: Re: Config question
Thanks all. Sounds like it's unrealistic to expect that paster should pass along everything it doesn't use. If I just put 1 line in [app:main] # like crmcfg = %(here)s/development.ini then I can pull that in the regular way and do my own ConfigParse. Not bad and I should leave it at that. Paste scares me ;-) -- Phil --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: UNS: Re: cleaner ToscaWidgets
Alberto Valverde wrote: Mike Orr wrote: On 10/22/07, Max Ischenko [EMAIL PROTECTED] wrote: On 10/23/07, Mike Orr [EMAIL PROTECTED] wrote: Glad to hear this. :) So maybe I should reduce the initial scope of the docs I have in mind and not dive directly into custom widgets but concentrate on how existing widgets are used? Yes. Think in terms of somebody who has used another Python form library or has handcoded all their forms, and just wants to use the standard widgets at first. They'll be curious about any special widgets TW provides such as a date picker, WSIWYG editor, combo box, enhanced file uploader, etc -- things they've had to struggle with or do without in their other libraries. They don't want to build custom widgets yet; they just want to build forms that work. I'd say that even tutorial for a simple form (2-5 fields, nothing fancy) would work if it highlights how TW is different from other approaches, like handcoding, and what it can give you. Good point. Level 1: what Max said. Level 2: TW's megawidgets. Level 3: making your own widgets. Level 4: making your own composite widgets (if that is different). Ok, sounds good... I'll post in this thread a draft level 12 [1] tutorial later today. Until I can log on to the wiki I've posted the tutorial at my blog: http://albertovalverde.es/twforms_tutorial1.html Feedback welcomed! :) Alberto --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Unittesting `updates` in a restful controller
Hi all. I've created a REST controller like this: $ paster restcontroller comment comments Next, I added it to my routes... # inside project/config/routing.py map.resource('comment', 'comments') Next, I modify each method in my comments controller to return it's string name: def index(self, format='html'): GET /comments: All items in the collection. # url_for('comments') return 'index' def create(self): POST /comments: Create a new item. # url_for('comments') return 'create' def new(self, format='html'): GET /comments/new: Form to create a new item. # url_for('new_comment') return 'new' ... Finally, I create a test, that I expect to be routed to here - Comments.update But instead, I get routed to - Comments.index The test is below: def test_update(self): response = self.app.post(url_for('comments', id = 1), dict(somekey='someval', _method='put')) response.mustcontain('update') Anyone have any ideas how to match the route I'm after? Thanks! jw --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: cleaner ToscaWidgets
I've written a summary page introducing Pylons form handling and ToscaWidgets, with links to the existing ToscaWidgets tutorials. Alberto's new tutorial is first, which will hopefully cut down on user confusion until the others are updated, combined, or deleted. http://wiki.pylonshq.com/display/pylonscookbook/Forms It's at the top level of the Pylons Cookbook. I wanted to list all the other articles below it on the Cookbook home page, but the list of articles is auto-generated and can't be changed without reparenting documents. TW experts and FormEncode experts, please verify the summaries is accurate. -- Mike Orr [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Unittesting `updates` in a restful controller
Ahh, I figured it out myself. The default route picks this up: self.app.post('/comments/update/1', ...) I had forgotten about the default route, :o. jw On Oct 23, 4:02 pm, programmer.py [EMAIL PROTECTED] wrote: Hi all. I've created a REST controller like this: $ paster restcontroller comment comments Next, I added it to my routes... # inside project/config/routing.py map.resource('comment', 'comments') Next, I modify each method in my comments controller to return it's string name: def index(self, format='html'): GET /comments: All items in the collection. # url_for('comments') return 'index' def create(self): POST /comments: Create a new item. # url_for('comments') return 'create' def new(self, format='html'): GET /comments/new: Form to create a new item. # url_for('new_comment') return 'new' ... Finally, I create a test, that I expect to be routed to here - Comments.update But instead, I get routed to - Comments.index The test is below: def test_update(self): response = self.app.post(url_for('comments', id = 1), dict(somekey='someval', _method='put')) response.mustcontain('update') Anyone have any ideas how to match the route I'm after? Thanks! jw --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: UNS: Re: cleaner ToscaWidgets
On 10/23/07, Alberto Valverde [EMAIL PROTECTED] wrote: Until I can log on to the wiki I've posted the tutorial at my blog: http://albertovalverde.es/twforms_tutorial1.html Cool. I don't have time to read it thouroughly but I certainly will. One remark I noticed: We're importing the validators from the twForms' validators module. This module includes all validators from FormEncode but overrides UnicodeStringso it doesn't encode strings when converting from python. This is needed because Genshi and Mako need all strings to be unicode internally (or at least be ascii encodable). I remember this issue back when I worked on TG but now I use stock UnicodeString validators in my Pylons and it just works. I checked the FE source and it does the encoding now: def _from_python(self, value, state): if hasattr(value, '__unicode__'): value = unicode(value) if isinstance(value, unicode): return value.encode(self.outputEncoding) return str(value) -- Max Ischenko http://www.developers.org.ua/ -- Ukrainian software developers community http://maxischenko.in.ua/ -- my blog (Russian) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: cleaner ToscaWidgets
Hello Mike, On 10/24/07, Mike Orr [EMAIL PROTECTED] wrote: I've written a summary page introducing Pylons form handling and ToscaWidgets, with links to the existing ToscaWidgets tutorials. Alberto's new tutorial is first, which will hopefully cut down on user confusion until the others are updated, combined, or deleted. http://wiki.pylonshq.com/display/pylonscookbook/Forms I 've tried to checkout Kevin's PDF and it appears that Confluence requires user to login to download the file. Max. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: cleaner ToscaWidgets
On 10/23/07, Max Ischenko [EMAIL PROTECTED] wrote: On 10/24/07, Mike Orr [EMAIL PROTECTED] wrote: I've written a summary page introducing Pylons form handling and ToscaWidgets, with links to the existing ToscaWidgets tutorials. Alberto's new tutorial is first, which will hopefully cut down on user confusion until the others are updated, combined, or deleted. http://wiki.pylonshq.com/display/pylonscookbook/Forms I 've tried to checkout Kevin's PDF and it appears that Confluence requires user to login to download the file. Is that why it didn't show up in the search when I tried to make a link to it? I had to use an external URL. Well, maybe Ben knows something about this. -- Mike Orr [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: UNS: Re: cleaner ToscaWidgets
Max Ischenko wrote: One remark I noticed: We're importing the validators from the twForms' validators module. This module includes all validators from FormEncode but overrides UnicodeString so it doesn't encode strings when converting from python. This is needed because Genshi and Mako need all strings to be unicode internally (or at least be ascii encodable). I think I might have just changed this in the trunk (which I'm planning to release shortly), so maybe it's a moot issue. -- Ian Bicking : [EMAIL PROTECTED] : http://blog.ianbicking.org --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---