]> git.ipfire.org Git - people/shoehn/ipfire.org.git/commitdiff
Integrate boot.ipfire.org application with the main webapp.
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 25 Jul 2012 18:30:50 +0000 (20:30 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 25 Jul 2012 18:30:50 +0000 (20:30 +0200)
boot/backend [deleted symlink]
boot/static [deleted symlink]
boot/templates [deleted symlink]
www/translations/de_DE/LC_MESSAGES/webapp.po
www/translations/webapp.pot
www/webapp/__init__.py
www/webapp/handlers.py
www/webapp/handlers_boot.py [moved from boot/boot.py with 62% similarity]

diff --git a/boot/backend b/boot/backend
deleted file mode 120000 (symlink)
index e57052c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../www/webapp/backend/
\ No newline at end of file
diff --git a/boot/static b/boot/static
deleted file mode 120000 (symlink)
index 80b7039..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../www/static/netboot/
\ No newline at end of file
diff --git a/boot/templates b/boot/templates
deleted file mode 120000 (symlink)
index b5c72a4..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../www/templates/netboot
\ No newline at end of file
index 33ba16accefad0f9f8e7d0f8a2c9a71f656db388..06c97274e4685b8fe6b160db5e92fc1352f0142c 100644 (file)
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2012-07-25 20:08+0200\n"
+"POT-Creation-Date: 2012-07-25 20:13+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -1272,10 +1272,6 @@ msgstr "Vor mehr als einem Tag"
 msgid "Profile not found"
 msgstr "Profil nicht gefunden"
 
-#: templates/news-item.html:7
-msgid "Show all news entries"
-msgstr ""
-
 #: webapp/handlers_news.py:44 webapp/ui_modules.py:54
 msgid "Unknown author"
 msgstr "Unbekannter Autor"
index 9015277eb46b81a5f5cdad375756b257f8fb761a..23a93995a08b751c23e0a583969590a101181b74 100644 (file)
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2012-07-25 20:08+0200\n"
+"POT-Creation-Date: 2012-07-25 20:13+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -1264,10 +1264,6 @@ msgstr ""
 msgid "Profile not found"
 msgstr ""
 
-#: templates/news-item.html:7
-msgid "Show all news entries"
-msgstr ""
-
 #: webapp/handlers_news.py:44 webapp/ui_modules.py:54
 msgid "Unknown author"
 msgstr ""
index 0bc72936e44cc11113479d2794f563f7902174e8..69e03e3051883c611509603b6aded9399e62d2ab 100644 (file)
@@ -151,6 +151,21 @@ class Application(tornado.web.Application):
                        (r"/torrent/([0-9a-f]+)", TrackerDetailHandler),
                ] + static_handlers)
 
+               # boot.ipfire.org
+               BOOT_STATIC_PATH = os.path.join(self.settings["static_path"], "netboot")
+               self.add_handlers(r"boot\.ipfire\.org", [
+                       (r"/", tornado.web.RedirectHandler, { "url" : "http://www.ipfire.org/download" }),
+
+                       # Configurations
+                       (r"/menu.gpxe", MenuGPXEHandler),
+                       (r"/menu.cfg", MenuCfgHandler),
+                       (r"/config/([0-9]+)/boot.gpxe", BootGPXEHandler),
+
+                       # Static files
+                       (r"/(boot.png|custom.gpxe|premenu.cfg|vesamenu.c32|menu.c32)",
+                               tornado.web.StaticFileHandler, { "path" : BOOT_STATIC_PATH }),
+               ])
+
                # nopaste.ipfire.org
                self.add_handlers(r"nopaste\.ipfire\.org", [
                        (r"/", NopasteIndexHandler),
index 67e42e0d86c5c8fadaf2bb463779affde201e4be..f954f50a3a267eac66d77c78ddb4730d082ad368 100644 (file)
@@ -17,6 +17,7 @@ import backend
 
 from handlers_admin import *
 from handlers_base import *
+from handlers_boot import *
 from handlers_download import *
 from handlers_iuse import *
 from handlers_mirrors import *
similarity index 62%
rename from boot/boot.py
rename to www/webapp/handlers_boot.py
index 00c59b9a4d526109557d3cbc1d17bd11bef6f726..22acce5a5ad90f06ca354b8d9bff474dfbf713ec 100644 (file)
@@ -25,13 +25,13 @@ def word_wrap(s, width=45):
                lines.append(paragraph.lstrip())
        return '\n'.join(lines)
 
-class BaseHandler(tornado.web.RequestHandler):
+class BootBaseHandler(tornado.web.RequestHandler):
        @property
        def netboot(self):
                return backend.NetBoot()
 
 
-class MenuGPXEHandler(BaseHandler):
+class MenuGPXEHandler(BootBaseHandler):
        """
                menu.gpxe
        """
@@ -44,7 +44,7 @@ class MenuGPXEHandler(BaseHandler):
                self.write("chain menu.c32 premenu.cfg\n")
 
 
-class MenuCfgHandler(BaseHandler):
+class MenuCfgHandler(BootBaseHandler):
        def _menu_string(self, menu, level=0):
                s = ""
 
@@ -93,7 +93,7 @@ class MenuCfgHandler(BaseHandler):
                self.render("menu.cfg", menu=menu)
 
 
-class BootGPXEHandler(BaseHandler):
+class BootGPXEHandler(BootBaseHandler):
        def get(self, id):
                config = self.netboot.get_config(id)
                if not config:
@@ -115,58 +115,3 @@ class BootGPXEHandler(BaseHandler):
 
                for line in lines:
                        self.write("%s\n" % line)
-
-
-class Application(tornado.web.Application):
-       def __init__(self):
-               settings = dict(
-                       debug = True,
-                       gzip = True,
-                       static_path = os.path.join(BASEDIR, "static"),
-                       template_path = os.path.join(BASEDIR, "templates"),
-               )
-
-               tornado.web.Application.__init__(self, **settings)
-
-               self.add_handlers(r"boot.ipfire.org", [
-                       # Configurations
-                       (r"/menu.gpxe", MenuGPXEHandler),
-                       (r"/menu.cfg", MenuCfgHandler),
-                       (r"/config/([0-9]+)/boot.gpxe", BootGPXEHandler),
-
-                       # Static files
-                       (r"/(boot.png|custom.gpxe|premenu.cfg|vesamenu.c32|menu.c32)",
-                               tornado.web.StaticFileHandler, { "path" : self.settings["static_path"] }),
-               ])
-
-       @property
-       def ioloop(self):
-               return tornado.ioloop.IOLoop.instance()
-
-       def shutdown(self, *args):
-               logging.debug("Caught shutdown signal")
-               self.ioloop.stop()
-
-       def run(self, port=8002):
-               logging.debug("Going to background")
-
-               # All requests should be done after 30 seconds or they will be killed.
-               self.ioloop.set_blocking_log_threshold(30)
-
-               http_server = tornado.httpserver.HTTPServer(self, xheaders=True)
-
-               # If we are not running in debug mode, we can actually run multiple
-               # frontends to get best performance out of our service.
-               if not self.settings["debug"]:
-                       http_server.bind(port)
-                       http_server.start(num_processes=4)
-               else:
-                       http_server.listen(port)
-
-               self.ioloop.start()
-
-if __name__ == "__main__":
-       a = Application()
-
-       a.run()
-