Harlin Seritt wrote:
> Hi,
>
> How does one get the name of a class from within the class code? I
> tried something like this as a guess:
>
> self.__name__
Get the class first, then inspect its name:
>>> class Foo(object): pass
...
>>> f = Foo()
>>> f.__class__.__name__
'Foo'
>>>
HTH
--
Daniel Nogradi wrote:
(...)
>
> the egg file can not be downloaded completely, the connection is
> closed at byte 138903 all the time and the file is bigger than that.
> If anyone managed to grab the file please let me know so far I tried
> wget and firefox.
I've checked on my hd and found a rece
Daniel Nogradi wrote:
> Does anyone know what has happened to the codebase of the subway
> project? It seems the whole project has been shut down leaving no
> trace of the code on net but I would be very happy to see it,
> apparently it had some cool features that would be fun to look at.
> Does an
cale.LC_ALL, "en-US")
'English_United States.1252'
>>> locale.format("%f", 1, True)
'10,000.00'
>>> locale.format("$%.2f", 1, True)
'$10,000.00'
bye.
--
deelan
http://www.deelan.com/
http://blog.deelan.com/
--
http://mail.python.org/mailman/listinfo/python-list
req.send_http_header()
>req.write('mptest.py\n')
>return apache.OK
>
> Is this code enough for testing?
>
i believe so.
also check this:
"Getting mod_python Working"
<http://www.dscpl.com.au/articles/modpython-001.html>
--
deelan <http://www.deelan.com/>
--
http://mail.python.org/mailman/listinfo/python-list
nverted to mysql's NULL and vice versa. It sounds
you are passing the *string* "None" to mysql, with it isn't
the same thing.
Adapting the Laszlo's example already posted:
cursor.execute("insert into tablename(fieldname) values (%s)", [None])
HTH.
--
deelan, #1
chars will be replaced by ?
also, mysqldb has some support to manage unicode objects directly, but
things changed a bit during recent releases so i cannot be precise in
this regard.
HTH.
--
deelan, #1 fan of adriana lima!
<http://www.deelan.com/>
--
http://mail.python.org/mailman/listinfo/python-list
<http://freshmeat.net/projects/pycaptcha/>
later,
deelan.
--
deelan, #1 fan of adriana lima!
<http://www.deelan.com/>
--
http://mail.python.org/mailman/listinfo/python-list
Konrad Mühler wrote:
> Hi,
>
> a simple question but i found no solution:
>
> How can i convert a float value into a string value?
>
just use the "str" built-in type:
>>> f = 9.99
>>> str(f)
'9.99'
--
deelan, #1 fan of adriana l
m/doc/mysql/en/replace.html>
--
deelan, #1 fan of adriana lima!
<http://www.deelan.com/>
--
http://mail.python.org/mailman/listinfo/python-list
deelan wrote:
(...)
> # optional, get rid of _setup_table symbol
> del _setup_table()
damn copy and paste :) of course i meant:
del _setup_table
--
deelan, #1 fan of adriana lima!
<http://www.deelan.com/>
--
http://mail.python.org/mailman/listinfo/python-list
tup_table()
def translate(text):
return text.translate(TABLE)
HTH,
deelan.
--
deelan, #1 fan of adriana lima!
<http://www.deelan.com/>
--
http://mail.python.org/mailman/listinfo/python-list
nother is to use map:
>>> ''.join(map(chr, (0x73, 0x70, 0x61, 0x6D)))
'spam'
HTH,
deelan.
--
deelan, #1 fan of adriana lima!
<http://www.deelan.com/>
--
http://mail.python.org/mailman/listinfo/python-list
les here:
<http://docs.python.org/lib/httplib-examples.html>
basically you pass auth headers whie
using PUT/DELETE verbs:
## untested! ##
headers = {
"Authorization": authheader # your base 64 str
}
conn.request("PUT", "/your/url/here", body, headers)
HTH,
deelan.
--
dee
have to use setX/getX (shudder)
the pythonic way is to use "property" (as others have already explained)
only when is *stricly necessary*. this may clarify things up:
"Python Is Not Java"
<http://dirtsimple.org/2004/12/python-is-not-java.html>
HTH.
--
deelan <http://
tements.
topic already beated to death, feel
free to browse the group archives:
<http://groups-beta.google.com/groups?q=comp.lang.python+switch+statement>
HTH.
--
deelan <http://www.deelan.com>
--
http://mail.python.org/mailman/listinfo/python-list
please issue a "SHOW VARIBLES" command on the mysql console, there
should be some mention on innodb support somewhere.
2) version of mysqldb you are using
bye.
--
deelan, #1 fan of adriana lima!
<http://www.deelan.com/>
--
http://mail.python.org/mailman/listinfo/python-list
nclude files tied to mysql. the "_mysql" extension will be complied
against such files and then wrapped by python code.
HTH.
--
deelan, #1 fan of adriana lima!
<http://www.deelan.com/>
--
http://mail.python.org/mailman/listinfo/python-list
mysql.c:42:26: mysqld_error.h: No such file or directory
> _mysql.c:43:20: errmsg.h: No such file or directory
> error: command 'gcc' failed with exit status 1
you need mysql-devel package installed to compile the "_mysql" extension.
just look a the release notes:
<ht
;
>>> c
u'\u201c'
>>> c.encode('utf-8')
'\xe2\x80\x9c'
>>> print c.encode('utf-8')
ok, let's try replace
>>> c.encode('latin-1', 'replace')
'?'
using "replace" will not throw an error, but it will replace
the offending characther with a question mark.
HTH.
--
deelan <http://www.deelan.com/>
--
http://mail.python.org/mailman/listinfo/python-list
/05/easyinstall-new-era-in-python-package.html>
HTH.
--
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
<#me> a foaf:Person ; foaf:nick "deelan" ;
foaf:weblog <http://blog.deelan.com/> .
--
http://mail.python.org/mailman/listinfo/python-list
Template(source=t, searchList=[{'image':data}])
>>> T
say that "data" changes, you don't have to compile the template
again, just issue a render command again:
>>> data['img'] = 'BAZ.jpg'
>>> T
see:
<http://cheetahtemplate.org/>
--
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
<#me> a foaf:Person ; foaf:nick "deelan" ;
foaf:weblog <http://blog.deelan.com/> .
--
http://mail.python.org/mailman/listinfo/python-list
columns are returned as strings. columns are returned as
normal strings. Unicode objects will always be encoded to
the connection's character set regardless of this setting.''
--
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
<#me> a foaf:Person ; foaf:nick "deelan" ;
foaf:weblog <http://blog.deelan.com/> .
--
http://mail.python.org/mailman/listinfo/python-list
ect first convert them as unicode with:
u = unicode('Â', 'latin-1')
then feed u to the hammer function (the fix_unicode at the
end).
HTH,
deelan
--
"Però è bello sapere che, di questi tempi spietati, almeno
un mistero sopravvive: l'età di Afef Jnifen." -- dagospia.com
--
http://mail.python.org/mailman/listinfo/python-list
uple parens but a tuple, look:
>>> t = ('1', )
>>> type(t)
if there's no ambiguity you can omit the parens:
>>> t = '1',
>>> type(t)
HTH,
deelan
--
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
<#me> a foaf:Person ; foaf:nick "deelan" ;
foaf:weblog <http://blog.deelan.com/> .
--
http://mail.python.org/mailman/listinfo/python-list
deelan wrote:
which version of MySQLdb are you running? versions
1.1.6 and below gained a connection.autocommit) method set by default
ehm, 1.1.6 and *above*, of course. :)
--
"Però è bello sapere che, di questi tempi spietati, almeno
un mistero sopravvive: l'età di Afef Jnifen."
commit to false is useful when
you wish to do changes in batches and maybe rollback the entire operation
if something went wrong (see commit() and rollback() methods for this).
hope this helps,
deelan.
--
"Però è bello sapere che, di questi tempi spietati, almeno
un mistero sopravvive: l'età di Afef Jnifen." -- dagospia.com
--
http://mail.python.org/mailman/listinfo/python-list
Gary Nutbeam wrote:
(...)
Does anyone know of something similar to Rails or Maypole in Python?
you may want to take a look at subway:
<http://subway.python-hosting.com/>
it glues together cherrypy2, sqlobject
and cheetah using an MVC approach.
HTH,
deelan.
--
http://mail.python.org/m
e what is worng
(B> here?
(B
(Bthe line:
(B
(Bfeed = property(__get_feed) # I wrote this
(B
(Bmakes "feed" a *readonly* attribute.
(B
(Bcheers,
(Bdeelan.
(B
(B--
(B@prefix foaf: <http://xmlns.com/foaf/0.1/> .
(B<#me> a foaf:Person ; foaf:nick "deelan&
fine, you can specify input and output encoding.
cheers,
deelan.
[1] http://dealmeida.net/en/Projects/PyTextile/
--
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
<#me> a foaf:Person ; foaf:nick "deelan" ;
foaf:weblog <http://blog.deelan.com/> .
--
http://mail.python.org/mailman/listinfo/python-list
-0.i386.rpm
are u sure you have compiled mysqldb against 5.0
client libs?
you may want to post on the mysqldb forum of ask
for help there:
<http://sourceforge.net/forum/forum.php?forum_id=70461>
HTH,
deelan
--
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
<#me> a foaf:Person ; foaf:ni
; to avoid
other typical newbie errors:
<http://www.ferg.org/projects/python_gotchas.html>
HTH,
deelan
--
"Vedrai come ti tratteranno le mie TV"
Berlusconi a Follini (Luglio 2004)
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
(...)
Run it and get a name error, which, makes sense.
If I try to use the standard import solution as deelan suggests I have
a circular reference on the imports and I get an error that it can't
import class DataSource (presumbably because it hasn't gotten
[EMAIL PROTECTED] wrote:
I have a variable that I want to make global across all modules, i.e. I
want it added to the builtin namespace. Is there a way to do this?
i would not pollute built-ins namespace.
how about:
### a.py
FOO = "I'm a global foo!"
### b.py
import a
print a.
d can only be
determined if you know how many times it has already been called)
see "python gotchas":
<http://www.ferg.org/projects/python_gotchas.html#bct_sec_5>
bye.
--
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
<#me> a foaf:Person ; foaf:nick "deelan&q
sn't introduce any
new points of failure of complexity.''
you may want to investigate how the UUU guys think to
implememt this in their project.
bye.
--
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
<#me> a foaf:Person ; foaf:nick "deelan" ;
foaf:weblog <http://www.netspyke.com/> .
--
http://mail.python.org/mailman/listinfo/python-list
36 matches
Mail list logo