casweb/cas.py
by Adam Stokes
casweb/cas.py | 2 --
1 file changed, 2 deletions(-)
New commits:
commit e948eacb2dc90c0663a6c3b692b0003e343b1481
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Wed Jan 27 16:43:42 2010 -0500
app declared twice
diff --git a/casweb/cas.py b/casweb/cas.py
index d96ad91..6dc0da5 100644
--- a/casweb/cas.py
+++ b/casweb/cas.py
@@ -26,8 +26,6 @@ urls = (
'/jobs', 'jobs',
)
-app = web.application(urls, globals())
-
# build connection
global casDB
casDB=CasStorage('/var/db/cas/cas.db')
14 years, 3 months
casweb/cas.py casweb/media casweb/templates
by Adam Stokes
casweb/cas.py | 23 +++++++++++++++++++----
casweb/media/css/main.css | 4 ++++
casweb/templates/index.html | 3 +++
casweb/templates/job.html | 14 ++++++++++++--
casweb/templates/jobs.html | 2 +-
5 files changed, 39 insertions(+), 7 deletions(-)
New commits:
commit 84340e674cc833524e46baaae3f0dfae5cd5679e
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Wed Jan 27 16:41:45 2010 -0500
- webby
diff --git a/casweb/cas.py b/casweb/cas.py
index a22742d..d96ad91 100644
--- a/casweb/cas.py
+++ b/casweb/cas.py
@@ -1,11 +1,20 @@
import web
import os
+import ConfigParser
+import glob
try:
from cas.db import CasStorage
except ImportError:
raise Exception("Unable to import CasStorage, make sure CAS is installed")
+global settings
+config = ConfigParser.ConfigParser()
+config.read("/etc/cas.conf")
+settings = {}
+if config.has_section("settings"):
+ for opt, val in config.items("settings"):
+ settings[opt.upper()] = val
# do not edit below this line unless you know what you are doing
render = web.template.render(os.path.join(os.path.dirname(__file__),'templates').replace('\\','/'), cache=False)
@@ -13,7 +22,7 @@ web.template.Template.globals['ctx'] = web.ctx
urls = (
'/', 'index',
- '/job/(\d+)', 'job',
+ '/job/(\d+)/(.*)', 'job',
'/jobs', 'jobs',
)
@@ -26,11 +35,17 @@ casDB.connect()
class index:
def GET(self):
- return render.base(render.index())
+ userdoc = glob.glob('/usr/share/doc/cas*/index.html')[0]
+ return render.base(render.index(userdoc))
class job:
- def GET(self, id):
- return render.base(render.job(id))
+ def GET(self, id, timestamp):
+ path_construct = os.path.join(settings["WORKDIRECTORY"],id)
+ path_construct = os.path.join(path_construct, timestamp)
+ path_construct = os.path.join(path_construct, '%d.log' % (int(id),))
+ if os.path.isfile(path_construct):
+ fp = open(path_construct, 'r').readlines()
+ return render.base(render.job(id, fp))
class jobs:
def GET(self):
diff --git a/casweb/media/css/main.css b/casweb/media/css/main.css
index 7ef24e4..cb6ca6a 100644
--- a/casweb/media/css/main.css
+++ b/casweb/media/css/main.css
@@ -23,5 +23,9 @@ body {
clear:both;
}
+#content .jobstatus {
+ font-size: .7em;
+}
+
/* vim:ts=2 sw=2 et
* /
diff --git a/casweb/templates/index.html b/casweb/templates/index.html
index 181f60d..e3580f2 100644
--- a/casweb/templates/index.html
+++ b/casweb/templates/index.html
@@ -1,5 +1,8 @@
+$def with (userdoc)
<h3>CAS Web Administration</h3>
Welcome to the CAS web frontend. This application gives the ability to view recent jobs,
schedule new jobs, and perform minor maintenance work through the administration panel.
+<h3>Documentation</h3>
+Latest CAS Documentation is located @ $:userdoc
$# vim:ts=2 sw=2 et
diff --git a/casweb/templates/job.html b/casweb/templates/job.html
index b01d138..8f0f53e 100644
--- a/casweb/templates/job.html
+++ b/casweb/templates/job.html
@@ -1,3 +1,13 @@
-$def with (id=0)
+$def with (id, fp)
-job status on $id
+<h3>Job Status</h3>
+Job ID:$id
+<div class="jobstatus">
+<ul>
+$if fp:
+ $for line in fp:
+ <li>$:line</li>
+$else:
+ No information available.
+</ul>
+</div>
diff --git a/casweb/templates/jobs.html b/casweb/templates/jobs.html
index f62399d..c89d0dd 100644
--- a/casweb/templates/jobs.html
+++ b/casweb/templates/jobs.html
@@ -9,7 +9,7 @@ $for job in allJobs[:25]:
$code:
dbid, jobid, timestamp, email = job
<tr>
- <td>$:email</td><td><a href="$ctx.homepath/job/$jobid">$:timestamp</a></td>
+ <td>$:email</td><td>$:jobid | <a href="$ctx.homepath/job/$jobid/$timestamp">$:timestamp</a></td>
</tr>
</table>
14 years, 3 months
casweb/README
by Adam Stokes
casweb/README | 3 +++
1 file changed, 3 insertions(+)
New commits:
commit 525b5e4488b14813a73294a92e735a95cd8deac6
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Wed Jan 27 16:13:52 2010 -0500
- update
diff --git a/casweb/README b/casweb/README
index 631026a..3472d2e 100644
--- a/casweb/README
+++ b/casweb/README
@@ -22,3 +22,6 @@ installation:
</Location>
</VirtualHost>
+/* vim:ts=2 sw=2 et
+ * /
+
14 years, 3 months
casweb/cas.py casweb/media casweb/README casweb/templates
by Adam Stokes
casweb/README | 21 +++++++++++++++++++++
casweb/cas.py | 36 +++++++++++++++++++++++++++++++-----
casweb/media/css/main.css | 27 +++++++++++++++++++++++++++
casweb/media/img/cas_logo.png |binary
casweb/templates/base.html | 21 +++++++++++++++++++++
casweb/templates/index.html | 5 +++++
casweb/templates/job.html | 3 +++
casweb/templates/jobs.html | 16 ++++++++++++++++
8 files changed, 124 insertions(+), 5 deletions(-)
New commits:
commit a736f7483fdd2e74daebe45797fce395aba37b8d
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Wed Jan 27 15:58:31 2010 -0500
- more web work
diff --git a/casweb/README b/casweb/README
index 1e84257..631026a 100644
--- a/casweb/README
+++ b/casweb/README
@@ -1,3 +1,24 @@
installation:
- see http://webpy.org/install for getting framework installed
and setup on webserver
+- make sure to do wsgi installation, so httpd and mod_wsgi needs
+ to be installed.
+ # yum install httpd mod_wsgi
+
+- example for virtual host on ip alias 192.168.1.103
+<VirtualHost 192.168.1.103:80>
+ ServerName casweb
+ WSGIScriptAlias / /mnt/usbdrive/projects/casweb/cas.py
+ Alias /media /mnt/usbdrive/projects/casweb/media
+ <Directory "/mnt/usbdrive/projects/casweb">
+ Options FollowSymlinks
+ AllowOverride None
+ Order allow,deny
+ Allow from all
+ </Directory>
+ <Location /media>
+ Options All
+ SetHandler None
+ </Location>
+</VirtualHost>
+
diff --git a/casweb/cas.py b/casweb/cas.py
index f647dc5..a22742d 100644
--- a/casweb/cas.py
+++ b/casweb/cas.py
@@ -1,15 +1,41 @@
import web
+import os
+
+try:
+ from cas.db import CasStorage
+except ImportError:
+ raise Exception("Unable to import CasStorage, make sure CAS is installed")
+
+
+# do not edit below this line unless you know what you are doing
+render = web.template.render(os.path.join(os.path.dirname(__file__),'templates').replace('\\','/'), cache=False)
+web.template.Template.globals['ctx'] = web.ctx
urls = (
- '/(.*)', 'index'
+ '/', 'index',
+ '/job/(\d+)', 'job',
+ '/jobs', 'jobs',
)
+
app = web.application(urls, globals())
+# build connection
+global casDB
+casDB=CasStorage('/var/db/cas/cas.db')
+casDB.connect()
+
class index:
- def GET(self, name):
- if not name:
- name = 'World'
- return 'Hello, ' + name + '!'
+ def GET(self):
+ return render.base(render.index())
+
+class job:
+ def GET(self, id):
+ return render.base(render.job(id))
+
+class jobs:
+ def GET(self):
+ allJobs = casDB.getAllJobs()
+ return render.base(render.jobs(allJobs))
app = web.application(urls, globals(), autoreload=False)
application = app.wsgifunc()
diff --git a/casweb/media/css/main.css b/casweb/media/css/main.css
new file mode 100644
index 0000000..7ef24e4
--- /dev/null
+++ b/casweb/media/css/main.css
@@ -0,0 +1,27 @@
+body {
+ font-size: 1em;
+ font-family: sans-serif;
+}
+
+#header {
+ width: 750px;
+ margin-left: auto;
+ margin-right: auto;
+ font-size: .7em;
+}
+
+#header .menu {
+ float:right;
+ border: 1px solid black;
+ padding: 5px;
+}
+
+#content {
+ width: 750px;
+ margin-left: auto;
+ margin-right: auto;
+ clear:both;
+}
+
+/* vim:ts=2 sw=2 et
+ * /
diff --git a/casweb/media/img/cas_logo.png b/casweb/media/img/cas_logo.png
new file mode 100644
index 0000000..39e2302
Binary files /dev/null and b/casweb/media/img/cas_logo.png differ
diff --git a/casweb/templates/base.html b/casweb/templates/base.html
index e69de29..0fbef41 100644
--- a/casweb/templates/base.html
+++ b/casweb/templates/base.html
@@ -0,0 +1,21 @@
+$def with (page)
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html><head><title>casweb</title>
+ <link rel="stylesheet" type="text/css" href="/media/css/main.css"/>
+</head>
+<body>
+<div id="header">
+ <img src="/media/img/cas_logo.png"/>
+ <div class="menu">
+ <strong>navigator</strong><br/>
+ <a href="$ctx.homepath/">home</a><br/>
+ <a href="$ctx.homepath/jobs">jobs</a>
+ </div>
+</div>
+<div id="content">
+ $:page
+</div>
+</body>
+</html>
+
+$# vim:ts=2 sw=2 et
diff --git a/casweb/templates/index.html b/casweb/templates/index.html
new file mode 100644
index 0000000..181f60d
--- /dev/null
+++ b/casweb/templates/index.html
@@ -0,0 +1,5 @@
+<h3>CAS Web Administration</h3>
+ Welcome to the CAS web frontend. This application gives the ability to view recent jobs,
+schedule new jobs, and perform minor maintenance work through the administration panel.
+
+$# vim:ts=2 sw=2 et
diff --git a/casweb/templates/job.html b/casweb/templates/job.html
new file mode 100644
index 0000000..b01d138
--- /dev/null
+++ b/casweb/templates/job.html
@@ -0,0 +1,3 @@
+$def with (id=0)
+
+job status on $id
diff --git a/casweb/templates/jobs.html b/casweb/templates/jobs.html
new file mode 100644
index 0000000..f62399d
--- /dev/null
+++ b/casweb/templates/jobs.html
@@ -0,0 +1,16 @@
+$def with (allJobs)
+
+<h3>Recent Jobs</h3>
+<table>
+<tr>
+ <th width="50%">submitter</th><th width="50%">jobid</th>
+</tr>
+$for job in allJobs[:25]:
+ $code:
+ dbid, jobid, timestamp, email = job
+ <tr>
+ <td>$:email</td><td><a href="$ctx.homepath/job/$jobid">$:timestamp</a></td>
+ </tr>
+</table>
+
+
14 years, 3 months
casweb/cas.py casweb/__init__.py casweb/README casweb/templates
by Adam Stokes
casweb/README | 3 +++
casweb/cas.py | 15 +++++++++++++++
2 files changed, 18 insertions(+)
New commits:
commit e6df97d8078f0e129f1116b92be82012d8e6fa6d
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Wed Jan 27 13:57:18 2010 -0500
- web interface
diff --git a/casweb/README b/casweb/README
new file mode 100644
index 0000000..1e84257
--- /dev/null
+++ b/casweb/README
@@ -0,0 +1,3 @@
+installation:
+- see http://webpy.org/install for getting framework installed
+ and setup on webserver
diff --git a/casweb/__init__.py b/casweb/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/casweb/cas.py b/casweb/cas.py
new file mode 100644
index 0000000..f647dc5
--- /dev/null
+++ b/casweb/cas.py
@@ -0,0 +1,15 @@
+import web
+
+urls = (
+ '/(.*)', 'index'
+)
+app = web.application(urls, globals())
+
+class index:
+ def GET(self, name):
+ if not name:
+ name = 'World'
+ return 'Hello, ' + name + '!'
+
+app = web.application(urls, globals(), autoreload=False)
+application = app.wsgifunc()
diff --git a/casweb/templates/base.html b/casweb/templates/base.html
new file mode 100644
index 0000000..e69de29
14 years, 3 months