Project

General

Profile

0001-misc-remove-static-pages-support-70853.patch

Frédéric Péters, 30 October 2022 05:32 PM

Download (2.97 KB)

View differences:

Subject: [PATCH] misc: remove static pages support (#70853)

 wcs/qommon/pages.py | 42 ------------------------------------------
 wcs/root.py         |  3 ---
 2 files changed, 45 deletions(-)
 delete mode 100644 wcs/qommon/pages.py
wcs/qommon/pages.py
1
# w.c.s. - web application for online forms
2
# Copyright (C) 2005-2010  Entr'ouvert
3
#
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 2 of the License, or
7
# (at your option) any later version.
8
#
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, see <http://www.gnu.org/licenses/>.
16

  
17
import os
18

  
19
from quixote import get_publisher, redirect
20
from quixote.directory import Directory
21
from quixote.util import StaticDirectory
22

  
23
from . import errors, template
24

  
25

  
26
class PagesDirectory(Directory):
27
    _q_exports = ['']
28

  
29
    def _q_index(self):
30
        return redirect('..')
31

  
32
    def _q_lookup(self, component):
33
        pages_dir = os.path.join(get_publisher().app_dir, 'pages')
34
        if component == 'data':
35
            return StaticDirectory(os.path.join(pages_dir, 'data'), follow_symlinks=True)
36
        page_file = os.path.join(pages_dir, component)
37
        if not os.path.exists(page_file):
38
            raise errors.TraversalError()
39
        with open(page_file) as fd:
40
            content = fd.read()
41
        template.html_top()
42
        return content
wcs/root.py
36 36
from .qommon import _, errors, get_cfg, ident, misc, saml2, template
37 37
from .qommon.afterjobs import AfterJobStatusDirectory
38 38
from .qommon.form import Form, RadiobuttonsWidget
39
from .qommon.pages import PagesDirectory
40 39
from .qommon.upload_storage import UploadStorageError, get_storage_object
41 40

  
42 41

  
......
253 252
        'myspace',
254 253
        'user',
255 254
        'roles',
256
        'pages',
257 255
        ('tmp-upload', 'tmp_upload'),
258 256
        'api',
259 257
        'tryauth',
......
266 264

  
267 265
    api = ApiDirectory()
268 266
    myspace = MyspaceDirectory()
269
    pages = PagesDirectory()
270 267
    fargo = portfolio.FargoDirectory()
271 268
    static = StaticsDirectory()
272 269
    actions = ActionsDirectory()
273
-