예제 #1
0
파일: views.py 프로젝트: kalloc/iktomi-cms
 def app(self):
     return web.method('POST') | web.cases(
         Rule('/_update_lock/<string:item_id>/<string:edit_session>',
              self.update_lock),
         Rule('/_force_lock/<string:item_id>', self.force_lock),
         Rule('/_release_lock/<string:item_id>/<string:edit_session>',
              self.release_lock))
예제 #2
0
파일: loner.py 프로젝트: Lehych/iktomi-cms
 def app(self):
     prepare = self.PrepareItemHandler(self)
     return web.cases(
             web.match('', '') | prepare | self,
             web.match('/autosave', 'autosave') | \
                     web.method('POST', strict=True) | prepare | self.autosave
         )
예제 #3
0
파일: filter.py 프로젝트: riffm/iktomi
    def test_simple_match(self):
        """Method"""
        from webob.exc import HTTPMethodNotAllowed

        app = web.cases(
            web.match("/", "simple") | web.method("post"),
            web.match("/second", "second") | web.method("POST"),
            web.match("/strict", "strict") | web.method("post", strict=True),
        ) | (lambda e, d: Response())

        self.assertEqual(web.ask(app, "/"), None)
        self.assertEqual(web.ask(app, "/", method="post").status_int, 200)
        self.assertEqual(web.ask(app, "/second", method="post").status_int, 200)

        self.assertRaises(HTTPMethodNotAllowed, lambda: web.ask(app, "/strict").status_int)
        self.assertEqual(web.ask(app, "/strict", method="post").status_int, 200)
예제 #4
0
파일: filter.py 프로젝트: oas89/iktomi
    def test_simple_match(self):
        '''Method'''
        from webob.exc import HTTPMethodNotAllowed

        app = web.cases(
                web.match('/', 'simple') | web.method('post'),
                web.match('/second', 'second') | web.method('POST'),
                web.match('/strict', 'strict') | web.method('post', strict=True)
            ) | (lambda e,d: Response())

        self.assertEqual(web.ask(app, '/'), None)
        self.assertEqual(web.ask(app, '/', method='post').status_int, 200)
        self.assertEqual(web.ask(app, '/second', method='post').status_int, 200)

        self.assertRaises(HTTPMethodNotAllowed, lambda: web.ask(app, '/strict').status_int)
        self.assertEqual(web.ask(app, '/strict', method='post').status_int, 200)
예제 #5
0
 def app(self):
     prepare = self.PrepareItemHandler(self)
     return web.cases(
             web.match('', '') | prepare | self,
             web.match('/autosave', 'autosave') | \
                     web.method('POST', strict=True) | prepare | self.autosave
         )
예제 #6
0
 def app(self):
     # Be careful, put prepare handler only after match! Otherwise it brakes
     # file upload (yes, its not obvious!)
     prepare = self.PrepareItemHandler(self)
     return self.app_prefix | web.cases(
         web.match("", "") | prepare | self,
         web.match("/autosave", "autosave") | web.method("POST", strict=True) | prepare | self.autosave,
     )
예제 #7
0
파일: views.py 프로젝트: Lehych/iktomi-cms
 def app(self):
     return web.method('POST') | web.cases(
         Rule('/_update_lock/<string:item_id>/<string:edit_session>',
              self.update_lock),
         Rule('/_force_lock/<string:item_id>',
              self.force_lock),
         Rule('/_release_lock/<string:item_id>/<string:edit_session>',
              self.release_lock))
예제 #8
0
 def app(self):
     return web.prefix('/tray') | web.cases(
         Rule('/<int:tray>', self.tray),
         web.prefix('/_') | web.method('POST', strict=True) | web.cases(
             Rule('/put', self.put_to_tray),
             Rule('/user/put', self.put_to_user_tray),
             Rule('/delete', self.delete_from_tray),
         )
     )
예제 #9
0
 def app(self):
     # Be careful, put prepare handler only after match! Otherwise it brakes
     # file upload (yes, its not obvious!)
     prepare = self.PrepareItemHandler(self)
     return self.app_prefix | web.cases(
             web.match('', '') | prepare | self,
             web.match('/autosave', 'autosave') | \
                     web.method('POST', strict=True) | prepare | self.autosave
         )
예제 #10
0
 def app(self):
     # Be careful, put prepare handler only after match! Otherwise it brakes
     # file upload (yes, its not obvious!)
     prepare =  self.PrepareItemHandler(self)
     return self.app_prefix | web.cases(
             web.match('', '') | prepare | self,
             web.match('/autosave', 'autosave') | \
                     web.method('POST', strict=True) | prepare |self.autosave
         )
예제 #11
0
파일: filter.py 프로젝트: vlaght/iktomi
    def test_simple_match(self):
        '''Method'''
        from webob.exc import HTTPMethodNotAllowed

        app = web.cases(
            web.match('/', 'simple') | web.method('post'),
            web.match('/second', 'second') | web.method('POST'),
            web.match('/strict', 'strict')
            | web.method('post', strict=True)) | (lambda e, d: Response())

        self.assertEqual(web.ask(app, '/'), None)
        self.assertEqual(web.ask(app, '/', method='post').status_int, 200)
        self.assertEqual(
            web.ask(app, '/second', method='post').status_int, 200)

        self.assertRaises(HTTPMethodNotAllowed,
                          lambda: web.ask(app, '/strict').status_int)
        self.assertEqual(
            web.ask(app, '/strict', method='post').status_int, 200)
예제 #12
0
파일: filter.py 프로젝트: oas89/iktomi
 def test_repr(self):
     # for coverage
     '%r' % web.WebHandler()
     '%r' % web.cases()
     '%r' % web.request_filter(lambda e, d, n: None)
     '%r' % web.match('/', 'index')
     '%r' % web.method('GET')
     '%r' % web.static_files('/prefix')
     '%r' % web.prefix('/prefix')
     '%r' % web.subdomain('name')
     '%r' % web.namespace('name')
