Пример #1
0
    def get(self):
        logging.debug("GET")
        self.response.headers['Content-Type'] = 'text/html'

        if utilities.user_is_logged_in():
            if not utilities.user_exists():
                utilities.add_new_user(utilities.get_user())

            renderer.render_addanagram(self, utilities.get_logout_url(self),
                                 utilities.get_anagrams_of_user(utilities.get_my_user()))

        else:
            renderer.render_login(self, utilities.get_login_url(self))
Пример #2
0
    def get(self):
        self.response.headers['Content-Type'] = 'text/html'

        if utilities.user_is_logged_in():

            if not utilities.user_exists():
                utilities.add_new_user(utilities.get_user())
            result, wordCount, totalCount = utilities.get_anagrams_of_user(
                utilities.get_my_user())
            renderer.render_main(self, utilities.get_logout_url(self), result,
                                 wordCount, totalCount)

        else:
            renderer.render_login(self, utilities.get_login_url(self))
    def get(self):
        logging.debug("GET")
        self.response.headers['Content-Type'] = 'text/html'

        if utilities.user_is_logged_in():
            if not utilities.user_exists():
                utilities.add_new_user(utilities.get_user())

            renderer.render_searchtext(
                self, utilities.get_logout_url(self),
                utilities.generate_id(self.request.get('value')),
                utilities.prepare_text_input(self.request.get('value')),
                utilities.get_anagrams_of_user(utilities.get_my_user()))

        else:
            renderer.render_login(self, utilities.get_login_url(self))
Пример #4
0
    def get(self):
        logging.debug("GET")
        self.response.headers['Content-Type'] = 'text/html'

        if utilities.user_is_logged_in():
            # if myuser object is None --> No user with key found --> new user --> make new user in datastore
            if not utilities.user_exists():
                utilities.add_new_user(utilities.get_user())

            renderer.render_subanagram(
                self, utilities.get_logout_url(self), self.request.get('name'),
                utilities.get_anagrams_of_user(utilities.get_my_user()))

        # if no user is logged in create login url
        else:
            renderer.render_login(self, utilities.get_login_url(self))
Пример #5
0
    def get(self):
        logging.debug('GET')
        self.response.headers['Content-Type'] = 'text/html'

        # check whether user is logged in
        if utilities.is_user_logged_in():
            # if myuser object is None --> No user with key found --> new user --> make new user in datastore
            if not utilities.user_exists():
                utilities.add_new_user(utilities.get_user())

            self.navigate()

            # get all directories and files in the current path
            directories_in_current_path = utilities.get_directories_in_current_path()
            files_in_current_path = utilities.get_files_in_current_path()

            # sort all directories and files alphabetically
            directories_in_current_path = utilities.sort_list(directories_in_current_path)
            files_in_current_path = utilities.sort_list(files_in_current_path)

            # extract file and directory names from the key list
            # so that only the names have to be send to the gui and not the whole object
            directories_in_current_path = utilities.get_names_from_list(directories_in_current_path)
            files_in_current_path = utilities.get_names_from_list(files_in_current_path)

            renderer.render_main(self,
                                 utilities.get_logout_url(self),
                                 directories_in_current_path,
                                 files_in_current_path,
                                 utilities.get_current_directory_object().path,
                                 utilities.is_in_root_directory(),
                                 blobstore.create_upload_url('/upload'))

        # if no user is logged in create login url
        else:
            renderer.render_login(self, utilities.get_login_url(self))