From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QIMEa-0008Tq-E2 for garchives@archives.gentoo.org; Fri, 06 May 2011 14:42:24 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4C0051C04F; Fri, 6 May 2011 14:42:17 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 04EF81C04F for ; Fri, 6 May 2011 14:42:16 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 54AB11B402E for ; Fri, 6 May 2011 14:42:16 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 7FEB280505 for ; Fri, 6 May 2011 14:42:15 +0000 (UTC) From: "Vikraman Choudhury" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Vikraman Choudhury" Message-ID: <085560c594307487d3af47da41d39e724d0339fc.vikraman@gentoo> Subject: [gentoo-commits] proj/gentoostats:master commit in: server/, server/templates/ X-VCS-Repository: proj/gentoostats X-VCS-Files: server/config.py server/main.py server/templates/error_404.html server/templates/error_500.html server/templates/index.html server/templates/layout.html X-VCS-Directories: server/ server/templates/ X-VCS-Committer: vikraman X-VCS-Committer-Name: Vikraman Choudhury X-VCS-Revision: 085560c594307487d3af47da41d39e724d0339fc Date: Fri, 6 May 2011 14:42:15 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 54eddcfc576ca29ff1792af6fbedf704 commit: 085560c594307487d3af47da41d39e724d0339fc Author: Vikraman Choudhury gmail com> AuthorDate: Fri May 6 14:41:47 2011 +0000 Commit: Vikraman Choudhury gmail com> CommitDate: Fri May 6 14:41:47 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/gentoostats.g= it;a=3Dcommit;h=3D085560c5 first commit for server code --- server/config.py | 4 ++++ server/main.py | 39 +++++++++++++++++++++++++++++++++= ++++++ server/templates/error_404.html | 6 ++++++ server/templates/error_500.html | 5 +++++ server/templates/index.html | 4 ++++ server/templates/layout.html | 12 ++++++++++++ 6 files changed, 70 insertions(+), 0 deletions(-) diff --git a/server/config.py b/server/config.py new file mode 100644 index 0000000..5ef7087 --- /dev/null +++ b/server/config.py @@ -0,0 +1,4 @@ +import web + +render =3D web.template.render('templates/', base=3D'layout') + diff --git a/server/main.py b/server/main.py new file mode 100755 index 0000000..51ae445 --- /dev/null +++ b/server/main.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python + +import web +import config +from config import render +import json + +urls =3D ( + r'/', 'index', + r'/(.+)', 'stats' +) + +class index: + def GET(self): + return render.index() + +class stats: + def GET(self, uuid): + return 'GET success' + + def POST(self, uuid): + pdata =3D json.JSONDecoder().decode(web.data()) + print pdata + return 'Post for ' + uuid + ' successful' + +def notfound(): + return web.notfound(render.error_404()) + +def internalerror(): + return web.internalerror(render.error_500()) + +app =3D web.application(urls, globals()) + +app.notfound =3D notfound +app.internalerror =3D internalerror + +if __name__ =3D=3D "__main__": + app.run() + diff --git a/server/templates/error_404.html b/server/templates/error_404= .html new file mode 100644 index 0000000..d310a86 --- /dev/null +++ b/server/templates/error_404.html @@ -0,0 +1,6 @@ +$var title: Page not found + +

The requested page was not found.

+ +

Developer note: Because Google and Microsoft think i= ts OK to violate web standards for their own benefit, you must ensure tha= t your error pages are larger than 512 bytes if you wish them to be displ= ayed instead of the "friendly" error pages the browsers show. Which is wh= y this message is here. To make the page longer. Bah.

+ diff --git a/server/templates/error_500.html b/server/templates/error_500= .html new file mode 100644 index 0000000..2314e76 --- /dev/null +++ b/server/templates/error_500.html @@ -0,0 +1,5 @@ +$var title: Internal error + +

Oops, it seems something is broke on the server. Please try again. + +

Developer note: Because Google and Microsoft think i= ts OK to violate web standards for their own benefit, you must ensure tha= t your error pages are larger than 512 bytes if you wish them to be displ= ayed instead of the "friendly" error pages the browsers show. Which is wh= y this message is here. To make the page longer. Bah.

diff --git a/server/templates/index.html b/server/templates/index.html new file mode 100644 index 0000000..11fafb6 --- /dev/null +++ b/server/templates/index.html @@ -0,0 +1,4 @@ +$var title: Gentoostats + +Welcome to the gentoostats webapp + diff --git a/server/templates/layout.html b/server/templates/layout.html new file mode 100644 index 0000000..48140d6 --- /dev/null +++ b/server/templates/layout.html @@ -0,0 +1,12 @@ +$def with (content) + + + + +$content.title + + +$:content + + +