Wing in mod_python vs wsgi?
I'm still using mod_python to deploy my framework for production (CentOS running Python 2.5.5, Apache 2.2.3, mod_python 3.3.1). I'm acutely aware of how elderly mod_python is, and I've had some frustrations using Wing to debug inside it -- at least its possible, which is not true for any other Python IDE I've tried. Does Wing do better in mod_wsgi? Is it time for me to migrate from mod_python to mod_wsgi? Has anybody tried to do this (mod_wsgi and apache) in a Windoze environment? Thx, Tom S. -- Tom Stambaugh 63 Boston Ave Somerville, MA 02144 617-776-8934 (land) 617-721-0446 (cell) -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
"Duncan Booth" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I've also just spent a while getting simplejson 1.7.4 to install on a > (non- > windows) system without a C compiler. > > The trick is to unzip the tar file and then before you try to install it > delete everything in simplejson.egg-info. Then 'setup.py install' will run > to completion and while it warns about 'speedups are not enabled.' it > doesn't take it as fatal error. > > Without this step it preserves the reference to native_libs.txt in > SOURCES.txt even though the native_libs.txt file itself gets deleted. I had no trouble getting it to install without the speedups -- but the primary reason I upgraded was to take advantage of the speedups! -- http://mail.python.org/mailman/listinfo/python-list
python-list Metaquestion
I continue to receive emails, addressed to [EMAIL PROTECTED], with subject: "Re: Your message to Python-list awaits moderator approval", which read: > Your mail to 'Python-list' with the subject > >(no subject) > > Is being held until the list moderator can review it for approval. > > The reason it is being held: > >Message has a suspicious header I'm happy to adjust my headers in whatever way is needed, if I know what the problem is. Is there FAQ somewhere that tells me what I should change? Thx, Tom -- http://mail.python.org/mailman/listinfo/python-list
Re: String To List
It's too bad your inner data items are delimited with an apostrophe (') instead a double-quote ("). If they were double-quote, you could do something as simple as: Given: a = '["xyz", "abc"]' import simplejson answer = simplejson.loads(a) There may be an incantation to simplejson that allows you to use a different delimiter. You might be able to provide your own decoder, using the "cls=" argument (but I don't think that lets you change the delimiter string). Failing that, and depending on your regex/Python prowess, you might be able to change the "decoder.py" file within simplejson to do what you want. As others have observed, a lot depends on the input data. If it really is as simple as your example, then the following may do the trick: a = "['xyz', 'abc']" answer = map(lambda each: each.strip()[1:-1], a[1:-1].split(',')) This at least has no "eval", and so you need not fear applying it to unknown data (it will just break). The answer that works best for you may perhaps be somewhere in the middle. "Girish" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I have a string a = "['xyz', 'abc']".. I would like to convert it to a > list with elements 'xyz' and 'abc'. Is there any simple solution for > this?? > Thanks for the help... > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list
Re: Types, Cython, program readability
> I'm not entirely sure why you think Pyrex should "contain a compiler". > It certainly works well enough with the free [beer] MS VS 2008 Express > and I'm fairly sure it's fine with MingW. Both of those are readily > available and I don't imagine anyone who's going to use Pyrex / Cython / > ShedSkin is going to baulk at downloading a compiler set :) Anything like this is a lot more attractive to me if I can download and install a binary without *needing* a compiler. Most of the time, I just want something to run -- I don't want to risk diving in compiler-hell if I can avoid it. It isn't downloading the compiler set that worries me, it's that I almost never even want to think about it. For example, the new (!) simplejson (v1.7.4) doesn't compile correctly (on my WinXP system, at least) with either any current MS or MinGW compiler. Oh, I know I can make it work if I spend enough time on it -- but the binary egg I eventually found seems to work just fine. -- http://mail.python.org/mailman/listinfo/python-list
Re: Pycon disappointment
> But vendors often don't label themselves as vendors. And often, the > researcher or individual in question, who has something worth saying, does > have a professional job of sorts, which might be related to his or her > work > or speech. I've heard people give very long, detailed talks about > interesting topics, that did have a spin on them, but contained worthwhile > information also. Now, is that to be billed as a "vendor" (and ignored) > or > not? > Further, no vendor who is trying to sell a product will allow themselves > to > be marked in an obvious way as advertising, knowing that they'll be > ignored. At least, they certainly won't pay for the time/space to any > real > degree, knowing they'll be walking in under a cloud like that. No vendor with integrity will want their advertising to be presented to attendees as anything but advertising. If vendors won't buy advertising, then find different ways to fund the conferences. This sounds like an example of the editorial-content/advertising dilemma that publishers have wrestled with for a long time. It's basically impossible for anybody, even for seasoned professionals, to both sell advertising and set editorial content without bias. In the publishing business, it is a very big no-no for the same people to both sell advertising and also set editorial content. When you go high enough in an organization, it's harder to do, but still a goal. Perhaps the organizers can therefore learn from the experience of publishers: 1) Keep the folks who sell things in an "advertising department". They need to be different people from the folks who book keynotes and such. 2) Keep the folks who book keynotes and such in a "content department". They need to be different people from the folks who sell things. 3) Do everything possible to keep the "advertising" and "content" departments firewalled. This is cultural as much as anything else. Like any other potential conflict of interest situation, make it honorable for folks to recuse themselves when they sense a bias in themselves. -- http://mail.python.org/mailman/listinfo/python-list
Re: Unicode/UTF-8 confusion
I want to thank this community -- especially Carsten Haese -- for your patience with my confusion and for your several suggestions about how to resolve the issue. As a newcomer to python-list, I appreciate your willingness to respond to my request and your graciousness in helping me see the contribution I made to my issue. I now see that, as is often the case, I was asking the wrong question. The immediate problem that this exchange helped me identify is that I needed to escape the json string *again* on its way through my html wrapper. The far more elegant approach sketched by Carsten is the simple act of dropping the apostrophes in my own wrapper. I love that! It works, it's elegant, and it typifies the things that an outside "pair of eyes" can see far more immediately than me. Thank you, Carsten. All in all, this was an extraordinarily helpful exchange. Thank you all, and I hope I can perhaps make similar contributions. -- http://mail.python.org/mailman/listinfo/python-list
Re: Unicode/UTF-8 confusion
I appreciate the answers the community has provided, I think I need to add some additional context. I use a trick to let me pass the information into my browser client application. The browser requests the server information from a form whose target is a hidden iframe. The string the server serializes is wrapped in html that embeds it in an onload handler like this: http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";> http://www.w3.org/1999/xhtml";>// When this html finishes loading, its onload handler fires, it in turn fires the "loadObject" method of the _clientApplication that is waiting for the result, and the clientApplication then unpacks aSerializedObject into the browser. Once back in the browser, the loadObject method calls JSON.parse on aSerializedObject, the json string we're discussing. A serialized object typically contains many (at least tens, and sometimes several hundred) html fragments. It contains at most a handful of apostrophes. That means there are MANY more double quotes than apostrophes, if I delimit attributes with double quotes. In order to successfully pass the escapes to the server, I already have to double any each backslash. At the end of the day, it's easier -- and results in better performance -- to convert each apostrophe to its unicode equivalent, as I originally asked. I just want to know if there's a faster way to persuade simplejson to accomplish the feat. -- http://mail.python.org/mailman/listinfo/python-list
Re: Unicode/UTF-8 confusion
> Somehow I don't get what you are after. The ' doesn't have to be escaped > at all if " are used to delimit the string. If ' are used as delimiters > then \' is a correct escaping. What is the problem with that!? If I delimit the string with double quote, then I have to escape every double quote in whatever I serialize. I'm moving strict html from the server to the browser, and therefore the value of every tag attribute is delimited by double quotes. That means that I'd have to escape every double quote, and there are MANY more of them. Thanks, Tom -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
> Somehow I don't get what you are after. The ' doesn't have to be escaped > at all if " are used to delimit the string. If ' are used as delimiters > then \' is a correct escaping. What is the problem with that!? If I delimit the string with double quote, then I have to escape every double quote in whatever I serialize. I'm moving strict html from the server to the browser, and therefore the value of every tag attribute is delimited by double quotes. That means that I'd have to escape every double quote, and there are MANY more of them. -- http://mail.python.org/mailman/listinfo/python-list
Unicode/UTF-8 confusion
I'm still confused about this, even after days of hacking at it. It's time I asked for help. I understand that each of you knows more about Python, Javascript, unicode, and programming than me, and I understand that each of you has a higher SAT score than me. So please try and be gentle with your responses. I use simplejson to serialize html strings that the server is delivering to a browser. Since the apostrophe is a string terminator in javascript, I need to escape any apostrophe embedded in the html. Just to be clear, the specific unicode character I'm struggling with is described in Python as: u'\N{APOSTROPHE}'}. It has a standardized utf-8 value (according to, for example, http://www.fileformat.info/info/unicode/char/0027/index.htm) of 0x27. This can be expressed in several common ways: hex: 0x27 Python literal: u"\u0027" Suppose I start with some test string that contains an embedded apostrophe -- for example: u" ' ". I believe that the appropriate json serialization of this is (presented as a list to eliminate notation ambiguities): ['"', ' ', ' ', ' ', '\\', '\\', '0', '0', '2', '7', ' ', ' ', ' ', '"'] This is a 14-character utf-8 serialization of the above test string. I know I can brute-force this, using something like the following: def encode(aRawString): aReplacement = ''.join(['\\', '0', '0', '2', '7']) aCookedString = aRawString.replace("'", aReplacement) answer = simplejson.dumps(aCookedString) return answer I can't even make mailers let me *TYPE* a string literal for the replacement string without trying to turn it into an HTML link! Anyway, I know that my "encode" function works, but it pains me to add that "replace" call before *EVERY* invocation of the simplejson.dumps() method. The reason I upgraded to 1.7.4 was to get the c-level speedup routine now offered by simplejson -- yet the need to do this apostrophe escaping seems to negate this advantage! Is there perhaps some combination of dumps keyword arguments, python encode()/str() magic, or something similar that accomplishes this same result? What is the highest-performance way to get simplejson to emit the desired serialization of the given test string? -- http://mail.python.org/mailman/listinfo/python-list
Unicode/UTF-8 confusion
I'm still confused about this, even after days of hacking at it. It's time I asked for help. I understand that each of you knows more about Python, Javascript, unicode, and programming than me, and I understand that each of you has a higher SAT score than me. So please try and be gentle with your responses. I use simplejson to serialize html strings that the server is delivering to a browser. Since the apostrophe is a string terminator in javascript, I need to escape any apostrophe embedded in the html. Just to be clear, the specific unicode character I'm struggling with is described in Python as: u'\N{APOSTROPHE}'}. It has a standardized utf-8 value (according to, for example, http://www.fileformat.info/info/unicode/char/0027/index.htm) of 0x27. This can be expressed in several common ways: hex: 0x27 Python literal: u"\u0027" Suppose I start with some test string that contains an embedded apostrophe -- for example: u" ' ". I believe that the appropriate json serialization of this is (presented as a list to eliminate notation ambiguities): ['"', ' ', ' ', ' ', '\\', '\\', '0', '0', '2', '7', ' ', ' ', ' ', '"'] This is a 14-character utf-8 serialization of the above test string. I know I can brute-force this, using something like the following: def encode(aRawString): aReplacement = ''.join(['\\', '0', '0', '2', '7']) aCookedString = aRawString.replace("'", aReplacement) answer = simplejson.dumps(aCookedString) return answer I can't even make mailers let me *TYPE* a string literal for the replacement string without trying to turn it into an HTML link! Anyway, I know that my "encode" function works, but it pains me to add that "replace" call before *EVERY* invocation of the simplejson.dumps() method. The reason I upgraded to 1.7.4 was to get the c-level speedup routine now offered by simplejson -- yet the need to do this apostrophe escaping seems to negate this advantage! Is there perhaps some combination of dumps keyword arguments, python encode()/str() magic, or something similar that accomplishes this same result? What is the highest-performance way to get simplejson to emit the desired serialization of the given test string? -- http://mail.python.org/mailman/listinfo/python-list