本文整理汇总了Python中organization.Organization.iter_orgs方法的典型用法代码示例。如果您正苦于以下问题:Python Organization.iter_orgs方法的具体用法?Python Organization.iter_orgs怎么用?Python Organization.iter_orgs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类organization.Organization
的用法示例。
在下文中一共展示了Organization.iter_orgs方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _upgrade_data
# 需要导入模块: from organization import Organization [as 别名]
# 或者: from organization.Organization import iter_orgs [as 别名]
def _upgrade_data(self):
version = self._get_version()
cur_version = self._get_data_version()
if cur_version and cur_version < self._get_version_int('0.10.5'):
logger.info('Upgrading data to v0.10.5...')
from server import Server
for server in Server.iter_servers():
server._upgrade_0_10_5()
from organization import Organization
for org in Organization.iter_orgs():
org._upgrade_0_10_5()
if cur_version and cur_version < self._get_version_int('0.10.6'):
logger.info('Upgrading data to v0.10.6...')
if self.password:
from cache import persist_db
logger.info('Upgrading config to v0.10.6...')
salt = base64.b64encode(
'2511cebca93d028393735637bbc8029207731fcf')
password = base64.b64encode(self.password.decode('hex'))
persist_db.dict_set('auth', 'password',
'0$%s$%s' % (salt, password))
self.password = None
self.commit()
from server import Server
for server in Server.iter_servers():
server._upgrade_0_10_6()
if cur_version and cur_version < self._get_version_int('0.10.9'):
logger.info('Upgrading data to v0.10.9...')
from server import Server
for server in Server.iter_servers():
server._upgrade_0_10_9()
from organization import Organization
for org in Organization.iter_orgs():
for user in org.iter_users():
user._upgrade_0_10_9()
org.sort_users_cache()
if cur_version != version:
from pritunl import __version__
version_path = os.path.join(self.data_path, VERSION_NAME)
with open(version_path, 'w') as version_file:
version_file.write('%s\n' % __version__)
示例2: _fill_cache
# 需要导入模块: from organization import Organization [as 别名]
# 或者: from organization.Organization import iter_orgs [as 别名]
def _fill_cache(self):
logger.info('Preloading cache...')
from organization import Organization
for org in Organization.iter_orgs():
org._cache_users()
from server import Server
for server in Server.iter_servers():
server.load()
示例3: _fill_users_pool
# 需要导入模块: from organization import Organization [as 别名]
# 或者: from organization.Organization import iter_orgs [as 别名]
def _fill_users_pool(self):
end = True
for org in itertools.chain(Organization.iter_orgs(),
Organization.iter_orgs_pool()):
if not cache_db.set_length('openssl_tasks') and \
app_server.user_pool_size - org.client_pool_count > 0:
end = False
org.new_user(type=CERT_CLIENT_POOL)
if not cache_db.set_length('openssl_tasks') and \
app_server.server_user_pool_size - \
org.server_pool_size > 0:
end = False
org.new_user(type=CERT_SERVER_POOL)
if not end:
self._fill_users_pool()