本文整理汇总了Python中users.User.get_user_by_username方法的典型用法代码示例。如果您正苦于以下问题:Python User.get_user_by_username方法的具体用法?Python User.get_user_by_username怎么用?Python User.get_user_by_username使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类users.User
的用法示例。
在下文中一共展示了User.get_user_by_username方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_all_default_tiles
# 需要导入模块: from users import User [as 别名]
# 或者: from users.User import get_user_by_username [as 别名]
def get_all_default_tiles():
repository_user = User.get_user_by_username("repository")
tm_list = repository_user.get_resource_names("tile", tag_filter="default")
for tm in tm_list:
module_code = repository_user.get_tile_module(tm)
create_default_tiles(module_code)
示例2: create_initial_metadata
# 需要导入模块: from users import User [as 别名]
# 或者: from users.User import get_user_by_username [as 别名]
import pymongo
from pymongo import MongoClient
from users import User
import ssl
import datetime
rpath = "bsherinremtiles"
def create_initial_metadata():
mdata = {"datetime": datetime.datetime.today(), "tags": "", "notes": ""}
return mdata
repository_user = User.get_user_by_username("bsherin")
def add_tile_module(full_filename):
user_obj = repository_user
filename, file_extension = os.path.splitext(full_filename)
mdata = None
if file_extension == ".py":
if db[user_obj.tile_collection_name].find_one({"tile_module_name": filename}) is not None:
print "module name exists, deleting the old one"
mdata = grab_metadata(filename)
delete_tile_module(filename)
with open(rpath + "/" + full_filename) as f:
the_module = f.read()
if mdata is None:
mdata = create_initial_metadata()
示例3: int
# 需要导入模块: from users import User [as 别名]
# 或者: from users.User import get_user_by_username [as 别名]
# need to be imported by other modules.
import sys
import os
import pymongo
from pymongo import MongoClient
from users import User
import os
import datetime
rpath = "/repository_tiles"
dpath = "/downloads"
repository_user = User.get_user_by_username("repository")
try:
print "getting client"
use_ssl = os.environ.get("USE_SSL")
CHUNK_SIZE = int(os.environ.get("CHUNK_SIZE"))
STEP_SIZE = int(os.environ.get("STEP_SIZE"))
if ("USE_LOCAL_SERVER" in os.environ) and (os.environ.get("USE_LOCAL_SERVER") == "True"):
client = MongoClient("localhost", serverSelectionTimeoutMS=10)
# force connection on a request as the
# connect=True parameter of MongoClient seems
# to be useless here
client.server_info()
db = client.tacticdb
else: