| 15 |
import HTMLTemplate |
import HTMLTemplate |
| 16 |
import re |
import re |
| 17 |
from sys import argv, exit, stderr |
from sys import argv, exit, stderr |
| 18 |
from os import chmod |
import os |
| 19 |
from stat import S_IWGRP, S_IRUSR, S_IRGRP, S_IWUSR, S_IROTH |
from stat import S_IWGRP, S_IRUSR, S_IRGRP, S_IWUSR, S_IROTH |
| 20 |
import time |
import time |
| 21 |
from datetime import datetime |
from datetime import datetime |
| 26 |
CDD='debian-med' |
CDD='debian-med' |
| 27 |
|
|
| 28 |
OUTPUTDIR = { 'debian-med' : HTMLBASE+"/debian-med/static/tasks/", |
OUTPUTDIR = { 'debian-med' : HTMLBASE+"/debian-med/static/tasks/", |
| 29 |
'debian-edu' : HTMLBASE+"/cdd/htdocs/science/tasks/", |
'debian-edu' : HTMLBASE+"/cdd/htdocs/edu/tasks/", |
| 30 |
'debian-gis' : HTMLBASE+"/cdd/htdocs/gis/tasks/", |
'debian-gis' : HTMLBASE+"/cdd/htdocs/gis/tasks/", |
| 31 |
'debian-science' : HTMLBASE+"/cdd/htdocs/science/tasks/", |
'debian-science' : HTMLBASE+"/cdd/htdocs/science/tasks/", |
| 32 |
} |
} |
| 225 |
f = open(TEMPLATEDIR + "tasks_idx.tmpl") |
f = open(TEMPLATEDIR + "tasks_idx.tmpl") |
| 226 |
tmpl = HTMLTemplate.Template(renderIndex, f.read(), codecs=(None,None)) ##myEncoder, myDecoder)) |
tmpl = HTMLTemplate.Template(renderIndex, f.read(), codecs=(None,None)) ##myEncoder, myDecoder)) |
| 227 |
f.close() |
f.close() |
| 228 |
|
|
| 229 |
|
# Make sure OUTPUTDIR exists |
| 230 |
|
if not os.access(OUTPUTDIR[CDD], os.W_OK): |
| 231 |
|
try: |
| 232 |
|
os.makedirs(OUTPUTDIR[CDD]) |
| 233 |
|
except: |
| 234 |
|
print >> stderr, "Unable to create output directory", OUTPUTDIR[CDD] |
| 235 |
|
|
| 236 |
outputfile = OUTPUTDIR[CDD] + "index.php" |
outputfile = OUTPUTDIR[CDD] + "index.php" |
| 237 |
f = open(outputfile, "w") |
f = open(outputfile, "w") |
| 238 |
|
|
| 243 |
f.write(tmpl.render(tasks)) |
f.write(tmpl.render(tasks)) |
| 244 |
f.close() |
f.close() |
| 245 |
try: |
try: |
| 246 |
chmod(outputfile,S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH) |
os.chmod(outputfile,S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH) |
| 247 |
except: |
except: |
| 248 |
# chmod is not allowed to other peoples files |
# chmod is not allowed to other peoples files |
| 249 |
pass |
pass |