default data updates

This commit is contained in:
david 2002-07-04 08:53:07 +00:00
parent df9f2ec6fe
commit d54a985178
6 changed files with 20 additions and 156 deletions

View File

@ -1,136 +0,0 @@
#!/usr/bin/python
import os # Import required modules
import sys
import stat
import string
import commands
import StringIO
import shutil
import StringIO
import CGIHTTPServer
from Config import config
from Log import log
from HTML import page_factory
from Globals import VERSION
from URLParse import URI
#BaseClass = BaseHTTPServer.BaseHTTPRequestHandler
BaseClass = CGIHTTPServer.CGIHTTPRequestHandler
class RequestHandler(BaseClass):
"""
Intercepts the HTTP requests and serves them.
"""
def do_GET(self):
fd = self.send_head()
if fd:
shutil.copyfileobj(fd, self.wfile)
fd.close
def do_HEAD(self):
fd = self.send_head()
fd.close()
def send_head(self):
"""
Send the requested page
"""
uri = URI(self.path)
print uri.path
print uri.filename
filename = config.file_dir + uri.path + '/' + uri.filename
filename = filename.replace('//','/')
log(3, 'looking for file ' + filename)
if os.path.isfile(filename):
return self.send_File(filename)
log(3, 'Sending dynamic page')
return self.send_HTML(page_factory.page(self.path))
def send_HTML(self, HTML):
"""
Send the passed HTML page.
"""
self.send_response(200)
self.send_header("Content-type", "text/html")
self.send_header("Content-length", len(HTML))
self.end_headers()
return StringIO.StringIO(HTML)
def send_File(self, filename):
"""
Send the requested file.
"""
log(3, 'Sending file ' + filename)
temp = string.split(filename, ".")
if len(temp) > 1:
fileext = temp[1]
else:
if os.path.isfile(filename + ".png"):
fileext = "png"
elif os.path.isfile(filename + ".jpeg"):
fileext = "jpeg"
if os.path.isfile(filename + ".jpg"):
fileext = "jpg"
if os.path.isfile(filename + ".gif"):
fileext = "gif"
if fileext:
filename += "." + fileext
# Determine mimetype from extension
if fileext == "html" or fileext == "htm":
mimetype = "text/html"
elif fileext == "png":
mimetype = "image/png"
elif fileext == "gif":
mimetype = "image/gif"
elif fileext == "jpg" or fileext == "jpeg":
mimetype = "image/jpeg"
elif fileext == "css":
mimetype = "text/css"
else:
mimetype = "text/plain"
fd = open(filename, 'r')
filesize = os.fstat(fd.fileno())[stat.ST_SIZE]
self.send_response(200)
self.send_header("Content-type", mimetype)
self.send_header("Content-length", filesize)
self.end_headers()
return fd
def send_Text(self, text):
"""
Send a text message.
"""
self.send_response(200)
self.send_header("Content-type", "text/plain")
self.send_header("Content-length", len(text))
self.end_headers()
return StringIO.StringIO(text)
def WebServer():
"""
Initialize the server.
"""
interface = config.interface
port = config.port
print "Lampadas " + VERSION + " -- development version!"
if interface != '':
print '(Listening on interface %s, port %s)' % (interface, port)
else:
print '(Listening on all interfaces, port %s)' % port
# server = BaseHTTPServer.HTTPServer((interface, port), RequestHandler)
server = CGIHTTPServer.BaseHTTPServer.HTTPServer((interface, port), RequestHandler)
server.serve_forever()
if __name__ == '__main__':
WebServer()

View File

@ -1,5 +1,5 @@
insert(strproject, [Das Linux-Documentations-Projekt])
insert(strprojectshort, [Das LDP])
insert(strproject, [PROJECT])
insert(strprojectshort, [PROJ])
insert(strhome, [Inhaltsverzeichnis])
insert(strdoctable, [DocTable])
insert(strdocdetails, [Dokumentdetails])

View File

@ -1,5 +1,5 @@
insert(strproject, [Le Linux Documentation Project])
insert(strprojectshort, [Le LDP])
insert(strproject, [PROJECT])
insert(strprojectshort, [PROJ])
insert(strhome, [Racine])
insert(strdoctable, [Table des documents])
insert(strdocdetails, [Détails du Document])

View File

@ -1,15 +1,15 @@
insert(getting_started, [Getting Started], [])
insert(switching, [Switching from Other Operating Systems], [])
insert(distributions, [Distributions], [])
insert(installation, [System Installation], [])
insert(kernel, [Kernel], [])
insert(booting, [Boot Loaders and Booting the OS], [])
insert(parallel_processing, [Parallel Processing], [])
insert(partitions_filesys, [Partitions and Filesystems], [])
insert(raid, [RAID], [])
insert(printing, [Printing], [])
insert(shells, [Shells], [])
insert(misc_linux, [Miscellaneous], [])
insert(getting_started, [Getting Started], [Information of use to people who are just getting started with Linux.])
insert(switching, [Switching from Other Operating Systems], [Information for people using who are used to other operating systems.])
insert(distributions, [Distributions], [Information about individual vendors\' distributions, such as Red Hat, SuSE, Debian, and others.])
insert(installation, [System Installation], [Information about installing your Linux system.])
insert(kernel, [Kernel], [Information about the Linux kernel, the core of the Linux OS.])
insert(booting, [Boot Loaders and Booting the OS], [Information about how your Linux system boots.])
insert(parallel_processing, [Parallel Processing], [Information about multiprocessor systems.])
insert(partitions_filesys, [Partitions and Filesystems], [Information about Ext2, Ext3, JFS, XFS, ReiserFS and other filesystems.])
insert(raid, [RAID], [Information about RAID (Redundant Array of Inexpensive Disks) disk subsystems.])
insert(printing, [Printing], [Information about LPD, CUPS, and other UNIX printing systems.])
insert(shells, [Shells], [Information about xterm, konsole, gnome terminal and other terminal emulators.])
insert(misc_linux, [Miscellaneous], [Miscellaneous Linux OS information.])
insert(benchmarking, [Benchmarking], [])
insert(clustering, [Clustering], [])
insert(backup, [Backup], [])

View File

@ -10,8 +10,7 @@ insert(sysadmin, [], Site, [], Administrator,
Please change the password before your Lampadas server goes live!],
[default])
insert(david, [], David, [C.], Merrill,
[david@lupercalia.net], t, t, password,
[This is a test account for David.
It should be deleted before release!],
insert(user, [], John, [Q.], User,
[david@lupercalia.net], f, f, password,
[This is a test account. It should be deleted before release!],
[default])

View File

@ -456,6 +456,7 @@ class TableFactory:
log(3, 'Creating subtopic table')
subtopic = lampadas.subtopics[uri.code]
box = '<table class="navbox"><tr><th>' + subtopic.name[uri.lang] + '</th></tr>\n'
box = box + '<tr><td>' + subtopic.description[uri.lang] + '</td></tr>\n'
box = box + '<tr><td><ol>\n'
keys = subtopic.docs.sort_by('Title')
for key in keys: