summaryrefslogtreecommitdiff
path: root/addons/document_page/web/controllers
diff options
context:
space:
mode:
authorRucha (Open ERP) <rpa@tinyerp.com>2012-08-13 10:44:11 +0530
committerRucha (Open ERP) <rpa@tinyerp.com>2012-08-13 10:44:11 +0530
commitdd7a2972d8099fdc8ccb17ee6b7a56a4be2bbb1f (patch)
tree255b0bb9cba8bd5ecd542db5ed3fdc79a004cba0 /addons/document_page/web/controllers
parent7739d0d69b856c3eca8282e52100a06fe6ab2ff3 (diff)
parent9211174a6fbbec8d2637c7d9295714c1657dd8ee (diff)
[MERGE]: Merge with latest trunk-addons
bzr revid: rpa@tinyerp.com-20120813051411-5no0xcudwbkw07c5
Diffstat (limited to 'addons/document_page/web/controllers')
-rw-r--r--addons/document_page/web/controllers/__init__.py3
-rw-r--r--addons/document_page/web/controllers/wiki.py65
2 files changed, 68 insertions, 0 deletions
diff --git a/addons/document_page/web/controllers/__init__.py b/addons/document_page/web/controllers/__init__.py
new file mode 100644
index 00000000000..e1edf0f0f96
--- /dev/null
+++ b/addons/document_page/web/controllers/__init__.py
@@ -0,0 +1,3 @@
+import wiki
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/document_page/web/controllers/wiki.py b/addons/document_page/web/controllers/wiki.py
new file mode 100644
index 00000000000..2f147827f24
--- /dev/null
+++ b/addons/document_page/web/controllers/wiki.py
@@ -0,0 +1,65 @@
+###############################################################################
+#
+# Copyright (C) 2007-TODAY Tiny ERP Pvt Ltd. All Rights Reserved.
+#
+# $Id$
+#
+# Developed by Tiny (http://openerp.com) and Axelor (http://axelor.com).
+#
+# The OpenERP web client is distributed under the "OpenERP Public License".
+# It's based on Mozilla Public License Version (MPL) 1.1 with following
+# restrictions:
+#
+# - All names, links and logos of Tiny, OpenERP and Axelor must be
+# kept as in original distribution without any changes in all software
+# screens, especially in start-up page and the software header, even if
+# the application source code has been changed or updated or code has been
+# added.
+#
+# - All distributions of the software must keep source code with OEPL.
+#
+# - All integrations to any other software must keep source code with OEPL.
+#
+# If you need commercial licence to remove this kind of restriction please
+# contact us.
+#
+# You can see the MPL licence at: http://www.mozilla.org/MPL/MPL-1.1.html
+#
+###############################################################################
+import base64
+
+import cherrypy
+
+import openobject
+from openobject.tools import expose
+
+from openerp.controllers import SecuredController
+
+
+class WikiView(SecuredController):
+ _cp_path = "/wiki/wiki"
+
+ def get_attachment(self, **kwargs):
+ attachments = openobject.rpc.RPCProxy('ir.attachment')
+ file_name = kwargs.get('file').replace("'", '').strip()
+ id = kwargs.get('id').strip()
+
+ ids = attachments.search([('datas_fname', '=', file_name),
+ ('res_model', '=', 'wiki.wiki'),
+ ('res_id', '=', id)])
+
+ res = attachments.read(ids, ['datas'])[0].get('datas')
+ return res, file_name
+
+ @expose(content_type='application/octet')
+ def getImage(self, *kw, **kws):
+ res, _ = self.get_attachment(**kws)
+ return base64.decodestring(res)
+
+ @expose(content_type='application/octet')
+ def getfile(self, *kw, **kws):
+ res, file_name = self.get_attachment(**kws)
+ cherrypy.response.headers['Content-Disposition'] = 'filename="%s"' % (file_name,)
+ return base64.decodestring(res)
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: