コード例 #1
0
ファイル: files.py プロジェクト: sqba/zentxt
    def get(self):
        if not self.check_user(False):
            #self.logged_user_home()
            self.redirect('/')
            return

        max_results = 10
        tmp = self.request.get("max")
        if len(tmp):
            max_results = int(tmp)

        query = File.gql("WHERE author = :1", self.get_current_user())
        files = query.fetch(max_results);

        if len(files) > 0:
            head = files[0].head
        else:
            head = Revision()

        user = users.User(base.SUGGESTIONS_USER)
        query = File.gql("WHERE author = :1", user)
        public_files = query.fetch(50);
        files = files + public_files

        template_values = {
            'user'      : self.get_current_user(),
            'files'   	: files,
            'head'      : head,
            'login_url' : users.create_login_url(self.request.uri)
        }

        path = self.get_template_path( 'files.html' )
        self.response.out.write(template.render(path, template_values))
コード例 #2
0
    def get(self):
        if not self.check_user(False):
            #self.logged_user_home()
            self.redirect('/')
            return

        max_results = 10
        tmp = self.request.get("max")
        if len(tmp):
            max_results = int(tmp)

        query = File.gql("WHERE author = :1", self.get_current_user())
        files = query.fetch(max_results)

        if len(files) > 0:
            head = files[0].head
        else:
            head = Revision()

        user = users.User(base.SUGGESTIONS_USER)
        query = File.gql("WHERE author = :1", user)
        public_files = query.fetch(50)
        files = files + public_files

        template_values = {
            'user': self.get_current_user(),
            'files': files,
            'head': head,
            'login_url': users.create_login_url(self.request.uri)
        }

        path = self.get_template_path('files.html')
        self.response.out.write(template.render(path, template_values))
コード例 #3
0
 def get_request_file(self):
   """
   Получение файла, с которым производится работа
   """
   path, name = split_url(self.file_url())
   result = File.gql('WHERE path = :path AND name = :name', path=path, name=name)
   return result.fetch(1)[0]
コード例 #4
0
 def file_exists(self):
   """
   Провекта существования файла, с которым производится
   """
   path, name = split_url(self.file_url())
   result = File.gql('WHERE path = :path AND name = :name', path=path, name=name)
   return result.count() != 0
コード例 #5
0
 def get_request_file(self):
     """
 Получение файла, с которым производится работа
 """
     path, name = split_url(self.file_url())
     result = File.gql('WHERE path = :path AND name = :name',
                       path=path,
                       name=name)
     return result.fetch(1)[0]
コード例 #6
0
 def file_exists(self):
     """
 Провекта существования файла, с которым производится
 """
     path, name = split_url(self.file_url())
     result = File.gql('WHERE path = :path AND name = :name',
                       path=path,
                       name=name)
     return result.count() != 0
コード例 #7
0
ファイル: base.py プロジェクト: sqba/zentxt
 def get_file(self, id):
     query = File.gql("WHERE __key__ = :1", db.Key(id))
     entities = query.fetch(1)
     if len(entities) > 0:
         file = entities[0]
         #if self.get_file_permission(file):
         self.log_info("found file id=" + id)
         return file
     self.log_info("file not found")
     return None
コード例 #8
0
ファイル: base.py プロジェクト: sqba/zentxt
 def get_file(self, id):
     query = File.gql("WHERE __key__ = :1", db.Key(id))
     entities = query.fetch(1)
     if len(entities) > 0:
         file = entities[0]
         #if self.get_file_permission(file):
         self.log_info("found file id=" + id)
         return file
     self.log_info("file not found")
     return None
コード例 #9
0
 def get_request_dir_files(self):
   """
   Получение файлов в директории, с которой производится работа
   """
   files = File.gql('WHERE path = :1', self.dir_url())
   return files.fetch(files.count())
コード例 #10
0
 def get_files(self):
     result = File.gql('WHERE path = :1', self.get_current_path())
     return result.fetch(result.count())
コード例 #11
0
 def file_exists(self):
     path, name = split_url(self.get_current_path())
     result = File.gql('WHERE path = :path AND name = :name',
                       path=path,
                       name=name)
     return result.count() > 0