1 |
Hi -- |
2 |
|
3 |
I really hope that one day the world will forget about CGIs and never look back. |
4 |
This is probably my own opinion, although I'm relatively sure that others feel |
5 |
the same way. There are many better technologies for web based applications, |
6 |
I've listed many of them before. One of the best (but alas, poorly documented |
7 |
and hard to learn) is Woven from Twistedmatrix.com . Using a python web |
8 |
application framework would "only require python", if you did just a little bit |
9 |
of hacking you could bring just the parts of Twisted needed for Woven (or some |
10 |
other python web framework). |
11 |
|
12 |
You seem to have good knowledge of Python, but have you looked into other Python |
13 |
web technologies other than the tried and true but antiquated and limited CGI? |
14 |
|
15 |
One thing woven will allow you to have is have complete separation of code and |
16 |
display (MVC again). |
17 |
|
18 |
Code sections such as: |
19 |
|
20 |
def page_header(title): |
21 |
print "Content-Type: text/html" |
22 |
print |
23 |
print |
24 |
print '<html><head>' |
25 |
print '<title>',title,'</title>' |
26 |
print '</head><body>' |
27 |
|
28 |
|
29 |
Don't allow for easy expansion of webportage's look/feel. Following the |
30 |
model-view-controller design pattern the "view" would be completely abstracted |
31 |
into templates which are expanded based on how the other two facets of MVC |
32 |
interact. |
33 |
|
34 |
Currently you are using a hacked up version of portage that also hard codes HTML |
35 |
into print statements, in my opinion your search class needs to have an extra |
36 |
layer in between it and portage, so it'll be able to expand when portage |
37 |
changes. |
38 |
|
39 |
For example when you initialise the search class: |
40 |
|
41 |
def __init__ (self, ...): |
42 |
|
43 |
self.portageInterface = PortInterface() |
44 |
|
45 |
And all interaction with portage would be "proxyed" through your interface, |
46 |
i.e. a line line: |
47 |
|
48 |
full_package=portage.best(portage.portdb.xmatch("match-all",match)) |
49 |
|
50 |
Would be translated to: |
51 |
|
52 |
full_package=self.portageInterface.best(self.portageInterface.xmatch("match-all",match)) |
53 |
|
54 |
Using an interface intelligently could mean that in the future the only thing |
55 |
you would have to changed would be how the interface actually interacts with |
56 |
portage. |
57 |
|
58 |
I hope I've provided some good ideas that aren't to obvious or useless :-) -- I |
59 |
think the idea of a web interface to portage is really cool, I'd like to see |
60 |
webportage come to fruition but making good decisions on design now will help it |
61 |
be much more successful in the future. |
62 |
|
63 |
Toodles. |
64 |
|
65 |
-- Jason (Aether) |
66 |
|
67 |
|
68 |
On 21:03 Tue 25 Nov , Benjamin Judas wrote: |
69 |
> Hi folks, |
70 |
> |
71 |
> I withdrawed from my original idea in using Apache itself as the |
72 |
> CGI-Platform for WebPortage and implemented a small webserver in Python. |
73 |
> It simply does nothing as calling index.html in the actual directory and |
74 |
> handle all traffic. |
75 |
> |
76 |
> I did this since: |
77 |
> |
78 |
> 1. |
79 |
> The CGI'fied portage scripts have to run as a privileged user - this can |
80 |
> be realized by making one little change to CGIHTTPServer.py (included in |
81 |
> the Python-Distribution) |
82 |
> |
83 |
> 2. |
84 |
> There would be no need to install Apache. WebPortage only needs Python |
85 |
> which is needed by Portage and thus installed on every Gentoo-System. |
86 |
> |
87 |
> If you want to try it, simply decompress the .tar.bz2-File and run the |
88 |
> server with: python server.py. The server will listen on Port 8001 (see |
89 |
> source-code of server.py) on localhost. |
90 |
> |
91 |
> Remember, there's no authentification at the moment. If you start it |
92 |
> everybody can access your lokal portage using a simple web-browser. |
93 |
> Please be careful when trying it. |
94 |
> |
95 |
> In this version you can do only two things : searching for packages and |
96 |
> syncing portage tree. The output of emerge sync still needs to be |
97 |
> beautified and there is no output until wpsync.py (the CGI-script |
98 |
> responsible for syncing) is completely done, so it's possible that your |
99 |
> browser is saying "Transferring data from localhost..." for 10 Minutes |
100 |
> ;) This will be fixed somewhere in the future. |
101 |
> |
102 |
> The tar.bz2 File is available here: |
103 |
> www.judas-merlau.de/downloads/webportage-0.1-alpha1.tar.bz2 |
104 |
> |
105 |
> Feedback is Welcome :) |
106 |
> |
107 |
> Regards |
108 |
> Benjamin "beejay" Judas |
109 |
> -- |
110 |
> GPG-Public-Key: |
111 |
> http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xC31DEDD8 |
112 |
> |
113 |
> Key-Fingerprint: |
114 |
> 4E65 AAFE 785B 61D8 E4D9 1671 E017 87B7 C31D EDD8 |
115 |
> |
116 |
> ICQ: 239829549 |
117 |
> Jabber:beejay@×××××××××.de |
118 |
|
119 |
-- |
120 |
-------------------------~ |
121 |
----------Jason-A-Mobarak-~ |
122 |
-aether-at-gentoo-dot-org-~ |
123 |
-------------------------~ |
124 |
|
125 |
|
126 |
-- |
127 |
gentoo-dev@g.o mailing list |