Hi --
I really hope that one day the world will forget about CGIs and never look back.
This is probably my own opinion, although I'm relatively sure that others feel
the same way. There are many better technologies for web based applications,
I've listed many of them before. One of the best (but alas, poorly documented
and hard to learn) is Woven from Twistedmatrix.com . Using a python web
application framework would "only require python", if you did just a little bit
of hacking you could bring just the parts of Twisted needed for Woven (or some
other python web framework).
You seem to have good knowledge of Python, but have you looked into other Python
web technologies other than the tried and true but antiquated and limited CGI?
One thing woven will allow you to have is have complete separation of code and
display (MVC again).
Code sections such as:
def page_header(title):
print "Content-Type: text/html"
print
print
print '<html><head>'
print '<title>',title,'</title>'
print '</head><body>'
Don't allow for easy expansion of webportage's look/feel. Following the
model-view-controller design pattern the "view" would be completely abstracted
into templates which are expanded based on how the other two facets of MVC
interact.
Currently you are using a hacked up version of portage that also hard codes HTML
into print statements, in my opinion your search class needs to have an extra
layer in between it and portage, so it'll be able to expand when portage
changes.
For example when you initialise the search class:
def __init__ (self, ...):
self.portageInterface = PortInterface()
And all interaction with portage would be "proxyed" through your interface,
i.e. a line line:
full_package=portage.best(portage.portdb.xmatch("match-all",match))
Would be translated to:
full_package=self.portageInterface.best(self.portageInterface.xmatch("match-all",match))
Using an interface intelligently could mean that in the future the only thing
you would have to changed would be how the interface actually interacts with
portage.
I hope I've provided some good ideas that aren't to obvious or useless :-) -- I
think the idea of a web interface to portage is really cool, I'd like to see
webportage come to fruition but making good decisions on design now will help it
be much more successful in the future.
Toodles.
-- Jason (Aether)
On 21:03 Tue 25 Nov , Benjamin Judas wrote:
> Hi folks,
>
> I withdrawed from my original idea in using Apache itself as the
> CGI-Platform for WebPortage and implemented a small webserver in Python.
> It simply does nothing as calling index.html in the actual directory and
> handle all traffic.
>
> I did this since:
>
> 1.
> The CGI'fied portage scripts have to run as a privileged user - this can
> be realized by making one little change to CGIHTTPServer.py (included in
> the Python-Distribution)
>
> 2.
> There would be no need to install Apache. WebPortage only needs Python
> which is needed by Portage and thus installed on every Gentoo-System.
>
> If you want to try it, simply decompress the .tar.bz2-File and run the
> server with: python server.py. The server will listen on Port 8001 (see
> source-code of server.py) on localhost.
>
> Remember, there's no authentification at the moment. If you start it
> everybody can access your lokal portage using a simple web-browser.
> Please be careful when trying it.
>
> In this version you can do only two things : searching for packages and
> syncing portage tree. The output of emerge sync still needs to be
> beautified and there is no output until wpsync.py (the CGI-script
> responsible for syncing) is completely done, so it's possible that your
> browser is saying "Transferring data from localhost..." for 10 Minutes
> ;) This will be fixed somewhere in the future.
>
> The tar.bz2 File is available here:
> www.judas-merlau.de/downloads/webportage-0.1-alpha1.tar.bz2
>
> Feedback is Welcome :)
>
> Regards
> Benjamin "beejay" Judas
> --
> GPG-Public-Key:
> http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xC31DEDD8
>
> Key-Fingerprint:
> 4E65 AAFE 785B 61D8 E4D9 1671 E017 87B7 C31D EDD8
>
> ICQ: 239829549
> Jabber:[EMAIL PROTECTED]
--
-------------------------~
----------Jason-A-Mobarak-~
-aether-at-gentoo-dot-org-~
-------------------------~
--
[EMAIL PROTECTED] mailing list