本文整理汇总了Python中models.File.gql方法的典型用法代码示例。如果您正苦于以下问题:Python File.gql方法的具体用法?Python File.gql怎么用?Python File.gql使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.File
的用法示例。
在下文中一共展示了File.gql方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from models import File [as 别名]
# 或者: from models.File import gql [as 别名]
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: get_request_file
# 需要导入模块: from models import File [as 别名]
# 或者: from models.File import gql [as 别名]
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]
示例3: file_exists
# 需要导入模块: from models import File [as 别名]
# 或者: from models.File import gql [as 别名]
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
示例4: get_file
# 需要导入模块: from models import File [as 别名]
# 或者: from models.File import gql [as 别名]
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
示例5: get_request_dir_files
# 需要导入模块: from models import File [as 别名]
# 或者: from models.File import gql [as 别名]
def get_request_dir_files(self):
"""
Получение файлов в директории, с которой производится работа
"""
files = File.gql('WHERE path = :1', self.dir_url())
return files.fetch(files.count())