Example #1
0
 def load(self):
     params = self.params.copy()
     params.update({'APPLICATION_URLS': self.urls})
     settings = cms.get_settings(__file__, self.settings_file, **params)
     from djpsite.apps.geo import Geo
     from djpsite.apps.ws import WebSocketApps
     Geo.username = settings.GEOUSERNAME
     # Create the permission handler
     permissions = PermissionHandler(settings)
     permissions.auth_backends.append(SocialAuthBackend())
     backend = permissions.auth_backends[0]
     # AUTHENTICATION MIDDLEWARE
     self.add_wsgi_middleware(permissions.header_authentication_middleware)
     self.add_wsgi_middleware(permissions.request_middleware())
     self.add_response_middleware(permissions.response_middleware())
     # WEB SOCKET MIDDLEWARE
     self.add_wsgi_middleware(ws.WebSocket(WebSocketApps('/ws/', settings)))
     # The root site
     site = cms.Site(settings, permissions=permissions)
     site.submit_data_middleware.add(cms.Referrer)
     # Add CSRF submit middleware
     site.submit_data_middleware.add(CSRF)
     # admin site
     settings = cms.get_settings(
         __file__,
         self.settings_file,
         APPLICATION_URLS  = admin.make_admin_urls())
     site.addsite(settings, route='/admin/')
     self.page_layouts(site)
     return site
Example #2
0
 def load(self):
     params = self.params.copy()
     params.update({'APPLICATION_URLS': self.urls})
     settings = cms.get_settings(__file__, self.settings_file, **params)
     from djpsite.apps.geo import Geo
     from djpsite.apps.ws import WebSocketApps
     Geo.username = settings.GEOUSERNAME
     # Create the permission handler
     permissions = PermissionHandler(settings)
     permissions.auth_backends.append(SocialAuthBackend())
     backend = permissions.auth_backends[0]
     # AUTHENTICATION MIDDLEWARE
     self.add_wsgi_middleware(permissions.header_authentication_middleware)
     self.add_wsgi_middleware(permissions.request_middleware())
     self.add_response_middleware(permissions.response_middleware())
     # WEB SOCKET MIDDLEWARE
     self.add_wsgi_middleware(ws.WebSocket(WebSocketApps('/ws/', settings)))
     # The root site
     site = cms.Site(settings, permissions=permissions)
     site.submit_data_middleware.add(cms.Referrer)
     # Add CSRF submit middleware
     site.submit_data_middleware.add(CSRF)
     # admin site
     settings = cms.get_settings(__file__,
                                 self.settings_file,
                                 APPLICATION_URLS=admin.make_admin_urls())
     site.addsite(settings, route='/admin/')
     self.page_layouts(site)
     return site
Example #3
0
 def load_site(self, website):
     from djpcms.apps.admin import make_admin_urls
     site = super(TestCaseWidthAdmin,self).load_site(website)
     settings_admin = get_settings(self.settings,
                                   APPLICATION_URLS=make_admin_urls(),
                                   INSTALLED_APPS=self.installed_apps)
     site.addsite(settings_admin, route='/admin/')
     return site
Example #4
0
    def load_site(self, website):
        '''Called by the *website* itself. Don't call directly unless you know
what you are doing. Override if you need more granular control.'''
        settings=get_settings(settings=self.settings,
                                APPLICATION_URLS=self.urls,
                                INSTALLED_APPS=self.installed_apps)
        website.add_wsgi_middleware(self.wsgi_middleware())
        website.add_response_middleware(self.response_middleware())
        return Site(settings)
Example #5
0
 def testSubApplicationMeta2(self):
     from tests.models import Portfolio, User
     port = Application('portfolio/',
                        Portfolio,
                        parent_view='view',
                        related_field='user',
                        routes=(views.ViewView('<pid>/', name='view'),))
     app = Application('bla/', User, routes=(port,))
     site = cms.Site(cms.get_settings(APPLICATION_URLS=(app,)))
     view, urlargs = site.resolve('bla/56/portfolio/')
     self.assertEqual(urlargs,{'id':'56'})
     # Check urls
     urls = app.urls()
     self.assertEqual(len(urls), 6)
     view, urlargs = site.resolve('bla/56/portfolio/myportfolio/')
     self.assertEqual(urlargs,{'id':'56','pid':'myportfolio'})
Example #6
0
 def load(self):
     settings = cms.get_settings(__file__, APPLICATION_URLS=self.urls)
     return cms.Site(settings)
Example #7
0
 def load(self):
     settings = cms.get_settings(__file__, APPLICATION_URLS=self.urls)
     return cms.Site(settings)