ust by changing content type from text/html to application/xml+xhtml.
(Quite a positive surprise, to me)
A big "Thank you!" goes to those who helped me find the source of the
problem.
--
Kind regards,
Jan Danielsson
--
http://mail.python.org/mailman/listinfo/python-list
when it is not the proper thing to do. Is it possible to
force ElementTree to output the XHTML code I need it to?
--
Kind regards,
Jan Danielsson
--
http://mail.python.org/mailman/listinfo/python-list
to make the python script load
the images and style sheets.. A solution which I find to be particularly
ugly. :-)
Any mod_python users out there with any other solutions?
--
Kind regards,
Jan Danielsson
--
http://mail.python.org/mailman/listinfo/python-list
Jan Danielsson wrote:
>If have an element tree representing an XML document, and I load
> another tree from a file, is there an easy way to stick the second tree
> into the first one?
>
>fooElement = ET.SubElement(...)
>
>tree = ET.parse(TEMPLDIR +
stick elem as a subelement of fooElement. Do I need to
traverse the elem tree manually, or is there a way to just 'stick it in
there'?
--
Kind regards,
Jan Danielsson
--
http://mail.python.org/mailman/listinfo/python-list
= ET.SubElement(p, 'br')
>
> In [7]: br.tail = '2000-01-01'
>
> In [8]: ET.dump(p)
> Current date:2000-01-01
That did the trick. Thanks!
--
Kind regards,
Jan Danielsson
--
http://mail.python.org/mailman/listinfo/python-list
Hello all,
This is probably a mind numbingly brain dead question.. But how do I
generate the following:
Current date:2000-01-01
..using ElementTree? The element kind of needs two text blocks,
as far as I can tell?
--
Kind regards,
Jan Danielsson
--
http://mail.python.org/mailman
XML anyway.
Yeah, I checked the specs, and found a '?' there (but not where I
expected it to be). I just checked the first mention of the "header",
and didn't see it marked as optional.
However, I want it to be there, simply because it feels better. I'll
check lx
s the case).
--
Kind regards,
Jan Danielsson
--
http://mail.python.org/mailman/listinfo/python-list
with a
"flatter" one). OTOH, I just went to an (Am.) English school my first
school year, and language is not one of my fields of interest. So I'll
just shut up and go away.
--
Kind regards,
Jan Danielsson
--
http://mail.python.org/mailman/listinfo/python-list
XML. If you want to make XML out of something which isn't XML,
you'll probably have to be a little more specific about how this other
format works.
--
Kind regards,
Jan Danielsson
--
http://mail.python.org/mailman/listinfo/python-list
Jan Danielsson wrote:
[---]
Never mind. Cookie objects have a "value" attribute -- that's what I
was doing wrong.
--
Kind regards,
Jan Danielsson
And now a word from our sponsor --
Want to have instant messaging, and chat rooms, and discussion
string containing "blah"?
I can get this to work, by doing this:
cookies = Cookie.get_cookies(req)
c = str(cookies['sessId']).split('=', 1)
...then use c[1]. Is that the proper way? Seems kind of strange to
store the cookies in a di
--
If anyone has any hints or tips.. Please share them.
--
Kind regards,
Jan Danielsson
--
http://mail.python.org/mailman/listinfo/python-list
Hello all,
I writing an application based on the SimpleXMLRPCServer class. I
would like to know the IP address of the client performing the RPC. Is
that possible, without having to abandon the SimpleXMLRPCServer class?
--
Kind regards,
Jan Danielsson
--
http://mail.python.org/mailman
Yesterday I found another module which I fell in love with: Python
Cryptography Toolkit (http://www.amk.ca/python/writing/pycrypt/).
It's just so ... elegant, and functional.
--
Kind regards,
Jan Danielsson
--
http://mail.python.org/mailman/listinfo/python-list
form independent?
Mostly..
> What
> is the best way?And how long would it take before I can develop
> applications using python?
Depends on your learning skills, and what kind of applications we're
talking about.
--
Kind regards,
Jan Danielsson
And now a word from o
ely look at for ideas).
Is there any Python/web community site anywhere which allows users to
upload template code for others to use?
Note: I am a Python newbie, so there are probably lots of
improvements to be done, if anyone cares enough).
--
Kind regards,
Jan Danielsson
--
http://
a MySQL question. Or even a generic database
design question. I would suggest you try asking in a more appropriate forum.
--
Kind regards,
Jan Danielsson
--
http://mail.python.org/mailman/listinfo/python-list
stFunction(foo=None):
pass
---
..is not.
Is this by design? Is it possible to get doxygen to include
standalone functions?
--
Kind regards,
Jan Danielsson
--
http://mail.python.org/mailman/listinfo/python-list
ly if you want to create a set, avoiding the list
> creation:
>
> newlist = set(int(e[0]) for e in mylist)
...completely avoiding the design issue I raised altogether. Thanks!
Exactly what I was hoping for! :-)
--
Kind regards,
Jan Danielsson
--
http://mail.python.org/mailman/listinfo/python-list
cond one is more appealing, when I think in terms of
risk of memory fragmentation, etc. But since Python is such a high level
language, I'm not sure my traditional reasoning applies.
--
Kind regards,
Jan Danielsson
--
http://mail.python.org/mailman/listinfo/python-list
Kind regards,
Jan Danielsson
--
http://mail.python.org/mailman/listinfo/python-list
return the image data, like so:
def barchart(req, params):
some_format = matplotlib.generate_fancy_graph(params)
png_buf = make_png_buffer(some_format)
return png_buf
Is this possible? If so -- how?
--
Kind regards,
Jan Danielsson
And now a word from our sponsor
ow could I make full use of an SMP system?".
I would never claim that multithreading is *easier* than
singlethreaded. It's mererly a different way of thinking.
OTOH, multithreaded does have a steeper learning curve. But once you
get past that, there's really not a lot of d
o extract week numbers from a date.
>
> .isocalendar()
.thanks()
--
Kind regards,
Jan Danielsson
--
http://mail.python.org/mailman/listinfo/python-list
functions in Python to extract week numbers from a date.
--
Kind regards,
Jan Danielsson
And now a word from our sponsor --
For a quality usenet news server, try DNEWS, easy to install,
fast, efficient and reliable. For home servers or carrier class
installations with m
Jan Danielsson wrote:
> Hello all,
>
>I'm writing a python script which fetches a HTML-page (using wget),
> and then parses the retrieved page using a custom htmllib HTMLParser.
>
>The page I fetch is encoded in utf8, and my text-handler currently
> lo
ption:
self.currentName = text
However, I would like to convert the "text" (which is utf8) to
latin-1. How do I do that? I've been trying to figure it out for some
time now, and I'm just getting frustrated. :-(
--
Kind Regards,
Jan Danielsson
Te audire non possum. M
have a working example? A simple insertion, and a
simple select is all I'm looking for.
--
Kind Regards,
Jan Danielsson
Te audire non possum. Musa sapientum fixa est in aure.
--
http://mail.python.org/mailman/listinfo/python-list
but redirects its output to its own
input, and reads it line by line.
I would normally have done it like this:
$ tcpdump -nelttt pflog0 | mypythonscript.py
...however, the Perl script solution looks interresting.. Is it
possible to do something like that in Python?
--
Kind Regards,
Jan Danie
ply written a setText() method, but imho properties
are neater - but that's just a matter of opinion.
--
Kind Regards,
Jan Danielsson
Te audire no possum. Musa sapientum fixa est in aure.
--
http://mail.python.org/mailman/listinfo/python-list
Java
does), but what do I need to do to support it, and how does it work?
--
Kind Regards,
Jan Danielsson
Te audire no possum. Musa sapientum fixa est in aure.
--
http://mail.python.org/mailman/listinfo/python-list
tried searching for it, but could only find UTF/Unicode-related
information. Is it in the normal python documentation?
Semi-Offtopic: The "search" facility in the Python help has stopped
functioning for me (I'm using XP on this system). No matter what I
search for, I get no resul
Robert Kern wrote:
[---]
>> Hmm... On second thought, I need to escape more characters.
>>
>> Is there no other way to escape characters in strings?
>
> Which characters?
I need to escape '\n', '"', '[' and ']'. I finally went with a few of
these:
string.replace('\n', '\\n')
string.replace('"'
Jan Danielsson wrote:
>>In [3]: s.encode('string_escape')
>>Out[3]: 'Hello\\nWorld!'
>>
>>In [4]: Out[3].decode('string_escape')
>>Out[4]: 'Hello\nWorld!'
>>
>>Not *quite* what you asked for, but it ought to be close
Robert Kern wrote:
[---]
> In [3]: s.encode('string_escape')
> Out[3]: 'Hello\\nWorld!'
>
> In [4]: Out[3].decode('string_escape')
> Out[4]: 'Hello\nWorld!'
>
> Not *quite* what you asked for, but it ought to be close enough.
That'll do just fine. Many thanks!
--
http://mail.python.org/mailman/
Hello,
I'd like to encode the string that outputs:
Hello
World!
to 'Hello\x0aWorld!', and the string that outputs:
Hello\World!
to 'Hello\\World!'.
Obviously, I want to be able to reverse the process.
I'm going to assume this has already been solved in Python.. But how?
--
http://mail.pytho
Will McGugan wrote:
[---]
> You should use the keycode constants.
>
> http://www.wxwidgets.org/manuals/2.6.1/wx_keycodes.html#keycodes
[---]
Excellent! Thanks!
--
http://mail.python.org/mailman/listinfo/python-list
Dark Cowherd wrote:
[---]
> In case you are interested in bug report.
Always!
> class LineTool
> method OnLeftUp
> needs
> self.done = True
>
> or else if you are in Line mode and you just click with out moving the
> mouse you get an error.
Many thanks; I can't believe I hadn't stumbled a
Hello all,
I have written my first Python application (apart from small test
programs). It's a (distibuted) white board application. I'm going to
assume that there already are a thousand of them, written in Python, but
just in case someone would find it useful:
http://user.it.uu.se/~jada3673/a
Hello all,
I have written a simple whiteboard application. In my application, I
want to be able to set draw attributes. This part works. I have a
dictionary object which contains stuff like:
self.attr['Pen.Color'] = ...
self.attr['Pen.Thickness'] = ...
Now, the problem is that I want to be
Hello all,
How do I find out if a blocking socket has data available [for
reading] on it?
I assume I could do something like this:
tmp = self.read(1, socket.MSG_PEEK)
if len(tmp) > 0:
# Data available
But is there a better way? A call which specifically checks if data
is available?
--
Hello all,
How do I make a python script actually a _python_ in unix:ish
environments?
I know about adding:
#!/bin/sh
..as the first row in a shell script, but when I installed python on
a NetBSD system, I didn't get a "python" executable; only a "python2.4"
executable.
Adding "#!/usr/
Hello all,
I recently started using Python, and I must say I like it. Both the
language and libraries available for it.
Background: I have written an application which I use to keep track
of my personal economy. I wrote it in Java because I wanted to learn the
language for a course in progr
Robert Kern wrote:
>> [---]
>>
>>> It's okay. Just about every Pythonista in the sciences has, at one time
>>> or another, started a plotting library. It's a rite of passage. Welcome
>>> to the club. :-)
>>
>>
>>Question: I need to install SciPy in order to use matplotlib,
>
> No you don't.
Robert Kern wrote:
[---]
> It's okay. Just about every Pythonista in the sciences has, at one time
> or another, started a plotting library. It's a rite of passage. Welcome
> to the club. :-)
Question: I need to install SciPy in order to use matplotlib, but on
the download page I see that ther
Robert Kern wrote:
>>I wanted to plot some statistics, so I wrote a simple wxPython class
>> to do it. Then I realized that I would like to draw bar graphs, so I
>> added that too.
>>
>>Since I'm a complete Python newbie, I haven't done much of it the
>> "Python way", I suspect. So, I'm won
Hello all,
I wanted to plot some statistics, so I wrote a simple wxPython class
to do it. Then I realized that I would like to draw bar graphs, so I
added that too.
Since I'm a complete Python newbie, I haven't done much of it the
"Python way", I suspect. So, I'm wondering if someone would
Sorry, but I Just Don't Get It. I did search the 'net, I did read the
FAQ, but I'm too dumb to understand.
As far as I can gather, __str__ is just a representation of the
object. For instance:
class ServerConnection:
def __str__(self):
buf = "Server: " + self.name + "\n"
buf +
Gary Herron wrote:
[---]
>> I just tried typing the above in Python, and it - obviously - doesn't
>> work, so it must be some other syntax.
>>
>>
> Not with tuples, lists or dictionaries. However a more recent addition
> to the language is Sets, and they support set differences:
>
from s
Hello all,
I'm 100% sure that I saw an example which looked something like this
recently:
>>> a=(1, 2, 3, 4, 5, 6)
>>> b=(2, 3, 6)
>>> a - b
(1, 4, 5)
The only new language I have been involved in lately is Python. Is my
memory failing me, or have I seen such an Python-example somewhere? I
Grant Edwards wrote:
>>In C, I would do this:
>>
>>server.invalidUntil = time(NULL) + 5*60; // five minute delay
>
> In Python, I would do this:
>
> server.invalidUntil = time.time() + 5*60 # five minute delay
Ah. Well. Um. I feel like an idiot. I found datetime by accident, and
thought "it
Hello all,
I have a list of servers which an application connects to. If the
connection fails, the application should mark the server as temporarily
unavailable, and should try to use the server again after x units of time.
In C, I would do this:
server.invalidUntil = time(NULL) + 5*60; // fi
Grant Edwards wrote:
Is there any way to create a file with a specified size?
>>>
>>>What do you want to put in the file? Once you've answered that
>>>question, the solution should present itself.
>>
>>Check blocks from an FEC-encoder (Freenet, more specifically).
>>
>> The problem is tha
Erik Max Francis wrote:
>>Is there any way to create a file with a specified size?
>
> What do you want to put in the file? Once you've answered that
> question, the solution should present itself.
Check blocks from an FEC-encoder (Freenet, more specifically).
The problem is that the des
Hello all,
Is there any way to create a file with a specified size?
--
http://mail.python.org/mailman/listinfo/python-list
Hello all,
I have a list of integers:
q = [ 1, 2, 4, 7, 9 ]
which I would like to convert to a string:
"1,2,4,7,9"
This is *very* easy to do with a simple while loop.. But I suspect
that there is a more elegant way to do it in Python. Is there? If so: How?
--
http://mail.python.org/mailman
Hello all,
Behold:
--
a = [ 'Foo', 'Bar' ]
b = [ 'Boo', 'Far' ]
q = [ a, b ]
print q[0][0]
print q[1][1]
a[0] = 'Snoo'
b[1] = 'Gnuu'
print q[0][0]
print q[1][1]
--
This will output:
Foo
Far
Snoo
Gnuu
I assume it does so because q stores _references_ to a and b. How
would d
Reinhold Birkenfeld wrote:
[---]
>>How would I go about doing that in Python?
>
> I think you will want to create a threading.Lock object.
It would seem so. Thanks for the tip!
--
http://mail.python.org/mailman/listinfo/python-list
In OS/2 C, I would do this:
main()
{
...
DosCreateMutexSem(NULL, &hmtx, 0UL, FALSE);
...
}
thread()
{
...
DosRequestMutexSem(hmtx);
Locked!
DosReleaseMutexSem(hmtx);
...
}
How would I go about doing that in Python?
I figured this part out:
lockobj = mutex()
lockobj.lock(foo, "bar")
Locked!
61 matches
Mail list logo