Entry point for rpc server, view templates, rss feeds of node down times,
Stephen Soltesz [Tue, 25 Nov 2008 23:54:57 +0000 (23:54 +0000)]
and other nice things.

39 files changed:
web/MonitorWeb/MonitorWeb.egg-info/PKG-INFO [new file with mode: 0644]
web/MonitorWeb/MonitorWeb.egg-info/SOURCES.txt [new file with mode: 0644]
web/MonitorWeb/MonitorWeb.egg-info/dependency_links.txt [new file with mode: 0644]
web/MonitorWeb/MonitorWeb.egg-info/entry_points.txt [new file with mode: 0644]
web/MonitorWeb/MonitorWeb.egg-info/not-zip-safe [new file with mode: 0644]
web/MonitorWeb/MonitorWeb.egg-info/paster_plugins.txt [new file with mode: 0644]
web/MonitorWeb/MonitorWeb.egg-info/requires.txt [new file with mode: 0644]
web/MonitorWeb/MonitorWeb.egg-info/top_level.txt [new file with mode: 0644]
web/MonitorWeb/README.txt [new file with mode: 0644]
web/MonitorWeb/dev.cfg [new file with mode: 0644]
web/MonitorWeb/monitorweb/__init__.py [new file with mode: 0644]
web/MonitorWeb/monitorweb/commands.py [new file with mode: 0644]
web/MonitorWeb/monitorweb/config/__init__.py [new file with mode: 0644]
web/MonitorWeb/monitorweb/config/app.cfg [new file with mode: 0644]
web/MonitorWeb/monitorweb/config/log.cfg [new file with mode: 0644]
web/MonitorWeb/monitorweb/controllers.py [new file with mode: 0644]
web/MonitorWeb/monitorweb/json.py [new file with mode: 0644]
web/MonitorWeb/monitorweb/model.py [new file with mode: 0644]
web/MonitorWeb/monitorweb/release.py [new file with mode: 0644]
web/MonitorWeb/monitorweb/static/css/style.css [new file with mode: 0644]
web/MonitorWeb/monitorweb/static/images/favicon.ico [new file with mode: 0644]
web/MonitorWeb/monitorweb/static/images/header_inner.png [new file with mode: 0644]
web/MonitorWeb/monitorweb/static/images/info.png [new file with mode: 0644]
web/MonitorWeb/monitorweb/static/images/ok.png [new file with mode: 0644]
web/MonitorWeb/monitorweb/static/images/tg_under_the_hood.png [new file with mode: 0644]
web/MonitorWeb/monitorweb/static/images/under_the_hood_blue.png [new file with mode: 0644]
web/MonitorWeb/monitorweb/templates/.master.kid.swp [new file with mode: 0644]
web/MonitorWeb/monitorweb/templates/__init__.py [new file with mode: 0644]
web/MonitorWeb/monitorweb/templates/login.kid [new file with mode: 0644]
web/MonitorWeb/monitorweb/templates/master.kid [new file with mode: 0644]
web/MonitorWeb/monitorweb/templates/welcome.kid [new file with mode: 0644]
web/MonitorWeb/monitorweb/tests/__init__.py [new file with mode: 0644]
web/MonitorWeb/monitorweb/tests/test_controllers.py [new file with mode: 0644]
web/MonitorWeb/monitorweb/tests/test_model.py [new file with mode: 0644]
web/MonitorWeb/sample-prod.cfg [new file with mode: 0644]
web/MonitorWeb/setup.py [new file with mode: 0644]
web/MonitorWeb/start-monitorweb.py [new file with mode: 0755]
web/MonitorWeb/test.cfg [new file with mode: 0644]
web/monitorweb-httpd.conf [new file with mode: 0644]

