Source:
http://testing.isaacg.net/commentboxa/
I've given up on this one. Now that I have an idea of how to make ajax and python pass data I'm going to work on a new version that's uses classes instead of a bunch of try/except conditions, which I think are ugly!
ajax/python commentbox source
ajax/python commentbox source
❉⊱•═•⊰❉⊱•═•⊰❉⊱•═•⊰❉❉⊱•═•⊰❉⊱•═•⊰❉⊱•═•⊰❉❉⊱•═•⊰❉⊱•═•⊰❉⊱•═•⊰❉
-⎽__⎽-⎻⎺⎺⎻-⎽__⎽--⎻⎺⎺⎻-★ ·:*¨༺꧁༺ ༻꧂༻¨*:·.★-⎽__⎽-⎻⎺⎺⎻-⎽__⎽--⎻⎺⎺⎻-
❉⊱•═•⊰❉⊱•═•⊰❉⊱•═•⊰❉❉⊱•═•⊰❉⊱•═•⊰❉⊱•═•⊰❉❉⊱•═•⊰❉⊱•═•⊰❉⊱•═•⊰❉
-⎽__⎽-⎻⎺⎺⎻-⎽__⎽--⎻⎺⎺⎻-★ ·:*¨༺꧁༺ ༻꧂༻¨*:·.★-⎽__⎽-⎻⎺⎺⎻-⎽__⎽--⎻⎺⎺⎻-
❉⊱•═•⊰❉⊱•═•⊰❉⊱•═•⊰❉❉⊱•═•⊰❉⊱•═•⊰❉⊱•═•⊰❉❉⊱•═•⊰❉⊱•═•⊰❉⊱•═•⊰❉
Re: ajax/python commentbox source
uh... yeah, they are meant for exceptions.
try/catch isn't a good substitute for if statements.
try/catch isn't a good substitute for if statements.
Re: ajax/python commentbox source
Use "is None", "is not None" (pointer comparison) instead of "== None", "!= None" (value comparison). None is a singleton object, so this always works, and it is faster and more pythonic.
Use != instead of <>. Note that <> was finally removed in python 3.
can be replaced with:
Use xml.sax.saxutils.escape instead of rolling your own escape function.
looks suspicious. Don't you want something like:
?
You want to use a database some day instead of pickling, but I suspect you already know that.
Use != instead of <>. Note that <> was finally removed in python 3.
Code: Select all
if name == '' or name == None
Code: Select all
if not name:
Code: Select all
{boxname:{date:{name:comment}}}
Code: Select all
{'date': date, 'name': name, 'comment': comment}
You want to use a database some day instead of pickling, but I suspect you already know that.
Re: ajax/python commentbox source
Hmm. This might be a good time to ask.
Is using MySQL database better than saving to textfiles? I mean, so far I've never had a problem with pickling to a text file (man that sounds dirty).
Is using MySQL database better than saving to textfiles? I mean, so far I've never had a problem with pickling to a text file (man that sounds dirty).
❉⊱•═•⊰❉⊱•═•⊰❉⊱•═•⊰❉❉⊱•═•⊰❉⊱•═•⊰❉⊱•═•⊰❉❉⊱•═•⊰❉⊱•═•⊰❉⊱•═•⊰❉
-⎽__⎽-⎻⎺⎺⎻-⎽__⎽--⎻⎺⎺⎻-★ ·:*¨༺꧁༺ ༻꧂༻¨*:·.★-⎽__⎽-⎻⎺⎺⎻-⎽__⎽--⎻⎺⎺⎻-
❉⊱•═•⊰❉⊱•═•⊰❉⊱•═•⊰❉❉⊱•═•⊰❉⊱•═•⊰❉⊱•═•⊰❉❉⊱•═•⊰❉⊱•═•⊰❉⊱•═•⊰❉
-⎽__⎽-⎻⎺⎺⎻-⎽__⎽--⎻⎺⎺⎻-★ ·:*¨༺꧁༺ ༻꧂༻¨*:·.★-⎽__⎽-⎻⎺⎺⎻-⎽__⎽--⎻⎺⎺⎻-
❉⊱•═•⊰❉⊱•═•⊰❉⊱•═•⊰❉❉⊱•═•⊰❉⊱•═•⊰❉⊱•═•⊰❉❉⊱•═•⊰❉⊱•═•⊰❉⊱•═•⊰❉
Re: ajax/python commentbox source
It's many times faster and usually more manageable, but not functionally different.