Domain: modpython.org
Stories and comments across the archive that link to modpython.org.
Comments · 19
-
Re:Really?
PHP's default header is 200 OK. You might be forgiven for setting the content type to text/plain since it didn't emit html, but I suspect that you have to explicitly set html as the content type for your script. mod_python would have been a better "this is how it should be done", even if it hasn't been developed on since 2007. The example there shows how all you have to do is return your HTML as a string. I'd almost bet you could even edit that in dreamweaver and get something halfway usable!
-
Re:Sqlite included!
So you're saying that programming languages should be designed around Microsoft Word? And for the record, I see no reason why you couldn't edit Python code using MS Word. Even if you couldn't, you could just install gvim for Win32 or just dump it into a folder and run it from there (if you don't have admin access to the machine), or use Notepad, or whatever.
You're grasping at straws. So far, you've given me all sorts of reasons why whitespace significance could hypothetically be a problem, but no examples of how it actually is a meaningful problem in real life. I cringed at the thought of Python's whitespace significance when I first used it. I got over it in about a week, because it just isn't a problem.
I have found exactly one scenario where the whitespace handling is a problem: in mod_python Python Server Pages (basically inline-able Python code, like you can do with PHP). Even there, it worked, but I just didn't trust it to be maintainable. On the other hand, most people consider inlining code that way to be bad practice anyway. Furthermore, if you use the more elaborate Spyce intead of mod_python's built-in methanism, you can use braces around blocks anyway.
The bottom line is that I've been using Python, often in a professional capacity, for about 5 years, and the "whitespace issue" has just never been a serious problem, and has been quite helpful for when I've had to debug other people's code. You, so far, haven't convinced me that it can be a real problem, because you haven't given me any real examples of where Python was the wrong choice of language due to the way it handles whitespace.
-
Re:The problem with the alternatives to PHP
Ignoring support by ISP's
That's the #1 issue by far. Even if all the competition were ten times better than PHP, if the average person can only find cheap PHP hosting, that's what they are going to use.
I'm not even aware of where I could find documentation on Python libraries to communicate with MySQL
Seriously? Go to python.org. Scroll down the page to where you see the "Using Python for... databases" link. Click it.
There's another point - Python modules come with help built into them, and Python comes with a help browser. And if you don't want to use that, just load the Python interpreter and run help(module). I don't think PHP has anything similar to that yet.
PHP allows you to inline your code into your documents
So does mod_python.
-
Mod_python has easier syntax
It's hard to get excited about any tool based on Ruby because it inherits so much confusing syntax from Perl. To many programmers, Perl code looks like gibberish, and that's part of the reason it's falling out of favor. I'm afraid the same will happen to Ruby, which is too bad since its strict adherence to object-oriented concepts is admirable.
I much prefer Python and Mod_Python for web programming, since its syntax is cleaner closer to plain English. -
Re:is it time for 2.0.x over 1.3.x?
No, infact, mod_python is only actively developed for Apache 2.0. They don't even support the version for 1.3 anymore.
-
Re:Python binding
I'm working on a project at the moment that's all Javascript on the client side and mod_python (with the very nice Publisher handler on the server. I have a simple Javascript wrapper around XMLHttpRequest for making asynchronous calls to the server (using CPS with Javascript closures as the "continuations") and I just pass all the info back in JSON format, so I can just eval() the returned text.
Surprisingly neat and (very) surprisingly flexible - you can also do stuff like pass back Javascript functions (from the server) along with the data you wish to process.
You can use the Python str() function for the most simple data conversions (eg. an array or a dictionary), but I prefer the pyjsonrpc package which has very nice little objToJson and jsonToObj functions. Better than just using Python's str() function, as it also strips out excess whitespace. I also modified it slightly to also properly convert Python booleans to Javascript booleans (it already handled null to None conversions).
It all works very nicely, a testament to the power of simplicity. The Javascript (client) side just makes requests in response to user actions (eg. button clicks) or other events, and the server responds to those requests with Javascript data (CPS is very well suited to this kind of programming).
Javascript really is a very cool programming language. I've implemented my own python.js library which adds a handful of Python-like functional programming facilities to Javascript (eg. map, filter, reduce) and dictionary/object methods like keys() and values(). It's got to the point now where I sometimes get confused as to whether I'm writing Javascript or Python, because they're so similar in all the ways that really matter.
This kind of web development is quite fun. I also have a nice advantage with the web application I'm working on, as it flat-out can't run on IE (it uses fixed-positioned divs quite extensively, along with a few other standard features that IE can't handle) and so I don't have to worry about compatibility with that fucking mess of a browser. Hooray.
:-) -
mod_python/PSP
You guys discovered mod_python ?
Which now comes with PSP. That is, server side web scripting using
Python as the language. Similar in spirit to PHP, just using Python.
Amazingly much more fun than PHP. -
Mod_Python/PSP is better
Why bother with the inconsistent mess that's called PHP, when you can plug mod_python into Apache. With recent editions you can also write inline python code - just as PHP.
It all tastes better, run faster, is easier to learn and maintain. -
Re:I'll move to 2.0.x when...
mod_python has been on Apache 2.0 for almost 2 years now....
:-) -
python on the desktop, perl at the serverserver side
There's one thing that I dont see on the list (Mod python). But I think that even with MP's inclusion, Python lacks the depth and quality of CPAN for web server integration. There is no simply no comparable resouce for usable tested code in Python like Perls CPAN.
client sidePython integrates into gui's better. This something (currently) where perl sucks really (being embedded). Python also runs on windows extremely well. This is somthing Perl via Activestate tries but has yet to pull off. For some everything requires a hammer. For me it's python on the desktop, perl at the server.
-
PHP
the PHPs will not give up Outlook and PowerPoint untill there is a superior linux analog.
Are you talking about PHP 3 or PHP 4? Either way, I prefer mod_python for my server-side scripts. -
Re:DARPA "funded" !? SETI @ HomeIf they could just find a way to tap into _that_ enthusiasm.
Ah give me a break!
As someone who has written open source software, I can tell you that there is no enthusiasm that you "tap into".
When you are an agency that is part of a department of the government whose budget is in the billions (or is it trillions?), no sane "enthusiast" is going to do jack for you for "appreciation", especially when you are a military organization...
But even if this wasn't DOD we were talking about, I find the assumption that people will perform valuable services for simple recognition just plain weird. People who think this way just don't get it - you want someone to do something for you, you pay for it.
When I feel like releasing code to the public is a good idea, I will do it, but don't think that I am some sort of an OSS monkey who jumps at every opportunity to work for free!
-
Re:People would contribute if Perl 6 was on trackOn the contrary, the Parrot runtime engine is reasonably complete, and useful.
Just to give one current, more or less viable Parrot application that I know of, the virtual machine been embedded as mod_parrot , which can in principle allow you to run Parrot bytecode in Apache. Why would anyone want to write web applications in what amounts to assembly code? Well of course, most people wouldn't, but as Perl6 matures this could become a viable competitor to mod_perl
...and mod_python , mod_tcl , mod_scheme , etc.More to the point, the development of Parrot has forced a cleanup of the Perl API. The current situation where the reference implementation is the only implementation has never been theoretically clean -- other languages, like Python, C, and Java, have long had multiple implementations, and this has consistently been a healthy thing for the evolution of the language. Abstracting out the virtual machine layer will allow Perl6 to have a pluggable runtime layer (e.g. replace runtime compilation & execution of bytecode into, say, dynamic execution of precompiled bytecode (as Python does), or direct compilation from source to executable machine code (as C does). More recently & concretely, abstracting out the VM layer has been the motivation for Ponie -- an effort to re-implement Perl5 to run on Parrot, and in the process give Perl that abstracted alternate implementation that most other languages have. This will be a very healthy thing, both for Perl5 and for Perl6.
If there has been a dropoff in contributions, it isn't due to Parrot work. Dan Sugalski et al have done excellent work here, and I think most people in the community recognize this. If there has been a dropoff, the much more mundane explanation is probably just the taking economy: a whole lot of people just don't have the spare cash to give these days.
-
Re:mod_python and threading
According to the mailing lists, it seems like threading will work with apache 1.3 as well, you just need to use Python 2.2.1. See this message. Since one of the requirements for mod_python 3.0 is Python 2.2.1, it seems reasonable to assume that this is the reason it works with Apache 2.0 as well...
-
Re:Boa vs. Apache?The best web (and not only web) servers with Python support:
- Zope - good scalability;
- 4Suite - not clear;
- Apache mod_python - the best scalable thanks to Apache;
-
Mod Python?
Anyone got a big site running on mod_python or mod_snake? Care to post some stats?
Thanks!
Alex. -
Re:(at the risk of starting a flame war:-) Pythonnot so on Apache.
PyApache is what I use, no troubles with Apache 1.3.14 and Python 1.6; hackable.
Mod_Python which is closer to mod_perl in philosophy, I think.
Mod_Snake which is kinda like the same thing only different.
The latter two projects don't offer me enough enhancements to make me switch from PyApache yet; so I haven't as much experiance with them. PyApache has the feel of a defunct project, I haven't heard of any efforts to make it work with (Apache|Python) 2.0+
Just to keep this from being completely offtopic, Obfuscated Python is possible. AMK's ARC4 in python is a good example. If you're feeling particularly evil you can do really nasty things by mixing tabs and spaces and taking advantage of the fact that indentation need not be constant throught a file (this block @ 3, next @ 5, one after that at 4, etc.)
-
Re:Python web tools?
Zope is usually run as a long-running process that's accessed through either Persistent CGI or FastCGI (though the FastCGI was still unstable when I tried it). A FastCGI module is also available if you just want to run regular CGI scripts a bit faster, and mod_python is available as an Apache module.
-
What's wrong with Slashdot?
Damn, 8 hours ago I submit a story about Perl Methods being added to Zope and about the release of mod_python 2.1 and it gets rejected??
What's wrong with Slashdot, ain't these the news for programmers? Another story by me which was also rejected was that Motif interview... and then 2 weeks pass and I finally read it on Slashdot.
I wonder how much do the Slashdot editors understand of programming. Why not showing the names of those who reject the stories? Anyway that was the last story I've sent.
Alex
--