mirror of https://github.com/zulip/zulip.git
18 lines
728 B
Python
18 lines
728 B
Python
|
from typing import List, Dict, Any
|
||
|
from django.forms.models import model_to_dict
|
||
|
|
||
|
from zerver.models import Realm
|
||
|
|
||
|
# stubs
|
||
|
ZerverFieldsT = Dict[str, Any]
|
||
|
|
||
|
def build_zerver_realm(realm_id: int, realm_subdomain: str, time: float,
|
||
|
other_product: str) -> List[ZerverFieldsT]:
|
||
|
realm = Realm(id=realm_id, date_created=time,
|
||
|
name=realm_subdomain, string_id=realm_subdomain,
|
||
|
description=("Organization imported from %s!" % (other_product)))
|
||
|
auth_methods = [[flag[0], flag[1]] for flag in realm.authentication_methods]
|
||
|
realm_dict = model_to_dict(realm, exclude='authentication_methods')
|
||
|
realm_dict['authentication_methods'] = auth_methods
|
||
|
return[realm_dict]
|