Javascript in template
Hello. How to use JavaScript in template form? I'v add script src='/js/calendar.js'/script input type=text value=2004/02/02 readonly name=theDate input type=button value=Cal onclick=displayCalendar (document.forms[0].theDate,'/mm/dd',this) http://www.dhtmlgoodies.com/index.html?page=calendarScripts Alexy --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Response hangs when using SQLAlchemy
It hit me this morning @ breakfast that my use of uuid1() w/ SQLAlchemy cannot be the problem, at least not the whole problem. When I used SimpleXMLRPCServer instead of the pylons WSGI stack, everything worked, even when using uuid1(). Also, even when using pylons, the rows were being inserted into the DB just fine, so uuid1() was being called for each new row, and they were getting into the DB quickly and correctly, no blocking behavior at all. The real problem was the final TCP packet not being sent to the client. So I'm back to not understanding why using uuid1() causes the WSGI+TCP/IP stack to break down, and uuid4() does not. The only thing I can think of is that uuid1() access some information about the machine's network hardware to create the GUID, and maybe that access is interfering with TCP/IP? Seems very unlikely. I know how to make the problem go away, but I keep bringing it up because I want to submit a bug report, I just don't know which project I should submit it to. I still don't know the exact problem. On Mar 5, 3:32 pm, Bryan bryanv...@gmail.com wrote: I had never even known about /dev/random It is working now, but I think the final thing I will do is push the GUID creation onto the database server instead of doing it in python code. One less line of code I need to maintain. This was one of the most difficult bugs I've had to deal with in a long time. Sometimes it is amazing the path that you traverse in debugging code. This bug had me looking at the pylons source, then looking at every packet that crossed the wire, and finally looking at python sources. I've learned a lot in the last few days, I'm going to eat ice cream now. Bryan On Mar 5, 3:13 pm, Matthew Zwier mczw...@gmail.com wrote: The 2.5 uuid module tries to use underlying system UUID libraries, so the read from /dev/random may be in there instead of in the Python code. Don't know what 2.6 does. Hmm...that's not very helpful. I know just enough about the internals of Python to be dangerous :) MZ On Thu, Mar 5, 2009 at 4:31 PM, Bryan bryanv...@gmail.com wrote: I think you are correct. I restarted the server and the problems came back. In my SQLAlchemy setup I use uuid.uuid1(). When I changed this to use uuid4() the problems went away. I don't have the sources for python 2.5 (what the server runs), but in 2.6 uuid1 sometimes uses the random module, which accesses random generators at the os level. The thing is, in 2.6 the random module uses urandom, so there should not be a problem. Perhaps in 2.5 the random module uses the /dev/random 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: Thread-safety in Pylons (Python?)
On Thu, Mar 5, 2009 at 10:32 PM, Philip Jenvey pjen...@underboss.org wrote: Though Jython and IronPython lack a GIL, they ensure the methods we expect to be thread safe on the core data structures are in fact thread safe, for compatibility with CPython. So, is there any place where can I read what is thread safe in IronPython or Jython (what means: what should be done to be compatible with CPython and what means: what can CPython guarantee in terms of thread safety)? Cheers, Kamil --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Disabling unicode doesn't always disable unicode in 0.9.7
Hi everyone, One of my app's primary functions is to speak SNMP to routers and switches. This completely precludes the use of any Unicode - something that's getting very frustrating in Python (not just Pylons!) I've got: config['pylons.request_options']['charset'] = None config['pylons.response_options']['charset'] = 'iso-8859-1' in my config/environment.py. But I still have request.params being passed up the stack with everything as Unicode. Here's one example: UnicodeMultiDict([('location', u'2'), ('domain', u'2'), ('hostcount', u'6'), ('customer', u'a'), ('type', u'2'), ('description', u'a'), ('ttype', u'srt'), ('nexthop', u'172.16.0.4'), ('vlanmethod', u'auto'), ('vlan', u'0'), ('interface', u'Vlan99')]) I didn't see this behavior until 0.9.7. I've also tried setting config['pylons.request_options']['charset'] = US-ASCII, but the data comes through the same. According to [1], the config/environment.py value is overridden by the browser's Content-Type header. From wireshark, I can see that my browser is sending Content-Type: application/x-www-form-urlencoded - I don't see any mention of UTF-8 encoding there, but I don't totally know what that means. What's more perplexing is that despite the environment.py settings to use ISO-8859-1, and my HTML settings that are shipping ISO-8859-1, PasteServer's HTTP headers still say Content-Type: text/html; charset=UTF-8! What do I have to do to really prevent Unicode from showing up in my variables? Hopefully, I don't have to wrap every string in my app with str()... [1] http://pylonshq.com/docs/en/0.9.7/tutorials/understanding_unicode/ -- Ross Vandegrift r...@kallisti.us If the fight gets hot, the songs get hotter. If the going gets tough, the songs get tougher. --Woody Guthrie --~--~-~--~~~---~--~~ 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: Disabling unicode doesn't always disable unicode in 0.9.7
On Mar 6, 2009, at 2:34 PM, Ross Vandegrift wrote: Hi everyone, One of my app's primary functions is to speak SNMP to routers and switches. This completely precludes the use of any Unicode - something that's getting very frustrating in Python (not just Pylons!) I've got: config['pylons.request_options']['charset'] = None config['pylons.response_options']['charset'] = 'iso-8859-1' in my config/environment.py. But I still have request.params being passed up the stack with everything as Unicode. Here's one example: UnicodeMultiDict([('location', u'2'), ('domain', u'2'), ('hostcount', u'6'), ('customer', u'a'), ('type', u'2'), ('description', u'a'), ('ttype', u'srt'), ('nexthop', u'172.16.0.4'), ('vlanmethod', u'auto'), ('vlan', u'0'), ('interface', u'Vlan99')]) I didn't see this behavior until 0.9.7. I've also tried setting config['pylons.request_options']['charset'] = US-ASCII, but the data comes through the same. This should work: config['pylons.request_options']['charset'] = None Maybe you don't have this line at the end of the environment.py? It should come after config.init_app You can check request.charset later for what this is actually set to. Only the value of None should disable unicode (US-ASCII won't). -- 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: Thread-safety in Pylons (Python?)
On Mar 6, 12:58 pm, Kamil Gorlo kgo...@gmail.com wrote: On Thu, Mar 5, 2009 at 10:32 PM, Philip Jenvey pjen...@underboss.org wrote: Though Jython and IronPython lack a GIL, they ensure the methods we expect to be thread safe on the core data structures are in fact thread safe, for compatibility with CPython. So, is there any place where can I read what is thread safe in IronPython or Jython (what means: what should be done to be compatible with CPython and what means: what can CPython guarantee in terms of thread safety)? My reading is that there is no guarantee and that you should use locks when you need to ensure thread safety. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Javascript in template
First of all, this question has _nothing_ to do with Pylons -- if you didn't know about it, you do now. Second, it seems that you have intentionally renamed the downloaded JavaScript library, so I think the first point to check can be: Is your installed copy accessed at http://yourserver/js/calendar.js ? Third, a bare-bone working HTML example (not tested) would be -- html head script type=text/javascript src=/js/ dhtmlgoodies_calendar.js/script /head body form input type=button value=Cal onclick=displayCalendar (document.forms[0].theDate,'/mm/dd',this) / /form /body /html Fourth, I can't stop myself from warning you that that site is providing very sloppy (reads BAD) HTML example with non-progressive (reads BAD) JavaScript usage which does not even get rendered properly in Firefox. The same effect can be achieved 42 times more elegantly with any modern unobstructive JavaScript libraries such as JQuery, Prototype, etc. Finally, I think you should show more effort by reading up on the HTML basics first. Jerry On Mar 6, 4:34 am, menshikoval...@gmail.com menshikoval...@gmail.com wrote: Hello. How to use JavaScript in template form? I'v add script src='/js/calendar.js'/script input type=text value=2004/02/02 readonly name=theDate input type=button value=Cal onclick=displayCalendar (document.forms[0].theDate,'/mm/dd',this) http://www.dhtmlgoodies.com/index.html?page=calendarScripts Alexy --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
repoze.what-pylons working sample project
Hi Gustavo Narea All, I couldn't make repoze.what working with my application when I am following http://wiki.pylonshq.com/display/pylonscookbook/Authorization+with+repoze.what Can you project a simple pylons project with the example? It is possible? Regards, Gopal --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---