[ui] Rename views.xsd to views.export
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 21 Jul 2016 08:52:07 +0200
changeset 1469 d319cf36ad49
parent 1468 b996f5890546
child 1470 f4f09e845928
[ui] Rename views.xsd to views.export
views/export.py
views/xsd.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/views/export.py	Thu Jul 21 08:52:07 2016 +0200
@@ -0,0 +1,66 @@
+# copyright 2015-2016 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# contact http://www.logilab.fr -- mailto:contact@logilab.fr
+#
+# This program is free software: you can redistribute it and/or modify it under
+# the terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation, either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# 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 Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+"""cubicweb-saem-ref views related to XSD download"""
+
+from cubicweb.predicates import is_instance, one_line_rset
+from cubicweb.web import httpcache, action
+from cubicweb.web.views import idownloadable
+
+_ = unicode
+
+
+class SEDA2DownloadRNGAction(action.Action):
+    __regid__ = 'seda.seda2export.rng'
+    __select__ = (action.Action.__select__
+                  & one_line_rset()
+                  & is_instance('SEDAArchiveTransfer'))
+    category = 'moreactions'
+
+    title = _('SEDA 2.0 RNG export')
+    export_format = 'rng'
+
+    def url(self):
+        entity = self.cw_rset.get_entity(self.cw_row or 0, self.cw_col or 0)
+        return entity.absolute_url(vid='seda.seda2export', format=self.export_format)
+
+
+class SEDA2DownloadXSDAction(SEDA2DownloadRNGAction):
+    __regid__ = 'seda.seda2export.xsd'
+    title = _('SEDA 2.0 XSD export')
+    export_format = 'xsd'
+
+
+class SEDA2DownloadView(idownloadable.DownloadView):
+    """SEDA 2.0 download view"""
+    __regid__ = 'seda.seda2export'
+    __select__ = one_line_rset() & is_instance('SEDAArchiveTransfer')
+
+    http_cache_manager = httpcache.NoHTTPCacheManager
+
+    @property
+    def seda_adapter_id(self):
+        return 'SEDA-2.0.' + self._cw.form.get('format', 'rng').lower()
+
+    def set_request_content_type(self):
+        entity = self.cw_rset.get_entity(self.cw_row or 0, self.cw_col or 0)
+        adapter = entity.cw_adapt_to(self.seda_adapter_id)
+        self._cw.set_content_type(adapter.content_type, filename=adapter.file_name,
+                                  encoding=adapter.encoding, disposition='attachment')
+
+    def call(self):
+        entity = self.cw_rset.get_entity(self.cw_row or 0, self.cw_col or 0)
+        adapter = entity.cw_adapt_to(self.seda_adapter_id)
+        self.w(adapter.dump())
--- a/views/xsd.py	Thu Jul 21 08:50:51 2016 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-# copyright 2015-2016 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr -- mailto:contact@logilab.fr
-#
-# This program is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option)
-# any later version.
-#
-# 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with this program. If not, see <http://www.gnu.org/licenses/>.
-"""cubicweb-saem-ref views related to XSD download"""
-
-from cubicweb.predicates import is_instance, one_line_rset
-from cubicweb.web import httpcache, action
-from cubicweb.web.views import idownloadable
-
-_ = unicode
-
-
-class SEDA2DownloadRNGAction(action.Action):
-    __regid__ = 'seda.seda2export.rng'
-    __select__ = (action.Action.__select__
-                  & one_line_rset()
-                  & is_instance('SEDAArchiveTransfer'))
-    category = 'moreactions'
-
-    title = _('SEDA 2.0 RNG export')
-    export_format = 'rng'
-
-    def url(self):
-        entity = self.cw_rset.get_entity(self.cw_row or 0, self.cw_col or 0)
-        return entity.absolute_url(vid='seda.seda2export', format=self.export_format)
-
-
-class SEDA2DownloadXSDAction(SEDA2DownloadRNGAction):
-    __regid__ = 'seda.seda2export.xsd'
-    title = _('SEDA 2.0 XSD export')
-    export_format = 'xsd'
-
-
-class SEDA2DownloadView(idownloadable.DownloadView):
-    """SEDA 2.0 download view"""
-    __regid__ = 'seda.seda2export'
-    __select__ = one_line_rset() & is_instance('SEDAArchiveTransfer')
-
-    http_cache_manager = httpcache.NoHTTPCacheManager
-
-    @property
-    def seda_adapter_id(self):
-        return 'SEDA-2.0.' + self._cw.form.get('format', 'rng').lower()
-
-    def set_request_content_type(self):
-        entity = self.cw_rset.get_entity(self.cw_row or 0, self.cw_col or 0)
-        adapter = entity.cw_adapt_to(self.seda_adapter_id)
-        self._cw.set_content_type(adapter.content_type, filename=adapter.file_name,
-                                  encoding=adapter.encoding, disposition='attachment')
-
-    def call(self):
-        entity = self.cw_rset.get_entity(self.cw_row or 0, self.cw_col or 0)
-        adapter = entity.cw_adapt_to(self.seda_adapter_id)
-        self.w(adapter.dump())