Re: [2.4.2/Linux] Getting Python to fork?

2008-02-04 Thread Jon Ribbens
On 2008-02-04, Christian Heimes [EMAIL PROTECTED] wrote: Jon Ribbens wrote: Why? I don't think you do. Neither does BSD daemon.c or glibc daemon.c The problem is well documented at http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66012 OK I understand what is being said here

Re: [2.4.2/Linux] Getting Python to fork?

2008-02-04 Thread Jon Ribbens
On 2008-02-04, Gilles Ganault [EMAIL PROTECTED] wrote: I need to launch a Python script, and fork it so that the calling script can resume with the next step will the Python script keeps running. I tried those two, but they don't work, as the calling script is stuck until the Python

Re: [2.4.2/Linux] Getting Python to fork?

2008-02-04 Thread Jon Ribbens
On 2008-02-04, Rolf van de Krol [EMAIL PROTECTED] wrote: To create a deamon, you indeed need to fork two times. For more information and a working example see: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/278731 . I'm quite sure this works, because I used it several times to

Re: Regarding coding style

2008-03-07 Thread Jon Ribbens
On 2008-03-07, D'Arcy J.M. Cain [EMAIL PROTECTED] wrote: 2. You should use two spaces after a sentence-ending period. For heavens sake, why? I've always been obstructed by the double blanks but tolerated them. Now, that i read that it actually is a recommendation, i need to ask about the

Re: Finally had to plonk google gorups.

2008-04-16 Thread Jon Ribbens
On 2008-04-16, Grant Edwards [EMAIL PROTECTED] wrote: But that's not a battle you can win, so I broke down and joined all the other people that just killfile everything posted via google.groups. I did the same about an hour ago. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Success stories

2008-04-23 Thread Jon Ribbens
On 2008-04-23, Mark Wooding [EMAIL PROTECTED] wrote: Python is actually one of the few to define one but not the other. (The other one I can think of is Acorn's BBC BASIC, for whatever that's worth; it too lacks `++'.) You should've added it in Termite Basic then :-p --

Re: Setting expirty data on a cookie

2008-04-25 Thread Jon Ribbens
On 2008-04-25, David [EMAIL PROTECTED] wrote: Another note: 'expires' is apprantly a legacy attribute for early Netscape browsers. The RFC and python source comments suggest that you use 'Max-Age' instead. Theoretically, yes. In practice, no. *Nobody* uses the new-style cookies, everyone uses

Re: Why is None = 0

2008-04-25 Thread Jon Ribbens
On 2008-04-25, Martin v. Löwis [EMAIL PROTECTED] wrote: None is smaller than anything. According to Tim Peters, this is not true. See http://bugs.python.org/issue1673405 -- http://mail.python.org/mailman/listinfo/python-list

Re: Why can't timedeltas be divided?

2008-04-26 Thread Jon Ribbens
On 2008-04-27, Martin v. Löwis [EMAIL PROTECTED] wrote: sorry for bringing up such an old thread, but this seems important to me -- up to now, there are thousands [1] of python programs that use hardcoded time calculations. Would you like to work on a patch? Last time I brought up this sort

Re: Why can't timedeltas be divided?

2008-04-27 Thread Jon Ribbens
On 2008-04-27, Martin v. Löwis [EMAIL PROTECTED] wrote: Last time I brought up this sort of thing, it seemed fairly unanimous that the shortcomings of the datetime module were 'deliberate' and would not be fixed, patch or no patch. Ok, so then if the answer to my question is yes, the first

Re: Why can't timedeltas be divided?

2008-04-27 Thread Jon Ribbens
On 2008-04-27, webograph [EMAIL PROTECTED] wrote: On 2008-04-27 14:18, Jon Ribbens wrote: Yes, that's where it was decided that the datetime module was fine that way it is and must not be changed. could you give me some pointers to that discussion? Well, http://bugs.python.org/issue1673409

Re: Best way to store config or preferences in a multi-platform way.

2008-05-01 Thread Jon Ribbens
On 2008-05-01, Ivan Illarionov [EMAIL PROTECTED] wrote: IMO .ini-like config files are from the stone age. The modern approach is to use YAML (http://www.yaml.org). You mean YAML isn't a joke!? It's so ludicrously overcomplicated, and so comprehensively and completely fails to achieve its

Re: Best way to store config or preferences in a multi-platform way.

2008-05-01 Thread Jon Ribbens
On 2008-05-01, Ivan Illarionov [EMAIL PROTECTED] wrote: I used XML files before for this purpose and found YAML much easier and better suitable for the task. Please explain why don't like YANL so much? Because even the examples in the spec itself are unreadable gibberish. The PyYAML library

Re: 16bit hash

2007-06-27 Thread Jon Ribbens
On 2007-06-27, Robin Becker [EMAIL PROTECTED] wrote: Is the any way to get an efficient 16bit hash in python? int(md5.new(s).hexdigest()[:4], 16) ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Why PHP is so much more popular for web-development

2007-07-27 Thread Jon Ribbens
On 2007-07-26, Steve Holden [EMAIL PROTECTED] wrote: That sounds trivial to ameliorate (at least somewhat) by putting your uploads in a directory whose name is known only to you (let's say it's a random 20-letter string). The parent directory can be protected to not allow reading the

Re: Best way to protect my new commercial software.

2007-12-18 Thread Jon Ribbens
On 2007-12-18, Grant Edwards [EMAIL PROTECTED] wrote: On 2007-12-18, Jan Claeys [EMAIL PROTECTED] wrote: No, it's only copyrighted when you _publish_ it. Interesting. So, in Europe, if somebody steals something you wrote before you get it published, they're free to do with it as they

Re: Getting Python to fork?

2008-02-04 Thread Jon Ribbens
On 2008-02-04, Bernard [EMAIL PROTECTED] wrote: #Fork and commit suicide if os.fork(): sys.exit(0) I'm pretty sure that should be os._exit(0) #What to do in parent process This is now the child process. sys.stdin =

Re: [2.4.2/Linux] Getting Python to fork?

2008-02-04 Thread Jon Ribbens
On 2008-02-04, Christian Heimes [EMAIL PROTECTED] wrote: Although bear in mind it's pretty UNIX-y. IIRC you have to fork a second time after you have changed the working dir and created a new session group. Why? I don't think you do. Neither does BSD daemon.c or glibc daemon.c --

Re: Iteration for Factorials

2007-10-23 Thread Jon Ribbens
On 2007-10-23, Hendrik van Rooyen [EMAIL PROTECTED] wrote: Yuk. Reminds me of one of the Hitachi processors that has a single depth hardware link register that tells a subroutine where it was called from. That's how ARM processors work, and they're everywhere these days. --

Re: count pages in a pdf

2007-11-27 Thread Jon Ribbens
On 2007-11-27, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: is it possible to parse a pdf file in python? for starters, i would like to count the number of pages in a pdf file. i see there is a project called ReportLab, but it seems to be a pdf generator... i can't tell if i would be able to

Re: why isn't Unicode the default encoding?

2006-03-21 Thread Jon Ribbens
In article [EMAIL PROTECTED], Martin v. Löwis wrote: In any case, it doesn't matter what encoding the document is in: read(2) always returns two bytes. It returns *up to* two bytes. Sorry to be picky but I think it's relevant to the topic because it illustrates how it's difficult to change the

Re: How do clients(web browser) close a python CGI program that is not responding?

2006-03-28 Thread Jon Ribbens
In article [EMAIL PROTECTED], Sullivan WxPyQtKinter wrote: Hi,there. Sometimes a python CGI script tries to output great quantities of HTML responce or in other cases, it just falls into a dead loop. How could my client close that CGI script running on the server? I tried to use the STOP

Re: Difference between 'is' and '=='

2006-04-03 Thread Jon Ribbens
In article [EMAIL PROTECTED], Roy Smith wrote: This may even be useful. What if you were trying to emulate SQL's NULL? NULL compares false to anything, even itself. Strictly speaking, comparing NULL to anything gives NULL, not False. -- http://mail.python.org/mailman/listinfo/python-list

Re: overloading constructor in python?

2006-04-03 Thread Jon Ribbens
In article [EMAIL PROTECTED], Alex Martelli wrote: I guess in python we use two idioms to cover most of the uses of mulltiple constructors: ... and classmethods. OK, _three_ idioms. Oh, and factory functions. Among the idioms we use are the following... Nobody expects the Spanglish

Re: File writing success

2007-05-11 Thread Jon Ribbens
On 2007-05-11, HMS Surprise [EMAIL PROTECTED] wrote: If file writing has no return value (http://docs.python.org/lib/bltin- file-objects.html), how do you know if the write was successful? Because no exception was thrown? Although bear in mind that some errors might not become apparent until

Re: Select hangs after some reads

2006-06-08 Thread Jon Ribbens
In article [EMAIL PROTECTED], Steve Holden wrote: Of course, if the client forces the TCP PSH flag true then the receiver is guaranteed to debuffer the stream up to that point - this is how FTP clients work, for example. I don't think that's right. You are confusing the PSH flag (which is

Re: Select hangs after some reads

2006-06-08 Thread Jon Ribbens
In article [EMAIL PROTECTED], Steve Holden wrote: I don't think that's right. You are confusing the PSH flag (which is basically unused in Unix networking I think) and the URG flag (which is extremely rarely used, but is indeed used by FTP to get abort requests to 'jump the queue' as it were).

Re: help() on stdout.closed

2006-06-21 Thread Jon Ribbens
In article [EMAIL PROTECTED], Pekka Karjalainen wrote: from sys import stdout help (stdout.closed) If I do this, it gives me help on the bool object. stdout.closed is a bool. What were you expecting it to show you? -- http://mail.python.org/mailman/listinfo/python-list

Re: What's the best way to wrap a whole script in try..except?

2006-06-21 Thread Jon Ribbens
In article [EMAIL PROTECTED], Hari Sekhon wrote: I want to wrap a whole script in try ... except. What is the best way of doing this? You could do this maybe: import sys def excepthook(exc_type, exc_value, tb): import modules_needed_to_notify_exception ... sys.excepthook =

Re: OS specific command in Python

2006-06-21 Thread Jon Ribbens
In article [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: So basically, instead of typing in on the command line argument I want to have it in a python program and let it do the action. Try exec() and execfile() from the standard library (IIRC) Ths os.spawn...() functions are likely to be

Re: Sudoko solver

2006-07-04 Thread Jon Ribbens
In article [EMAIL PROTECTED], Rony Steelandt wrote: Yes, this is on windows using winzip It says the zip file is not a valid zipfile Works fine for me on Windows. Try deleting the file you downloaded, clearing your browser cache, and trying again. On the other hand, when you run it it

Re: Fork You.. Forking and threading..

2006-07-05 Thread Jon Ribbens
In article [EMAIL PROTECTED], rh0dium wrote: if os.fork() == 0: os.setsid sys.stdout = open(/dev/null, 'w') sys.stdin = open(/dev/null, 'r') I don't know if it's the cause of your problem, but you're not doing the backgrounding right, it should be: if os.fork():

Re: how can I avoid abusing lists?

2006-07-07 Thread Jon Ribbens
In article [EMAIL PROTECTED], Thomas Nelson wrote: This is exactly what I want to do: every time I encounter this kind of value in my code, increment the appropriate type by one. Then I'd like to go back and find out how many of each type there were. This way I've written seems simple enough

Re: #!/usr/bin/env python 2.4?

2007-03-21 Thread Jon Ribbens
In article [EMAIL PROTECTED], Stargaming wrote: from sys import version_info if version_info[0] 2 or version_info[1] 4: raise RuntimeError(You need at least python2.4 to run this script) That'll fail when the major version number is increased (i.e. Python 3.0). You want: if

Re: #!/usr/bin/env python 2.4?

2007-03-21 Thread Jon Ribbens
In article [EMAIL PROTECTED], Sion Arrowsmith wrote: Jon Ribbens [EMAIL PROTECTED] wrote: if sys.hexversion 0x020400f0: ... error ... Readability counts. if sys.version_info (2, 4): ... error ... Maybe you should suggest a patch to the Python documentation

Re: #!/usr/bin/env python 2.4?

2007-03-22 Thread Jon Ribbens
In article [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: I don't see any problem with:: if version_info[0] = 2 and version_info[1] 4: raise RuntimeError() What if the version number is 1.5? -- http://mail.python.org/mailman/listinfo/python-list

Re: #!/usr/bin/env python 2.4?

2007-03-23 Thread Jon Ribbens
In article [EMAIL PROTECTED], Gabriel Genellina wrote: Uh... I never thought it was an implied formula there - that F0 had to come from 1.5 = 15 = 0xF. I think it should be stated much more clearly. I'm not sure what you're saying. You are correct that the documentation is rather vague. The

Re: I need a string/list/generator/comprehension incantation.

2007-04-20 Thread Jon Ribbens
In article [EMAIL PROTECTED], Steven W. Orr wrote: Now I want something that's going to give me a string whose value is the set of all of the first letters of months. Order is not important. .join(set(m[0] for m in calendar.month_abbr[1:])) And for extra credit, I need the string whose value

Re: need an alternative to getattr()

2006-08-07 Thread Jon Ribbens
In article [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: import heading1 import heading2 While True: heading = get_next_heading(file_ptr) # This func will return heading1, then heading2(on next call) if heading = : break getattr(heading, process)(file_ptr) # The problem,

Re: IP address

2006-08-10 Thread Jon Ribbens
In article [EMAIL PROTECTED], Lad wrote: I have a website written in Python and I would like to login every visitor's IP address. In other words, if a visitor come to my Python application, this application will record his IP. Depending on what CGI framework you're using, something like:

Re: list index()

2007-08-31 Thread Jon Ribbens
On 2007-08-31, Erik Max Francis [EMAIL PROTECTED] wrote: I say the 'oll' in troll like the 'ol' in frolic, and pronounce roll and role similarly. My accent is probably from the East Midlands of the UK, but is not pronounced. _Troll_ and _frolic_ aren't pronounced with the same o sound in

Re: smtp debugging methods

2007-09-14 Thread Jon Ribbens
On 2007-09-14, Sean Nakasone [EMAIL PROTECTED] wrote: I'm having trouble with sending smtp mail. It's hanging after the smtplib.SMTP() line. It doesn't works from home but not from work. What's the best way to debug this? # Here's the error server = smtplib.SMTP(smtp.gmail.com,465)

Re: add without carry

2006-09-15 Thread Jon Ribbens
In article [EMAIL PROTECTED], Bruno Desthuilliers wrote: Hugh wrote: Sorry, here's an example... 5+7=12 added without carrying, 5+7=2 i.e the result is always less than 10 I've been thinking some more about this and my brain is starting to work something out... No need to think

Re: A critique of cgi.escape

2006-09-23 Thread Jon Ribbens
In article [EMAIL PROTECTED], Fredrik Lundh wrote: Lawrence D'Oliveiro wrote: So I think the default for the second argument to cgi.escape should be changed to True. Or alternatively, the second argument should be removed altogether, and quotes should always be escaped. you're confused:

Re: A critique of cgi.escape

2006-09-24 Thread Jon Ribbens
In article [EMAIL PROTECTED], Georg Brandl wrote: Attributes can be quoted with either single or double quotes. That's what the HTML spec says. cgi.escape doesn't correctly allow for that. Ergo, cgi.escape is broken. QED. A function is broken if its implementation doesn't match the

Re: A critique of cgi.escape

2006-09-24 Thread Jon Ribbens
In article [EMAIL PROTECTED], Fredrik Lundh wrote: Making cgi.escape always escape the '' character would not break anything, and would probably fix a few bugs in existing code. Yes, those bugs are not cgi.escape's fault, but that's no reason not to be helpful. It's a minor improvement with no

Re: A critique of cgi.escape

2006-09-25 Thread Jon Ribbens
In article [EMAIL PROTECTED], Fredrik Lundh wrote: maybe you haven't done software long enough to understand that software works better if you use it the way it was intended to be used, but that's no excuse for being stupid. So what's your excuse? --

Re: A critique of cgi.escape

2006-09-25 Thread Jon Ribbens
In article [EMAIL PROTECTED], Fredrik Lundh wrote: If you're really serious about making things easier to use, shouldn't you look at the whole picture? HTML documents are byte streams, so any transformation from internal character data to HTML must take both escaping and encoding into

Re: A critique of cgi.escape

2006-09-25 Thread Jon Ribbens
In article [EMAIL PROTECTED], Fredrik Lundh wrote: (still waiting for the jon's enhanced escape proposal, btw, but I guess it's easier to piss on others than to actually contribute something useful). Well, yes, you certainly seem to be good at the pissing on others part, even if you have to lie

Re: A critique of cgi.escape

2006-09-25 Thread Jon Ribbens
In article [EMAIL PROTECTED], Duncan Booth wrote: It is generally a principle of Python that new releases maintain backward compatability. An incompatible change such proposed here would probably break many tests for a large number of people. Why is the suggested change incompatible? What

Re: A critique of cgi.escape

2006-09-25 Thread Jon Ribbens
In article [EMAIL PROTECTED], Fredrik Lundh wrote: There's nothing to say that cgi.escape should take them both into account in the one function so what exactly are you using cgi.escape for in your code ? To escape characters so that they will be treated as character data and not control

Re: A critique of cgi.escape

2006-09-25 Thread Jon Ribbens
In article [EMAIL PROTECTED], Georg Brandl wrote: I'm sorry, that's not good enough. How, precisely, would it break existing code? Can you come up with an example, or even an explanation of how it *could* break existing code? Is that so hard to see? If cgi.escape replaced ' with an entity

Re: A critique of cgi.escape

2006-09-25 Thread Jon Ribbens
In article [EMAIL PROTECTED], Duncan Booth wrote: I guess you've never seen anyone write tests which retrieve some generated html and compare it against the expected value. If the page contains any unescaped quotes then this change would break it. You're right - I've never seen anyone do

Re: A critique of cgi.escape

2006-09-25 Thread Jon Ribbens
In article [EMAIL PROTECTED], Max M wrote: I'm sorry, that's not good enough. How, precisely, would it break existing code? Can you come up with an example, or even an explanation of how it *could* break existing code? Some examples are: - Possibly any code that tests for string equality

Re: A critique of cgi.escape

2006-09-25 Thread Jon Ribbens
In article [EMAIL PROTECTED], Max M wrote: Oh ... because you cannot see a use case for that *documented* behaviour, it must certainly be wrong? No, but if nobody else can find one either, that's a clue that maybe it's safe to change. Here's a point for you - the documentation for cgi.escape

Re: A critique of cgi.escape

2006-09-25 Thread Jon Ribbens
In article [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: I'm sorry, that's not good enough. How, precisely, would it break existing code? ('owdo Mr. Ribbens!) Good afternoon Mr Glover ;-) URI= 'http://www.oreilly.com/' html= cgi.escape(text) html= html.replace('O\'Reilly', 'a

Re: A critique of cgi.escape

2006-09-25 Thread Jon Ribbens
In article [EMAIL PROTECTED], Fredrik Lundh wrote: Sorry, that's still not good enough. that's not up to you to decide, though. It's up to me to decide whether or not an argument is good enough to convince me, thank you very much. -- http://mail.python.org/mailman/listinfo/python-list

Re: A critique of cgi.escape

2006-09-25 Thread Jon Ribbens
In article [EMAIL PROTECTED], Filip Salomonsson wrote: Here's a point for you - the documentation for cgi.escape says that the characters , and are converted, but not what they are converted to. If the documentation isn't clear enough, that means the documentation should be fixed.

Re: A critique of cgi.escape

2006-09-25 Thread Jon Ribbens
In article [EMAIL PROTECTED], Fredrik Lundh wrote: It's up to me to decide whether or not an argument is good enough to convince me, thank you very much. not if you expect anyone to take anything you say seriously. Now you're just being ridiculous. In this thread you have been rude, evasive,

Re: A critique of cgi.escape

2006-09-25 Thread Jon Ribbens
In article [EMAIL PROTECTED], Brian Quinlan wrote: Now you're just being ridiculous. In this thread you have been rude, evasive, insulting, vague, hypocritical, and have failed to answer substantive points in favour of sarcastic and erroneous sniping - I'd suggest it's you that needs to worry

Re: A critique of cgi.escape

2006-09-25 Thread Jon Ribbens
In article [EMAIL PROTECTED], Georg Brandl wrote: Here's a point for you - the documentation for cgi.escape says that the characters , and are converted, but not what they are converted to. It says to HTML-safe sequences. That's reasonably clear without the need to reproduce the exact

Re: QuoteSQL

2006-09-25 Thread Jon Ribbens
In article [EMAIL PROTECTED], Lawrence D'Oliveiro wrote: You're proposing two separate functions: 1) quoting of non-wildcard specials 2) quoting of wildcard specials Lawrence, you're wrong in this thread for the same reason you were right in the cgi.escape thread. Escaping general

Re: A critique of cgi.escape

2006-09-26 Thread Jon Ribbens
In article [EMAIL PROTECTED], Steve Holden wrote: I would have hoped that people don't treat that as a licence to be obnoxious, though. I am aware of Fredrik's history, which is why I was somewhat surprised and disappointed that he was being so rude and unpleasant in this thread. He is not

Re: A critique of cgi.escape

2006-09-26 Thread Jon Ribbens
In article [EMAIL PROTECTED], Fredrik Lundh wrote: the same documentation tells people what function to use if they want to quote *every-thing* that might need to be quoted, so if people did actually understand everything that was written in a reasonably clear way, this thread wouldn't even

Re: A critique of cgi.escape

2006-09-26 Thread Jon Ribbens
In article [EMAIL PROTECTED], Steve Holden wrote: Why do you say that? I have confined myself to simple logical arguments, and been frankly very restrained when presented with rudeness and misunderstanding from other thread participants. In what way should I have modified my postings?

Re: A critique of cgi.escape

2006-09-26 Thread Jon Ribbens
In article [EMAIL PROTECTED], Fredrik Lundh wrote: It's a pity he's being rude when presented with well-informed comment then. since when is the output of [snip code] well-informed? heck, it doesn't even pass the turing test ;-) Since when did that bear any resemblance to what I have

Re: A critique of cgi.escape

2006-09-26 Thread Jon Ribbens
In article [EMAIL PROTECTED], Fredrik Lundh wrote: the same documentation tells people what function to use if they want to quote *every-thing* that might need to be quoted, so if people did actually understand everything that was written in a reasonably clear way, this thread wouldn't even

Re: A critique of cgi.escape

2006-09-26 Thread Jon Ribbens
In article [EMAIL PROTECTED], Fredrik Lundh wrote: This has nothing to do with character encodings. it has *everything* to do with encoding of existing data into HTML so it can be safely transported to, and recreated by, an HTML-aware client. I can't tell if you're disagreeing or not. You

Re: A critique of cgi.escape

2006-09-26 Thread Jon Ribbens
In article [EMAIL PROTECTED], Brian Quinlan wrote: A summary of this pointless argument: Your summary seems pretty reasonable, but please note that later on, the thread was not about cgi.escape escaping (or not) quote characters (as described in your summary), but about Fredrik arguing, somewhat

Re: A critique of cgi.escape

2006-09-26 Thread Jon Ribbens
In article [EMAIL PROTECTED], Fredrik Lundh wrote: I know the answer. I'm pretty sure everyone else who's actually read my posts to this thread might have figured it out by now, too. But since you're still trying to win the debate, long after it's over, I think it's safest to end this thread

Re: A critique of cgi.escape

2006-09-26 Thread Jon Ribbens
In article [EMAIL PROTECTED], Brian Quinlan wrote: Your summary seems pretty reasonable, but please note that later on, the thread was not about cgi.escape escaping (or not) quote characters (as described in your summary), but about Fredrik arguing, somewhat incoherently, that it should have

Re: A critique of cgi.escape

2006-09-26 Thread Jon Ribbens
In article [EMAIL PROTECTED], Fredrik Lundh wrote: Jon Ribbens wrote: does the word information set mean anything to you? You would appear to be talking about either game theory, or XML, neither of which have anything to do with HTML. I notice that yet again you've snipped the substantial

Re: A critique of cgi.escape

2006-09-26 Thread Jon Ribbens
In article [EMAIL PROTECTED], Fredrik Lundh wrote: What do XML Information Sets have to do with escaping control characters in HTML? figure out the connection, and you'll have the answer to your substantial point. If you don't know the answer, you can say so y'know. There's no shame in it.

Re: A critique of cgi.escape

2006-09-26 Thread Jon Ribbens
In article [EMAIL PROTECTED], Brian Quinlan wrote: Well, there are dozens (hundreds?) of templating systems for Python. I know, I wrote one of them ;-) t = Template(test.html) t['foo'] = 'Brian - Hi!' assert str(t) == 'pBrian -gt; Hi/p' So how would you test our template system? What I

Re: A critique of cgi.escape

2006-09-26 Thread Jon Ribbens
In article [EMAIL PROTECTED], Brian Quinlan wrote: If, in the example that I showed, the less-than character was not correctly escaped, then it might not manifest itself frequently in a typical application because the less-than character is seldom used in English prose. OK, but effectively

Re: A critique of cgi.escape

2006-09-27 Thread Jon Ribbens
In article [EMAIL PROTECTED], Gabriel G wrote: By example, I do not validate a page. I validate that all methods that make up pieces of a page, build them the way they should - these are our unit tests. Then, it's up to the templating library to join all the pieces into the final html page.

Re: Computer Language Popularity Trend

2006-09-27 Thread Jon Ribbens
In article [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: http://xahlee.org/lang_traf/index.html Careful there with the sweeping generalizations and quick judgments about languages :) I just read PHP as a language is rather dry and business-like, and fell off my chair. --

Re: CGI - mod_python

2006-10-03 Thread Jon Ribbens
In article [EMAIL PROTECTED], Paul Boddie wrote: it is a kind of nooby question. Is there a way to transfer a CGI python script to mod_python without rewriting the code? Had you used WebStack [1] to begin with, this migration would involve changing a few lines of glue code. Or Jonpy ;-)

Re: Raw strings and escaping

2006-10-03 Thread Jon Ribbens
In article [EMAIL PROTECTED], Matthew Warren wrote: I would expect this to work, rawstring=r'some things\new things\some other things\' But it fails as the last backslash escapes the single quote. String constants in Python are weird - raw strings doubly so. In a raw string, backslashes

Re: Raw strings and escaping

2006-10-03 Thread Jon Ribbens
In article [EMAIL PROTECTED], Duncan Booth wrote: I presume there was originally some reason for this bizarre behaviour - it'd be interesting to know what it is/was, if anyone knows? See the FAQ for the explanation:

Re: 2.5 excitement (was Re: Java Developer Exploring Python)

2006-04-18 Thread Jon Ribbens
In article [EMAIL PROTECTED], Aahz wrote: On that front, I think that pysqlite is much more important because it finally gets rid of the excuse for using Berkeley for simple database purposes. Apologies if I'm being obtuse, but how does including the pysqlite wrapper module change anything?

Re: 2.5 excitement (was Re: Java Developer Exploring Python)

2006-04-19 Thread Jon Ribbens
In article [EMAIL PROTECTED], Chris Lambacher wrote: At least on windows. PySqlite is statically linked with the sqlite library. This can be done because it is quite small. OK, well that makes sense, but why not on any other platform? -- http://mail.python.org/mailman/listinfo/python-list

Re: 2.5 excitement (was Re: Java Developer Exploring Python)

2006-04-19 Thread Jon Ribbens
In article [EMAIL PROTECTED], Fredrik Lundh wrote: Apologies if I'm being obtuse, but how does including the pysqlite wrapper module change anything? You still need to download and install SQLite I'm pretty sure the distributors will do this for you, just as they've included zlib, dbm,

Re: 2.5 excitement (was Re: Java Developer Exploring Python)

2006-04-19 Thread Jon Ribbens
In article [EMAIL PROTECTED], Fredrik Lundh wrote: these days, most end users get their Python either with their OS, or by downloading a prebuilt installer. Oh, ok. I've just never heard such people referred to as the distributors before. It sounds like some sort of TV series! ;-) I guess I

Re: Checking for EOF in stream

2007-02-19 Thread Jon Ribbens
In article [EMAIL PROTECTED], Gabriel Genellina wrote: So this is the way to check for EOF. If you don't like how it was spelled, try this: if data==: break How about: if not data: break ? ;-) -- http://mail.python.org/mailman/listinfo/python-list

Re: multiple content-types break cgi.py

2007-03-04 Thread Jon Ribbens
In article [EMAIL PROTECTED], Janto Dreijer wrote: The Nokia Java SDK allows one to define multiple content-types in a single HTTP header field. I'm not sure if it's standard, but it's happening from some Java-enabled phones. The only reference to this bug I can find dates back to 1999:

Re: multiple content-types break cgi.py

2007-03-04 Thread Jon Ribbens
In article [EMAIL PROTECTED], Janto Dreijer wrote: It's not a bug - sending multiple content-types is just totally broken. What would such a header even be supposed to mean? It's like saying this is an apple orange. Hmmm. Thanks! I suspected as much. Rough inspection suggests that calling

Re: Recommended FastCGI module?

2007-03-07 Thread Jon Ribbens
In article [EMAIL PROTECTED], John Nagle wrote: The JonPy version: http://jonpy.sourceforge.net/fcgi.html Last revised in 2004. I'd recommend my one, but it's just possible I'm not impartial ;-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Recommended FastCGI module?

2007-03-07 Thread Jon Ribbens
In article [EMAIL PROTECTED], John Nagle wrote: Jon Ribbens wrote: The JonPy version: http://jonpy.sourceforge.net/fcgi.html Last revised in 2004. I'd recommend my one, but it's just possible I'm not impartial ;-) Does it work with current Pythons? (2.4, 2.5)? I'm

Re: Database module multithreading

2007-03-10 Thread Jon Ribbens
In article [EMAIL PROTECTED], John Nagle wrote: As for some modules not being maintained, it really is sad that MySQLdb is kind of behind. If you're running Windows and need MySQL, you're either stuck with Python 2.4 Looks like that's changed:

Re: Database module multithreading

2007-03-10 Thread Jon Ribbens
In article [EMAIL PROTECTED], John Nagle wrote: Is the egg packaging gimmick considered mainstream Python, or just some wierd idea from the Peak people? It seems to complicate installation without adding much value. I don't know, but stock Python 2.5 seems to stick mysterious '.egg' files

Re: Database module multithreading

2007-03-11 Thread Jon Ribbens
In article [EMAIL PROTECTED], Gabriel Genellina wrote: I don't know, but stock Python 2.5 seems to stick mysterious '.egg' files in the site-packages directory when you install things. Which stock Python? Not the one from www.python.org... Yes, the one from www.python.org. --

Re: Database module multithreading

2007-03-11 Thread Jon Ribbens
In article [EMAIL PROTECTED], Gabriel Genellina wrote: I don't know, but stock Python 2.5 seems to stick mysterious '.egg' files in the site-packages directory when you install things. Which stock Python? Not the one from www.python.org... Yes, the one from www.python.org. Those .egg must

Re: Watching a file another app is writing

2007-03-12 Thread Jon Ribbens
In article [EMAIL PROTECTED], John Nagle wrote: On Unix a quick shortcut would be to simply read the output of 'tail - f file' command... tail -f just checks the file size once a second. It's not doing anything exciting. That's not actually always true these days. *BSD, at least, use

Flask import problem with Python 3 and __main__.py

2014-08-26 Thread Jon Ribbens
Flask suggests the following file layout: runflaskapp.py flaskapp/ __init__.py runflaskapp.py contains: from flaskapp import app app.run(debug=True) flaskapp/__init__.py contains: from flask import Flask app = Flask(__name__) Running this with 'python3

Re: Flask import problem with Python 3 and __main__.py

2014-08-26 Thread Jon Ribbens
On 2014-08-26, Terry Reedy tjre...@udel.edu wrote: On 8/26/2014 12:03 PM, Jon Ribbens wrote: Flask suggests the following file layout: runflaskapp.py flaskapp/ __init__.py runflaskapp.py contains: from flaskapp import app app.run(debug=True) flaskapp

Re: Flask and Python 3

2014-09-23 Thread Jon Ribbens
On 2014-09-23, Juan Christian juan0christ...@gmail.com wrote: if __name__ == '__main__': app.run(port = 8000) app.run(port=8000, debug=True) might've made the problem easier to find. -- https://mail.python.org/mailman/listinfo/python-list

Lazy-evaluation lists/dictionaries

2014-10-26 Thread Jon Ribbens
I have a need, in a Python C extension I am writing, for lists and dictionaries with lazy evaluation - by which I mean that at least some of the values in the lists/dictionaries are proxy objects which, rather than returning as themselves, should return the thing they are a proxy for when

Re: Lazy-evaluation lists/dictionaries

2014-10-27 Thread Jon Ribbens
On 2014-10-26, Terry Reedy tjre...@udel.edu wrote: On 10/26/2014 10:14 AM, Jon Ribbens wrote: Is there any better way to do this other than simply re-implementing these types from scratch, emulating all their methods and operations? (i.e. using UserList/UserDict). I was under the impression

Re: Lazy-evaluation lists/dictionaries

2014-10-27 Thread Jon Ribbens
On 2014-10-26, Tim Delaney timothy.c.dela...@gmail.com wrote: On 27 October 2014 01:14, Jon Ribbens jon+use...@unequivocal.co.uk wrote: I have a need, in a Python C extension I am writing, for lists and dictionaries with lazy evaluation - by which I mean that at least some of the values

  1   2   3   4   5   6   7   >