本文整理汇总了Python中server.models.group.Group.all方法的典型用法代码示例。如果您正苦于以下问题:Python Group.all方法的具体用法?Python Group.all怎么用?Python Group.all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类server.models.group.Group
的用法示例。
在下文中一共展示了Group.all方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: deletedbs
# 需要导入模块: from server.models.group import Group [as 别名]
# 或者: from server.models.group.Group import all [as 别名]
def deletedbs():
"""
Delete the databases, the database path must have been set
first for this to work.
"""
from server.models import core
from server.models.ssuser import SSUser
from server.models.group import Group
# delete all core dbs and user and group dbs
server = core.server()
[group.delete() for group in core.objects(Group.all(core.connect()))]
[user.delete() for user in core.objects(SSUser.all(core.connect()))]
del server["shiftspace/public"]
del server["shiftspace/shared"]
del server["shiftspace/messages"]
del server["shiftspace/master"]
#[comment.deleteInstance() for comment in core.object(Comment.all(core.connect()))]
# cleanup, remove any empty folders (left from deleted users
try:
fh = open("config/conf.json")
except:
print "config/conf.json does not exist. Set the path the database first."
sys.exit(2)
conf = json.loads(fh.read())
if conf.get("dbpath"):
userdbdir = os.path.join(conf["dbpath"], "user")
if os.path.exists(userdbdir):
for file in os.listdir(userdbdir):
filepath = os.path.join(userdbdir, file)
if os.path.isdir(filepath):
os.rmdir(filepath)
os.rmdir(userdbdir)
grpdbdir = os.path.join(conf["dbpath"], "group")
if os.path.exists(grpdbdir):
os.rmdir(grpdbdir)
ssdbdir = os.path.join(conf["dbpath"], "shiftspace")
if os.path.exists(ssdbdir):
os.rmdir(ssdbdir)