-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9ce5d2d
commit 91042c0
Showing
3 changed files
with
33 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,30 @@ | ||
from db import * | ||
import db | ||
import sys | ||
|
||
def serve(): | ||
import web | ||
|
||
sys.argv.pop(1) | ||
|
||
urls = ( | ||
'/', 'index' | ||
) | ||
|
||
database_name = get_database_name() | ||
ensure_db_structure(spawn_db(database_name)) | ||
|
||
class index: | ||
def GET(self): | ||
result = "" | ||
for row in spawn_db(database_name).execute('SELECT * FROM cronjobs'): | ||
result += row['stdout'] | ||
return result | ||
db.ensure_structure(db.spawn()) | ||
|
||
app = web.application(urls, {'index': index}) | ||
app = web.application(urls, globals()) | ||
app.run() | ||
|
||
class Request: | ||
def __init__(self): | ||
self._db = None | ||
|
||
def db(self): | ||
self._db = self._db or db.spawn() | ||
return self._db | ||
|
||
class index(Request): | ||
def GET(self): | ||
result = "" | ||
for row in self.db().execute('SELECT * FROM cronjobs'): | ||
result += row['stdout'] | ||
return result |