diff --git a/web/MonitorWeb/MonitorWeb.egg-info/PKG-INFO b/web/MonitorWeb/MonitorWeb.egg-info/PKG-INFO
new file mode 100644 (file)
index 0000000..594b5b8
--- /dev/null
@@ -0,0 +1,15 @@
+Metadata-Version: 1.0
+Name: MonitorWeb
+Version: 1.0
+Summary: UNKNOWN
+Home-page: UNKNOWN
+Author: UNKNOWN
+Author-email: UNKNOWN
+License: UNKNOWN
+Description: UNKNOWN
+Platform: UNKNOWN
+Classifier: Development Status :: 3 - Alpha
+Classifier: Operating System :: OS Independent
+Classifier: Programming Language :: Python
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Classifier: Framework :: TurboGears
diff --git a/web/MonitorWeb/MonitorWeb.egg-info/SOURCES.txt b/web/MonitorWeb/MonitorWeb.egg-info/SOURCES.txt
new file mode 100644 (file)
index 0000000..23d914d
--- /dev/null
@@ -0,0 +1,21 @@
+README.txt
+setup.py
+MonitorWeb.egg-info/PKG-INFO
+MonitorWeb.egg-info/SOURCES.txt
+MonitorWeb.egg-info/dependency_links.txt
+MonitorWeb.egg-info/entry_points.txt
+MonitorWeb.egg-info/not-zip-safe
+MonitorWeb.egg-info/paster_plugins.txt
+MonitorWeb.egg-info/requires.txt
+MonitorWeb.egg-info/top_level.txt
+monitorweb/__init__.py
+monitorweb/commands.py
+monitorweb/controllers.py
+monitorweb/json.py
+monitorweb/model.py
+monitorweb/release.py
+monitorweb/config/__init__.py
+monitorweb/templates/__init__.py
+monitorweb/tests/__init__.py
+monitorweb/tests/test_controllers.py
+monitorweb/tests/test_model.py
\ No newline at end of file
diff --git a/web/MonitorWeb/MonitorWeb.egg-info/dependency_links.txt b/web/MonitorWeb/MonitorWeb.egg-info/dependency_links.txt
new file mode 100644 (file)
index 0000000..8b13789
--- /dev/null
@@ -0,0 +1 @@
+
diff --git a/web/MonitorWeb/MonitorWeb.egg-info/entry_points.txt b/web/MonitorWeb/MonitorWeb.egg-info/entry_points.txt
new file mode 100644 (file)
index 0000000..49e72a2
--- /dev/null
@@ -0,0 +1,3 @@
+[console_scripts]
+start-monitorweb = monitorweb.commands:start
+
diff --git a/web/MonitorWeb/MonitorWeb.egg-info/not-zip-safe b/web/MonitorWeb/MonitorWeb.egg-info/not-zip-safe
new file mode 100644 (file)
index 0000000..8b13789
--- /dev/null
@@ -0,0 +1 @@
+
diff --git a/web/MonitorWeb/MonitorWeb.egg-info/paster_plugins.txt b/web/MonitorWeb/MonitorWeb.egg-info/paster_plugins.txt
new file mode 100644 (file)
index 0000000..89bd761
--- /dev/null
@@ -0,0 +1 @@
+TurboGears
diff --git a/web/MonitorWeb/MonitorWeb.egg-info/requires.txt b/web/MonitorWeb/MonitorWeb.egg-info/requires.txt
new file mode 100644 (file)
index 0000000..ca77963
--- /dev/null
@@ -0,0 +1,3 @@
+TurboGears >= 1.0.7
+SQLAlchemy>=0.3.10
+Elixir>=0.4.0
\ No newline at end of file
diff --git a/web/MonitorWeb/MonitorWeb.egg-info/top_level.txt b/web/MonitorWeb/MonitorWeb.egg-info/top_level.txt
new file mode 100644 (file)
index 0000000..90cbb55
--- /dev/null
@@ -0,0 +1 @@
+monitorweb
diff --git a/web/MonitorWeb/README.txt b/web/MonitorWeb/README.txt
new file mode 100644 (file)
index 0000000..03cdb8d
--- /dev/null
@@ -0,0 +1,4 @@
+MonitorWeb
+
+This is a TurboGears (http://www.turbogears.org) project. It can be
+started by running the start-monitorweb.py script.
\ No newline at end of file
diff --git a/web/MonitorWeb/dev.cfg b/web/MonitorWeb/dev.cfg
new file mode 100644 (file)
index 0000000..f1e675b
--- /dev/null
@@ -0,0 +1,76 @@
+[global]
+# This is where all of your settings go for your development environment
+# Settings that are the same for both development and production
+# (such as template engine, encodings, etc.) all go in
+# monitorweb/config/app.cfg
+
+# DATABASE
+
+# driver://username:password@host:port/database
+
+# pick the form for your database
+# sqlalchemy.dburi="postgres://username@hostname/databasename"
+# sqlalchemy.dburi="mysql://username:password@hostname:port/databasename"
+# sqlalchemy.dburi="sqlite://%(current_dir_uri)s/devdata.sqlite"
+
+# If you have sqlite, here's a simple default to get you started
+# in development
+sqlalchemy.dburi="sqlite:///devdata.sqlite"
+
+
+# SERVER
+
+# Some server parameters that you may want to tweak
+# server.socket_port=8080
+
+# Enable the debug output at the end on pages.
+# log_debug_info_filter.on = False
+
+server.environment="development"
+autoreload.package="monitorweb"
+
+
+server.socket_host="127.0.0.1"
+server.socket_port=8080
+server.webpath="/monitor/"
+base_url_filter.on = False
+base_url_filter.base_url = "http://127.0.0.1:8080/monitor"
+base_url_filter.use_x_forwarded_host = True
+
+# Auto-Reload after code modification
+# autoreload.on = True
+
+# Set to True if you'd like to abort execution if a controller gets an
+# unexpected parameter. False by default
+tg.strict_parameters = True
+
+# LOGGING
+# Logging configuration generally follows the style of the standard
+# Python logging module configuration. Note that when specifying
+# log format messages, you need to use *() for formatting variables.
+# Deployment independent log configuration is in monitorweb/config/log.cfg
+[logging]
+
+[[loggers]]
+[[[monitorweb]]]
+level='DEBUG'
+qualname='monitorweb'
+handlers=['debug_out']
+
+[[[allinfo]]]
+level='INFO'
+handlers=['debug_out']
+
+[[[access]]]
+level='INFO'
+qualname='turbogears.access'
+handlers=['access_out']
+propagate=0
+
+
+[[[database]]]
+# Set to INFO to make SQLAlchemy display SQL commands
+level='ERROR'
+qualname='sqlalchemy.engine'
+handlers=['debug_out']
+propagate=0
diff --git a/web/MonitorWeb/monitorweb/__init__.py b/web/MonitorWeb/monitorweb/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/web/MonitorWeb/monitorweb/commands.py b/web/MonitorWeb/monitorweb/commands.py
new file mode 100644 (file)
index 0000000..9e75f08
--- /dev/null
@@ -0,0 +1,53 @@
+# -*- coding: utf-8 -*-\r
+"""This module contains functions called from console script entry points."""\r
+\r
+import sys\r
+from os import getcwd\r
+from os.path import dirname, exists, join\r
+\r
+import pkg_resources\r
+pkg_resources.require("TurboGears>=1.0.7")\r
+\r
+import cherrypy\r
+import turbogears\r
+\r
+cherrypy.lowercase_api = True\r
+\r
+\r
+class ConfigurationError(Exception):\r
+    pass\r
+\r
+\r
+def start():\r
+    """Start the CherryPy application server."""\r
+\r
+    setupdir = dirname(dirname(__file__))\r
+    curdir = getcwd()\r
+\r
+    # First look on the command line for a desired config file,\r
+    # if it's not on the command line, then look for 'setup.py'\r
+    # in the current directory. If there, load configuration\r
+    # from a file called 'dev.cfg'. If it's not there, the project\r
+    # is probably installed and we'll look first for a file called\r
+    # 'prod.cfg' in the current directory and then for a default\r
+    # config file called 'default.cfg' packaged in the egg.\r
+    if len(sys.argv) > 1:\r
+        configfile = sys.argv[1]\r
+    elif exists(join(setupdir, "setup.py")):\r
+        configfile = join(setupdir, "dev.cfg")\r
+    elif exists(join(curdir, "prod.cfg")):\r
+        configfile = join(curdir, "prod.cfg")\r
+    else:\r
+        try:\r
+            configfile = pkg_resources.resource_filename(\r
+              pkg_resources.Requirement.parse("MonitorWeb"),\r
+                "config/default.cfg")\r
+        except pkg_resources.DistributionNotFound:\r
+            raise ConfigurationError("Could not find default configuration.")\r
+\r
+    turbogears.update_config(configfile=configfile,\r
+        modulename="monitorweb.config")\r
+\r
+    from monitorweb.controllers import Root\r
+\r
+    turbogears.start_server(Root())\r
diff --git a/web/MonitorWeb/monitorweb/config/__init__.py b/web/MonitorWeb/monitorweb/config/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/web/MonitorWeb/monitorweb/config/app.cfg b/web/MonitorWeb/monitorweb/config/app.cfg
new file mode 100644 (file)
index 0000000..8667126
--- /dev/null
@@ -0,0 +1,71 @@
+[global]
+# The settings in this file should not vary depending on the deployment
+# environment. dev.cfg and prod.cfg are the locations for
+# the different deployment settings. Settings in this file will
+# be overridden by settings in those other files.
+
+# The commented out values below are the defaults
+
+# APPLICATION PACKAGE
+
+package = "monitorweb"
+
+# VIEW
+
+# which view (template engine) to use if one is not specified in the
+# template name
+# tg.defaultview = "kid"
+
+# The following Kid settings determine the settings used by the Kid serializer.
+
+# Kid output method (e.g. html, html-strict, xhtml, xhtml-strict, xml, json)
+# and formatting (e.g. default, straight, compact, newlines, wrap, nice)
+# kid.outputformat="html default"
+
+# kid.encoding="utf-8"
+
+# The sitetemplate is used for overall styling of a site that
+# includes multiple TurboGears applications
+# tg.sitetemplate="<packagename.templates.templatename>"
+
+# Allow every exposed function to be called as json,
+# tg.allow_json = False
+
+# Suppress the inclusion of the shipped MochiKit version, which is rather outdated.
+# Attention: setting this to True and listing 'turbogears.mochikit' in 'tg.include_widgets'
+# is a contradiction. This option will overrule the default-inclusion to prevent version
+# mismatch bugs.
+# tg.mochikit_suppress = True
+
+# List of Widgets to include on every page.
+# for example ['turbogears.mochikit']
+# tg.include_widgets = []
+
+# Set to True if the scheduler should be started
+# tg.scheduler = False
+
+# Set to True to allow paginate decorator redirects when page number gets
+# out of bound. Useful for getting the real page id in the url
+# paginate.redirect_on_out_of_range = True
+
+# Set to True to allow paginate decorator redirects when last page is requested.
+# This is useful for getting the real last page id in the url
+# paginate.redirect_on_last_page = True
+
+# Set session or cookie
+# session_filter.on = True
+
+
+# compress the data sends to the web browser
+# [/]
+# gzip_filter.on = True
+# gzip_filter.mime_types = ["application/json", "application/x-javascript",
+#     "text/javascript", "text/html", "text/css", "text/plain"]
+
+[/static]
+static_filter.on = True
+static_filter.dir = "%(top_level_dir)s/static"
+
+[/favicon.ico]
+static_filter.on = True
+static_filter.file = "%(top_level_dir)s/static/images/favicon.ico"
diff --git a/web/MonitorWeb/monitorweb/config/log.cfg b/web/MonitorWeb/monitorweb/config/log.cfg
new file mode 100644 (file)
index 0000000..ce776f8
--- /dev/null
@@ -0,0 +1,29 @@
+# LOGGING
+# Logging is often deployment specific, but some handlers and
+# formatters can be defined here.
+
+[logging]
+[[formatters]]
+[[[message_only]]]
+format='*(message)s'
+
+[[[full_content]]]
+format='*(asctime)s *(name)s *(levelname)s *(message)s'
+
+[[handlers]]
+[[[debug_out]]]
+class='StreamHandler'
+level='DEBUG'
+args='(sys.stdout,)'
+formatter='full_content'
+
+[[[access_out]]]
+class='StreamHandler'
+level='INFO'
+args='(sys.stdout,)'
+formatter='message_only'
+
+[[[error_out]]]
+class='StreamHandler'
+level='ERROR'
+args='(sys.stdout,)'
diff --git a/web/MonitorWeb/monitorweb/controllers.py b/web/MonitorWeb/monitorweb/controllers.py
new file mode 100644 (file)
index 0000000..8d9ced5
--- /dev/null
@@ -0,0 +1,13 @@
+import turbogears as tg
+from turbogears import controllers, expose, flash
+# from monitorweb import model
+# import logging
+# log = logging.getLogger("monitorweb.controllers")
+
+class Root(controllers.RootController):
+    @expose(template="monitorweb.templates.welcome")
+    def index(self):
+        import time
+        # log.debug("Happy TurboGears Controller Responding For Duty")
+        flash("Your application is now running")
+        return dict(now=time.ctime())
diff --git a/web/MonitorWeb/monitorweb/json.py b/web/MonitorWeb/monitorweb/json.py
new file mode 100644 (file)
index 0000000..66d5cfb
--- /dev/null
@@ -0,0 +1,10 @@
+# A JSON-based API(view) for your app.
+# Most rules would look like:
+# @jsonify.when("isinstance(obj, YourClass)")
+# def jsonify_yourclass(obj):
+#     return [obj.val1, obj.val2]
+# @jsonify can convert your objects to following types:
+# lists, dicts, numbers and strings
+
+from turbojson.jsonify import jsonify
+
diff --git a/web/MonitorWeb/monitorweb/model.py b/web/MonitorWeb/monitorweb/model.py
new file mode 100644 (file)
index 0000000..b570416
--- /dev/null
@@ -0,0 +1,20 @@
+import pkg_resources
+pkg_resources.require("SQLAlchemy>=0.3.10")
+pkg_resources.require("Elixir>=0.4.0")
+# import the basic Elixir classes and functions for declaring the data model
+# (see http://elixir.ematia.de/trac/wiki/TutorialDivingIn)
+from elixir import Entity, Field, OneToMany, ManyToOne, ManyToMany
+from elixir import options_defaults, using_options, setup_all
+# import some datatypes for table columns from Elixir
+# (see http://www.sqlalchemy.org/docs/04/types.html for more)
+from elixir import String, Unicode, Integer, DateTime
+
+options_defaults['autosetup'] = False
+
+
+# your data model
+
+# class YourDataClass(Entity):
+#     pass
+
+
diff --git a/web/MonitorWeb/monitorweb/release.py b/web/MonitorWeb/monitorweb/release.py
new file mode 100644 (file)
index 0000000..21d4758
--- /dev/null
@@ -0,0 +1,14 @@
+# Release information about MonitorWeb
+
+version = "1.0"
+
+# description = "Your plan to rule the world"
+# long_description = "More description about your plan"
+# author = "Your Name Here"
+# email = "YourEmail@YourDomain"
+# copyright = "Vintage 2006 - a good year indeed"
+
+# if it's open source, you might want to specify these
+# url = "http://yourcool.site/"
+# download_url = "http://yourcool.site/download"
+# license = "MIT"
diff --git a/web/MonitorWeb/monitorweb/static/css/style.css b/web/MonitorWeb/monitorweb/static/css/style.css
new file mode 100644 (file)
index 0000000..c98d40e
--- /dev/null
@@ -0,0 +1,134 @@
+/*\r
+ * Quick mash-up of CSS for the TG quick start page.\r
+ */\r
+\r
+html, body {\r
+  color: black;\r
+  background-color: #ddd;\r
+  font: x-small "Lucida Grande", "Lucida Sans Unicode", geneva, verdana, sans-serif;\r
+  margin: 0;\r
+  padding: 0;\r
+}\r
+\r
+td, th {padding:3px;border:none;}\r
+tr th {text-align:left;background-color:#f0f0f0;color:#333;}\r
+tr.odd td {background-color:#edf3fe;}\r
+tr.even td {background-color:#fff;}\r
+\r
+#header {\r
+  height: 80px;\r
+  width: 777px;\r
+  background: blue URL('../images/header_inner.png') no-repeat;\r
+  border-left: 1px solid #aaa;\r
+  border-right: 1px solid #aaa;\r
+  margin: 0 auto 0 auto;\r
+}\r
+\r
+a.link, a, a.active {\r
+  color: #369;\r
+}\r
+\r
+\r
+#main_content {\r
+  color: black;\r
+  font-size: 127%;\r
+  background-color: white;\r
+  width: 757px;\r
+  margin: 0 auto 0 auto;\r
+  border-left: 1px solid #aaa;\r
+  border-right: 1px solid #aaa;\r
+  padding: 10px;\r
+}\r
+\r
+#sidebar {\r
+  border: 1px solid #aaa;\r
+  background-color: #eee;\r
+  margin: 0.5em;\r
+  padding: 1em;\r
+  float: right;\r
+  width: 200px;\r
+  font-size: 88%;\r
+}\r
+\r
+#sidebar h2 {\r
+  margin-top: 0;\r
+}\r
+\r
+#sidebar ul {\r
+  margin-left: 1.5em;\r
+  padding-left: 0;\r
+}\r
+\r
+h1,h2,h3,h4,h5,h6,#getting_started_steps {\r
+  font-family: "Century Schoolbook L", Georgia, serif;\r
+  font-weight: bold;\r
+}\r
+\r
+h2 {\r
+  font-size: 150%;\r
+}\r
+\r
+#getting_started_steps a {\r
+  text-decoration: none;\r
+}\r
+\r
+#getting_started_steps a:hover {\r
+  text-decoration: underline;\r
+}\r
+\r
+#getting_started_steps li {\r
+  font-size: 80%;\r
+  margin-bottom: 0.5em;\r
+}\r
+\r
+#getting_started_steps h2 {\r
+  font-size: 120%;\r
+}\r
+\r
+#getting_started_steps p {\r
+  font: 100% "Lucida Grande", "Lucida Sans Unicode", geneva, verdana, sans-serif;\r
+}\r
+\r
+#footer {\r
+  border: 1px solid #aaa;\r
+  border-top: 0px none;\r
+  color: #999;\r
+  background-color: white;\r
+  padding: 10px;\r
+  font-size: 80%;\r
+  text-align: center;\r
+  width: 757px;\r
+  margin: 0 auto 1em auto;\r
+}\r
+\r
+.code {\r
+  font-family: monospace;\r
+}\r
+\r
+span.code {\r
+  font-weight: bold;\r
+  background: #eee;\r
+}\r
+\r
+#status_block {\r
+  margin: 0 auto 0.5em auto;\r
+  padding: 15px 10px 15px 55px;\r
+  background: #cec URL('../images/ok.png') left center no-repeat;\r
+  border: 1px solid #9c9;\r
+  width: 450px;\r
+  font-size: 120%;\r
+  font-weight: bolder;\r
+}\r
+\r
+.notice {\r
+  margin: 0.5em auto 0.5em auto;\r
+  padding: 15px 10px 15px 55px;\r
+  width: 450px;\r
+  background: #eef URL('../images/info.png') left center no-repeat;\r
+  border: 1px solid #cce;\r
+}\r
+\r
+.fielderror {\r
+    color: red;\r
+    font-weight: bold;\r
+}
\ No newline at end of file
diff --git a/web/MonitorWeb/monitorweb/static/images/favicon.ico b/web/MonitorWeb/monitorweb/static/images/favicon.ico
new file mode 100644 (file)
index 0000000..332557b
Binary files /dev/null and b/web/MonitorWeb/monitorweb/static/images/favicon.ico differ
diff --git a/web/MonitorWeb/monitorweb/static/images/header_inner.png b/web/MonitorWeb/monitorweb/static/images/header_inner.png
new file mode 100644 (file)
index 0000000..2b2d87d
Binary files /dev/null and b/web/MonitorWeb/monitorweb/static/images/header_inner.png differ
diff --git a/web/MonitorWeb/monitorweb/static/images/info.png b/web/MonitorWeb/monitorweb/static/images/info.png
new file mode 100644 (file)
index 0000000..329c523
Binary files /dev/null and b/web/MonitorWeb/monitorweb/static/images/info.png differ
diff --git a/web/MonitorWeb/monitorweb/static/images/ok.png b/web/MonitorWeb/monitorweb/static/images/ok.png
new file mode 100644 (file)
index 0000000..fee6751
Binary files /dev/null and b/web/MonitorWeb/monitorweb/static/images/ok.png differ
diff --git a/web/MonitorWeb/monitorweb/static/images/tg_under_the_hood.png b/web/MonitorWeb/monitorweb/static/images/tg_under_the_hood.png
new file mode 100644 (file)
index 0000000..bc9c79c
Binary files /dev/null and b/web/MonitorWeb/monitorweb/static/images/tg_under_the_hood.png differ
diff --git a/web/MonitorWeb/monitorweb/static/images/under_the_hood_blue.png b/web/MonitorWeb/monitorweb/static/images/under_the_hood_blue.png
new file mode 100644 (file)
index 0000000..90e84b7
Binary files /dev/null and b/web/MonitorWeb/monitorweb/static/images/under_the_hood_blue.png differ
diff --git a/web/MonitorWeb/monitorweb/templates/.master.kid.swp b/web/MonitorWeb/monitorweb/templates/.master.kid.swp
new file mode 100644 (file)
index 0000000..58f5330
Binary files /dev/null and b/web/MonitorWeb/monitorweb/templates/.master.kid.swp differ
diff --git a/web/MonitorWeb/monitorweb/templates/__init__.py b/web/MonitorWeb/monitorweb/templates/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/web/MonitorWeb/monitorweb/templates/login.kid b/web/MonitorWeb/monitorweb/templates/login.kid
new file mode 100644 (file)
index 0000000..eb55735
--- /dev/null
@@ -0,0 +1,114 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+    xmlns:py="http://purl.org/kid/ns#">
+
+<head>
+    <meta content="text/html; charset=UTF-8"
+        http-equiv="content-type" py:replace="''"/>
+    <title>Login</title>
+    <style type="text/css">
+        #loginBox
+        {
+            width: 30%;
+            margin: auto;
+            margin-top: 10%;
+            padding-left: 10%;
+            padding-right: 10%;
+            padding-top: 5%;
+            padding-bottom: 5%;
+            font-family: verdana;
+            font-size: 10px;
+            background-color: #eee;
+            border: 2px solid #ccc;
+        }
+
+        #loginBox h1
+        {
+            font-size: 42px;
+            font-family: "Trebuchet MS";
+            margin: 0;
+            color: #ddd;
+        }
+
+        #loginBox p
+        {
+            position: relative;
+            top: -1.5em;
+            padding-left: 4em;
+            font-size: 12px;
+            margin: 0;
+            color: #666;
+        }
+
+        #loginBox table
+        {
+            table-layout: fixed;
+            border-spacing: 0;
+            width: 100%;
+        }
+
+        #loginBox td.label
+        {
+            width: 33%;
+            text-align: right;
+        }
+
+        #loginBox td.field
+        {
+            width: 66%;
+        }
+
+        #loginBox td.field input
+        {
+            width: 100%;
+        }
+
+        #loginBox td.buttons
+        {
+            text-align: right;
+        }
+
+    </style>
+</head>
+
+<body>
+    <div id="loginBox">
+        <h1>Login</h1>
+        <p>${message}</p>
+        <form action="${tg.url(previous_url)}" method="POST">
+            <table>
+                <tr>
+                    <td class="label">
+                        <label for="user_name">User Name:</label>
+                    </td>
+                    <td class="field">
+                        <input type="text" id="user_name" name="user_name"/>
+                    </td>
+                </tr>
+                <tr>
+                    <td class="label">
+                        <label for="password">Password:</label>
+                    </td>
+                    <td class="field">
+                        <input type="password" id="password" name="password"/>
+                    </td>
+                </tr>
+                <tr>
+                    <td colspan="2" class="buttons">
+                        <input type="submit" name="login" value="Login"/>
+                    </td>
+                </tr>
+            </table>
+
+            <input py:if="forward_url" type="hidden" name="forward_url"
+                value="${forward_url}"/>
+
+            <div py:for="name,values in original_parameters.items()" py:strip="1">
+            <input py:for="value in isinstance(values, list) and values or [values]"
+                type="hidden" name="${name}" value="${value}"/>
+            </div>
+        </form>
+    </div>
+</body>
+</html>
diff --git a/web/MonitorWeb/monitorweb/templates/master.kid b/web/MonitorWeb/monitorweb/templates/master.kid
new file mode 100644 (file)
index 0000000..ba39836
--- /dev/null
@@ -0,0 +1,50 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
+<?python import sitetemplate ?>\r
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#"\r
+    py:extends="sitetemplate">\r
+\r
+<head py:match="item.tag=='{http://www.w3.org/1999/xhtml}head'" py:attrs="item.items()">\r
+    <meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/>\r
+    <title py:replace="''">Your title goes here</title>\r
+    <meta py:replace="item[:]" name="description" content="master template"/>\r
+    <style type="text/css" media="screen">\r
+        #pageLogin\r
+        {\r
+            font-size: 10px;\r
+            font-family: verdana;\r
+            text-align: right;\r
+        }\r
+    </style>\r
+    <link rel="stylesheet" type="text/css" media="screen" href="../static/css/style.css"\r
+        py:attrs="href=tg.url('/static/css/style.css')"/>\r
+</head>\r
+\r
+<body py:match="item.tag=='{http://www.w3.org/1999/xhtml}body'" py:attrs="item.items()">\r
+    <div py:if="tg.config('identity.on') and not defined('logging_in')" id="pageLogin">\r
+        <span py:if="tg.identity.anonymous">\r
+            <a href="${tg.url(tg.identity.login_url)}">Login</a>\r
+        </span>\r
+        <span py:if="not tg.identity.anonymous">\r
+            Welcome ${tg.identity.user.display_name or tg.identity.user.user_name}.\r
+            <a href="${tg.url('/logout')}">Logout</a>\r
+        </span>\r
+    </div>\r
+\r
+    <div id="header">&#160;</div>\r
+\r
+    <div id="main_content">\r
+        <div id="status_block" class="flash"\r
+            py:if="value_of('tg_flash', None)" py:content="tg_flash"></div>\r
+        <div py:replace="[item.text]+item[:]">page content</div>\r
+    </div>\r
+\r
+    <div id="footer">\r
+        <img src="${tg.url('/static/images/under_the_hood_blue.png')}"\r
+            alt="TurboGears under the hood" />\r
+        <p>TurboGears is a open source front-to-back web development framework\r
+            written in Python</p>\r
+        <p>Copyright &#169; 2007 Kevin Dangoor</p>\r
+    </div>\r
+</body>\r
+\r
+</html>\r
diff --git a/web/MonitorWeb/monitorweb/templates/welcome.kid b/web/MonitorWeb/monitorweb/templates/welcome.kid
new file mode 100644 (file)
index 0000000..9095267
--- /dev/null
@@ -0,0 +1,47 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#"\r
+    py:extends="'master.kid'">\r
+<head>\r
+<meta content="text/html; charset=utf-8" http-equiv="Content-Type" py:replace="''"/>\r
+<title>Welcome to TurboGears</title>\r
+</head>\r
+<body>\r
+\r
+  <div id="sidebar">\r
+    <h2>Learn more</h2>\r
+    Learn more about TurboGears and take part in its\r
+    development\r
+    <ul class="links">\r
+      <li><a href="http://www.turbogears.org">Official website</a></li>\r
+      <li><a href="http://docs.turbogears.org">Documentation</a></li>\r
+      <li><a href="http://trac.turbogears.org/turbogears/">Trac\r
+        (bugs/suggestions)</a></li>\r
+      <li><a href="http://groups.google.com/group/turbogears"> Mailing list</a> </li>\r
+    </ul>\r
+    <span py:replace="now">now</span>\r
+  </div>\r
+  <div id="getting_started">\r
+    <ol id="getting_started_steps">\r
+      <li class="getting_started">\r
+        <h3>Model</h3>\r
+        <p> <a href="http://docs.turbogears.org/1.0/GettingStarted/DefineDatabase">Design models</a> in the <span class="code">model.py</span>.<br/>\r
+          Edit <span class="code">dev.cfg</span> to <a href="http://docs.turbogears.org/1.0/GettingStarted/UseDatabase">use a different backend</a>, or start with a pre-configured SQLite database. <br/>\r
+          Use script <span class="code">tg-admin sql create</span> to create the database tables.</p>\r
+      </li>\r
+      <li class="getting_started">\r
+        <h3>View</h3>\r
+        <p> Edit <a href="http://docs.turbogears.org/1.0/GettingStarted/Kid">html-like templates</a> in the <span class="code">/templates</span> folder;<br/>\r
+        Put all <a href="http://docs.turbogears.org/1.0/StaticFiles">static contents</a> in the <span class="code">/static</span> folder. </p>\r
+      </li>\r
+      <li class="getting_started">\r
+        <h3>Controller</h3>\r
+        <p> Edit <span class="code"> controllers.py</span> and <a href="http://docs.turbogears.org/1.0/GettingStarted/CherryPy">build your\r
+          website structure</a> with the simplicity of Python objects. <br/>\r
+          TurboGears will automatically reload itself when you modify your project. </p>\r
+      </li>\r
+    </ol>\r
+    <div class="notice"> If you create something cool, please <a href="http://groups.google.com/group/turbogears">let people know</a>, and consider contributing something back to the <a href="http://groups.google.com/group/turbogears">community</a>.</div>\r
+  </div>\r
+  <!-- End of getting_started -->\r
+</body>\r
+</html>\r
diff --git a/web/MonitorWeb/monitorweb/tests/__init__.py b/web/MonitorWeb/monitorweb/tests/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/web/MonitorWeb/monitorweb/tests/test_controllers.py b/web/MonitorWeb/monitorweb/tests/test_controllers.py
new file mode 100644 (file)
index 0000000..74070a2
--- /dev/null
@@ -0,0 +1,32 @@
+import unittest
+import turbogears
+from turbogears import testutil
+from monitorweb.controllers import Root
+import cherrypy
+
+cherrypy.root = Root()
+
+class TestPages(unittest.TestCase):
+
+    def setUp(self):
+        turbogears.startup.startTurboGears()
+
+    def tearDown(self):
+        """Tests for apps using identity need to stop CP/TG after each test to
+        stop the VisitManager thread.
+        See http://trac.turbogears.org/turbogears/ticket/1217 for details.
+        """
+        turbogears.startup.stopTurboGears()
+
+    def test_method(self):
+        "the index method should return a string called now"
+        import types
+        result = testutil.call(cherrypy.root.index)
+        assert type(result["now"]) == types.StringType
+
+    def test_indextitle(self):
+        "The indexpage should have the right title"
+        testutil.create_request("/")
+        response = cherrypy.response.body[0].lower()
+        assert "<title>welcome to turbogears</title>" in response
+
diff --git a/web/MonitorWeb/monitorweb/tests/test_model.py b/web/MonitorWeb/monitorweb/tests/test_model.py
new file mode 100644 (file)
index 0000000..02e4d43
--- /dev/null
@@ -0,0 +1,22 @@
+# If your project uses a database, you can set up database tests
+# similar to what you see below. Be sure to set the db_uri to
+# an appropriate uri for your testing database. sqlite is a good
+# choice for testing, because you can use an in-memory database
+# which is very fast.
+
+from turbogears import testutil, database
+# from monitorweb.model import YourDataClass, User
+
+# database.set_db_uri("sqlite:///:memory:")
+
+# class TestUser(testutil.DBTest):
+#     def get_model(self):
+#         return User
+#     def test_creation(self):
+#         "Object creation should set the name"
+#         obj = User(user_name = "creosote",
+#                       email_address = "spam@python.not",
+#                       display_name = "Mr Creosote",
+#                       password = "Wafer-thin Mint")
+#         assert obj.display_name == "Mr Creosote"
+
diff --git a/web/MonitorWeb/sample-prod.cfg b/web/MonitorWeb/sample-prod.cfg
new file mode 100644 (file)
index 0000000..be2bdb2
--- /dev/null
@@ -0,0 +1,77 @@
+[global]
+# This is where all of your settings go for your production environment.
+# You'll copy this file over to your production server and provide it
+# as a command-line option to your start script.
+# Settings that are the same for both development and production
+# (such as template engine, encodings, etc.) all go in 
+# monitorweb/config/app.cfg
+
+# DATABASE
+
+# driver://username:password@host:port/database
+
+# pick the form for your database
+# sqlalchemy.dburi="postgres://username@hostname/databasename"
+# sqlalchemy.dburi="mysql://username:password@hostname:port/databasename"
+# sqlalchemy.dburi="sqlite:///file_name_and_path"
+
+# If you have sqlite, here's a simple default to get you started
+# in development
+sqlalchemy.dburi="sqlite:///%(current_dir_uri)s/devdata.sqlite"
+
+
+# SERVER
+
+server.environment="production"
+
+# Sets the number of threads the server uses
+# server.thread_pool = 1
+
+# if this is part of a larger site, you can set the path
+# to the TurboGears instance here
+# server.webpath=""
+
+# Set to True if you are deploying your App behind a proxy
+# e.g. Apache using mod_proxy
+# base_url_filter.on = False
+
+# Set to True if your proxy adds the x_forwarded_host header
+# base_url_filter.use_x_forwarded_host = True
+
+# If your proxy does not add the x_forwarded_host header, set
+# the following to the *public* host url.
+# (Note: This will be overridden by the use_x_forwarded_host option
+# if it is set to True and the proxy adds the header correctly.
+# base_url_filter.base_url = "http://www.example.com"
+
+# Set to True if you'd like to abort execution if a controller gets an
+# unexpected parameter. False by default
+# tg.strict_parameters = False
+
+# LOGGING
+# Logging configuration generally follows the style of the standard
+# Python logging module configuration. Note that when specifying
+# log format messages, you need to use *() for formatting variables.
+# Deployment independent log configuration is in monitorweb/config/log.cfg
+[logging]
+
+[[handlers]]
+
+[[[access_out]]]
+# set the filename as the first argument below
+args="('server.log',)"
+class='FileHandler'
+level='INFO'
+formatter='message_only'
+
+[[loggers]]
+[[[monitorweb]]]
+level='ERROR'
+qualname='monitorweb'
+handlers=['error_out']
+
+[[[access]]]
+level='INFO'
+qualname='turbogears.access'
+handlers=['access_out']
+propagate=0
diff --git a/web/MonitorWeb/setup.py b/web/MonitorWeb/setup.py
new file mode 100644 (file)
index 0000000..fb2ed15
--- /dev/null
@@ -0,0 +1,78 @@
+# -*- coding: utf-8 -*-
+
+from setuptools import setup, find_packages
+from turbogears.finddata import find_package_data
+
+import os
+execfile(os.path.join("monitorweb", "release.py"))
+
+packages=find_packages()
+package_data = find_package_data(where='monitorweb',
+    package='monitorweb')
+if os.path.isdir('locales'):
+    packages.append('locales')
+    package_data.update(find_package_data(where='locales',
+        exclude=('*.po',), only_in_packages=False))
+
+setup(
+    name="MonitorWeb",
+    version=version,
+    # uncomment the following lines if you fill them out in release.py
+    #description=description,
+    #author=author,
+    #author_email=email,
+    #url=url,
+    #download_url=download_url,
+    #license=license,
+
+    install_requires=[
+        "TurboGears >= 1.0.7",
+        "SQLAlchemy>=0.3.10",
+        "Elixir>=0.4.0",
+    ],
+    zip_safe=False,
+    packages=packages,
+    package_data=package_data,
+    keywords=[
+        # Use keywords if you'll be adding your package to the
+        # Python Cheeseshop
+
+        # if this has widgets, uncomment the next line
+        # 'turbogears.widgets',
+
+        # if this has a tg-admin command, uncomment the next line
+        # 'turbogears.command',
+
+        # if this has identity providers, uncomment the next line
+        # 'turbogears.identity.provider',
+
+        # If this is a template plugin, uncomment the next line
+        # 'python.templating.engines',
+
+        # If this is a full application, uncomment the next line
+        # 'turbogears.app',
+    ],
+    classifiers=[
+        'Development Status :: 3 - Alpha',
+        'Operating System :: OS Independent',
+        'Programming Language :: Python',
+        'Topic :: Software Development :: Libraries :: Python Modules',
+        'Framework :: TurboGears',
+        # if this is an application that you'll distribute through
+        # the Cheeseshop, uncomment the next line
+        # 'Framework :: TurboGears :: Applications',
+
+        # if this is a package that includes widgets that you'll distribute
+        # through the Cheeseshop, uncomment the next line
+        # 'Framework :: TurboGears :: Widgets',
+    ],
+    test_suite='nose.collector',
+    entry_points = {
+        'console_scripts': [
+            'start-monitorweb = monitorweb.commands:start',
+        ],
+    },
+    # Uncomment next line and create a default.cfg file in your project dir
+    # if you want to package a default configuration in your egg.
+    #data_files = [('config', ['default.cfg'])],
+    )
diff --git a/web/MonitorWeb/start-monitorweb.py b/web/MonitorWeb/start-monitorweb.py
new file mode 100755 (executable)
index 0000000..b68edbf
--- /dev/null
@@ -0,0 +1,18 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+"""Start script for the MonitorWeb TurboGears project.
+
+This script is only needed during development for running from the project
+directory. When the project is installed, easy_install will create a
+proper start script.
+"""
+
+import sys
+from monitorweb.commands import start, ConfigurationError
+
+if __name__ == "__main__":
+    try:
+        start()
+    except ConfigurationError, exc:
+        sys.stderr.write(str(exc))
+        sys.exit(1)
diff --git a/web/MonitorWeb/test.cfg b/web/MonitorWeb/test.cfg
new file mode 100644 (file)
index 0000000..e99d1a9
--- /dev/null
@@ -0,0 +1,32 @@
+[global]
+# You can place test-specific configuration options here (like test db uri, etc)
+
+# DATABASE
+
+sqlalchemy.dburi = "sqlite:///:memory:"
+
+# LOGGING
+
+[logging]
+
+[[formatters]]
+[[[full_content]]]
+format='*(asctime)s *(name)s *(levelname)s *(message)s'
+
+[[handlers]]
+[[[test_out]]]
+class='StreamHandler'
+level='DEBUG'
+args='(sys.stdout,)'
+formatter='full_content'
+
+[[loggers]]
+[[[monitorweb]]]
+level='DEBUG'
+qualname='monitorweb'
+handlers=['test_out']
+
+[[[turbogears]]]
+level='INFO'
+qualname='turbogears'
+handlers=['test_out']
diff --git a/web/monitorweb-httpd.conf b/web/monitorweb-httpd.conf
new file mode 100644 (file)
index 0000000..ee84b73
--- /dev/null
@@ -0,0 +1,33 @@
+NameVirtualHost 128.112.139.116:80
+
+<VirtualHost 128.112.139.116:80>
+    ServerName pl-virtual-06.cs.princeton.edu
+    ServerAdmin soltesz@cs.princeton.edu
+    UseCanonicalName Off
+    ServerSignature Off
+
+    DocumentRoot /usr/share/monitor/tgweb/MonitorWeb/monitorweb
+
+    <Directory "/usr/share/monitor/tgweb/MonitorWeb/monitorweb">
+        Options Indexes FollowSymLinks
+        AllowOverride None
+        Order allow,deny
+        Allow from all
+    </Directory>
+
+    Errorlog /var/log/httpd/monitorwebapp-error_log
+    Customlog /var/log/httpd/monitorwebapp-access_log common
+
+    AddDefaultCharset utf-8
+
+    # Load everything out of the DocumentRoot that is static
+    ProxyPass /monitor/static !
+
+    ProxyPass /monitor http://127.0.0.1:8080/
+    ProxyPassReverse /monitor http://127.0.0.1:8080/
+    ProxyPass /monitor/ http://127.0.0.1:8080/
+    ProxyPassReverse /monitor/ http://127.0.0.1:8080/
+    ProxyPreserveHost On
+    ProxyRequests Off
+
+</VirtualHost>