예제 #13
0
파일: filter.py 프로젝트: vlaght/iktomi
 def test_repr(self):
     # for coverage
     '%r' % web.WebHandler()
     '%r' % web.cases()
     '%r' % web.request_filter(lambda e, d, n: None)
     '%r' % web.match('/', 'index')
     '%r' % web.method('GET')
     '%r' % web.static_files('/prefix')
     '%r' % web.prefix('/prefix')
     '%r' % web.subdomain('name')
     '%r' % web.namespace('name')
예제 #14
0
파일: filter.py 프로젝트: riffm/iktomi
 def test_repr(self):
     # for coverage
     "%r" % web.WebHandler()
     "%r" % web.cases()
     "%r" % web.request_filter(lambda e, d, n: None)
     "%r" % web.match("/", "index")
     "%r" % web.method("GET")
     "%r" % web.static_files("/prefix")
     "%r" % web.prefix("/prefix")
     "%r" % web.subdomain("name")
     "%r" % web.namespace("name")
예제 #15
0
파일: auth.py 프로젝트: riffm/iktomi
 def logout(self, redirect_to='/'):
     '''
     This property will return component which will handle logout requests.
     It only handles POST requests and do not display any rendered content.
     This handler deletes session id from `storage`. If there is no
     session id provided or id is incorrect handler silently redirects to
     login url and does not throw any exception.
     '''
     def _logout(env, data):
         response = HTTPSeeOther(location=str(redirect_to))
         self.logout_user(env.request, response)
         return response
     return web.match('/logout', 'logout') | web.method('post') | _logout
예제 #16
0
파일: auth.py 프로젝트: motor23/cmstest
    def logout(self, redirect_to='/'):
        '''
        This property will return component which will handle logout requests.
        It only handles POST requests and do not display any rendered content.
        This handler deletes session id from `storage`. If there is no
        session id provided or id is incorrect handler silently redirects to
        login url and does not throw any exception.
        '''
        def _logout(env, data):
            location = redirect_to
            if location is None and env.request.referer:
                location = env.request.referer
            elif location is None:
                location = '/'
            response = HTTPSeeOther(location=str(location))
            self.logout_user(env.request, response)
            return response

        return web.match('/logout', 'logout') | web.method('post') | _logout
 def app(self):
     return web.method('POST') | web.match('/edit', 'list_edit') | self
예제 #18
0
 def app(self):
     return self.app_prefix | self.PrepareItemHandler(self) | web.cases(
             web.match('', '') | self,
             web.match('/autosave', 'autosave') | \
                     web.method('POST', strict=True) | self.autosave
         )
예제 #19
0
파일: loner.py 프로젝트: Lehych/iktomi-cms
 def app(self):
     return web.match('/%s' % self.action, self.action) | \
            web.method('POST', strict=True) | \
            self.PrepareItemHandler(self) | self
예제 #20
0
 def app(self):
     return web.match('/%s' % self.action, self.action) | \
            web.method('POST', strict=True) | \
            self.PrepareItemHandler(self) | self
예제 #21
0
파일: stream.py 프로젝트: Lehych/iktomi-cms
 def app(self):
     return web.match('/<idconv:item>/%s' % self.action, self.action,
                      convs={'idconv': self.stream.id_converter}) | \
            web.method('POST', strict=True) | \
            self.PrepareItemHandler(self) | self
예제 #22
0
파일: filter.py 프로젝트: riffm/iktomi
 def test_head(self):
     handler = web.method("GET")
     self.assertEqual(handler._names, set(["GET", "HEAD"]))
예제 #23
0
 def app(self):
     return web.method('POST') | web.match('/edit', 'list_edit') | self
예제 #24
0
파일: filter.py 프로젝트: oas89/iktomi
 def test_head(self):
     handler = web.method('GET')
     self.assertEqual(handler._names, set(['GET', 'HEAD']))
예제 #25
0
 def app(self):
     return web.match('/<idconv:item>/%s' % self.action, self.action,
                      convs={'idconv': self.stream.id_converter}) | \
            web.method('POST', strict=True) | \
            self.PrepareItemHandler(self) | self
예제 #26
0
파일: filter.py 프로젝트: vlaght/iktomi
 def test_head(self):
     handler = web.method('GET')
     self.assertEqual(handler._names, set(['GET', 'HEAD']))
예제 #27
0
    web.cases(
        Rule('/', h.index, method='GET'),
        method('POST') | web.cases(
            Rule('/_update_lock/<string:item_id>/<string:edit_session>',
                 h.update_lock),
            Rule('/_force_lock/<string:item_id>',
                 h.force_lock),
            Rule('/_release_lock/<string:item_id>/<string:edit_session>',
                 h.release_lock),

            web.match('/_tmp_img', 'load_tmp_image') | h.load_tmp_image,
            Rule('/_post_note', h.post_note),
        ),
        web.prefix('/tray') | web.cases(
            Rule('/<int:tray>', h.tray_view.tray),
            web.prefix('/_') | web.method('POST', strict=True) | web.cases(
                Rule('/put', h.tray_view.put_to_tray),
                Rule('/user/put', h.tray_view.put_to_user_tray),
                Rule('/delete', h.tray_view.delete_from_tray),
            )
        ),
        streams.streams.to_app(),
        loners.loners.to_app(),
        web.prefix('/_front/<any(admin,front):version>/<any(en,ru):lang>', name='front') | 
            front_environment | front_app,

    ),

    HTTPNotFound, # XXX does not work without this
)