Пример #1
0
    def _global(self, app_name):
        self._data["applications"] = ApplicationService.get_applications(self._data["user"]["_id"])
        self._data["keyword"] = ""

        # Get Applications
        if app_name:

            app_name = app_name.replace("/", "")
            app = ApplicationService.get_application_by_url_name(self._data["user"]["_id"], app_name)

            if not app:
                raise tornado.web.HTTPError(404)

            self._data["current_application"] = str(app["_id"])

        else:
            app = ApplicationService.get_first_application(self._data["user"]["_id"])
            self._data["current_application"] = str(app["_id"])

        if app:
            app_name = app["url_name"]
        else:
            app_name = ""

        self._data["app"] = app
        self._data["app_name"] = app_name

        return app, app_name
Пример #2
0
    def _global(self, app_name):
        self._data['applications'] = ApplicationService.get_applications(self._data['user']['_id'])
        self._data['keyword'] = ''

        #Get Applications
        if app_name:

            app_name = app_name.replace('/', '')
            app = ApplicationService.get_application_by_url_name(
                            self._data['user']['_id'], app_name
                  )

            if not app:
                raise tornado.web.HTTPError(404)

            self._data['current_application'] = str(app['_id'])

        else:
            app = ApplicationService.get_first_application(self._data['user']['_id'])

        if app:
            app_name = app['url_name']
            self._data['current_application'] = str(app['_id'])
        else:
            app_name = ''

        self._data['app'] = app
        self._data['app_name'] = app_name

        return app, app_name