Permalink
Browse files

Implements handler_xslt for Cherokee. There can still be done some po…

…lishing, especially in the admin part regarding what does what. In the automake part.

But the thing seems to actually work.
  • Loading branch information...
1 parent fda6ff4 commit 2f32dacee14159aca179aa2e794dece98279cadd @skinkie committed Oct 23, 2011
Showing with 613 additions and 2 deletions.
  1. +1 −0 admin/consts.py
  2. +2 −1 admin/plugins/Makefile.am
  3. +70 −0 admin/plugins/xslt.py
  4. +19 −0 cherokee/Makefile.am
  5. +438 −0 cherokee/handler_xslt.c
  6. +81 −0 cherokee/handler_xslt.h
  7. +2 −1 configure.in
View
@@ -70,6 +70,7 @@
('empty_gif', N_('1x1 Transparent GIF')),
('drop', N_('Drop Connection')),
('tile', N_('Renderd Frontend')),
+ ('xslt', N_('XSLT')),
]
ERROR_HANDLERS = [
@@ -56,7 +56,8 @@ uwsgi.py \
wildcard.py \
gzip.py \
deflate.py \
-drop.py
+drop.py \
+xslt.py
EXTRA_DIST = \
$(adminplugins_DATA)
View
@@ -0,0 +1,70 @@
+# -*- coding: utf-8 -*-
+#
+# Cherokee-admin
+#
+# Authors:
+# Alvaro Lopez Ortega <alvaro@alobbs.com>
+#
+# Copyright (C) 2010 Alvaro Lopez Ortega
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of version 2 of the GNU General Public
+# License as published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+
+import CTK
+import Handler
+
+from util import *
+from consts import *
+
+URL_APPLY = '/plugin/xslt/apply'
+HELPS = [('modules_handlers_xslt', N_("XSLT"))]
+
+OPTIONS = [
+ ('', N_("None")),
+ ('novalid', N_("No valid")),
+ ('nodtdattr', N_("No DTD Attribute"))
+]
+
+NOTE_OPTIONS = N_('How the XML should be parsed.')
+NOTE_NODICT = N_('Disable dictionary.')
+NOTE_CATALOGS = N_('Enable SGML Catalog Files.')
+NOTE_XINCLUDE = N_('Enable XInclude.')
+NOTE_XINCLUDESTYLE = N_('Enable XInclude style.')
+NOTE_CONTENTTYPE = N_('The Content-Type the file should be send as.')
+NOTE_STYLESHEET = N_('The XSL stylesheet to be used for any transformation.')
+
+
+class Plugin_xslt (Handler.PluginHandler):
+ def __init__ (self, key, **kwargs):
+ Handler.PluginHandler.__init__ (self, key, **kwargs)
+ Handler.PluginHandler.AddCommon (self)
+
+ table = CTK.PropsTable()
+ table.Add (_("Options"), CTK.ComboCfg('%s!options'%(key), trans_options(OPTIONS)), _(NOTE_OPTIONS))
+ table.Add (_("No dictionary"), CTK.CheckCfgText("%s!nodict"%(self.key), True, ''), _(NOTE_NODICT))
+ table.Add (_("Catalogs"), CTK.CheckCfgText("%s!catalogs"%(self.key), True, ''), _(NOTE_CATALOGS))
+ table.Add (_("XInclude"), CTK.CheckCfgText("%s!xinclude"%(self.key), True, _('Enabled')), _(NOTE_XINCLUDE))
+ table.Add (_("XincludeStyle"), CTK.CheckCfgText("%s!xincludestyle"%(self.key), True, _('Enabled')), _(NOTE_XINCLUDESTYLE))
+ table.Add (_("Content-Type"), CTK.TextCfg ('%s!contenttype'%(key), True), _(NOTE_CONTENTTYPE))
+ table.Add (_("Stylesheet"), CTK.TextCfg ('%s!stylesheet'%(key), True), _(NOTE_STYLESHEET))
+
+ submit = CTK.Submitter (URL_APPLY)
+ submit += table
+
+ self += CTK.RawHTML ("<h2>%s</h2>" %(_('XML Parser Settings')))
+ self += CTK.Indenter (submit)
+
+ VALS = [("%s!stylesheet"%(self.key), validations.is_local_file_exists)]
+ CTK.publish ('^%s'%(URL_APPLY), CTK.cfg_apply_post, validation=VALS, method="POST")
View
@@ -532,6 +532,23 @@ else
dynamic_handler_post_report_lib = libplugin_post_report.la
endif
+#
+# Handler xslt
+#
+handler_xslt = \
+handler_xslt.c \
+handler_xslt.h \
+logo.inc
+
+libplugin_xslt_la_LDFLAGS = $(module_ldflags) `pkg-config libxslt libexslt --libs`
+libplugin_xslt_la_SOURCES = $(handler_xslt)
+libplugin_xslt_la_CFLAGS = `pkg-config libxslt libexslt --cflags`
+
+if STATIC_HANDLER_SERVER_INFO
+static_handler_xslt_src = $(handler_xslt)
+else
+dynamic_handler_xslt_lib = libplugin_xslt.la
+endif
#
# Handler server_info
@@ -1622,6 +1639,7 @@ $(static_handler_custom_error_src) \
$(static_handler_server_info_src) \
$(static_handler_render_rrd_src) \
$(static_handler_dbslayer_src) \
+$(static_handler_xslt_src) \
$(static_handler_admin_src) \
\
$(static_logger_ncsa_src) \
@@ -1815,6 +1833,7 @@ $(dynamic_handler_error_redir_lib) \
$(dynamic_handler_error_nn_lib) \
$(dynamic_handler_common_lib) \
$(dynamic_handler_dbslayer_lib) \
+$(dynamic_handler_xslt_lib) \
$(dynamic_handler_admin_lib) \
$(dynamic_encoder_gzip_lib) \
$(dynamic_encoder_deflate_lib) \
Oops, something went wrong.

0 comments on commit 2f32dac

Please sign in to comment.