Exemplo n.º 1
0
def _save_cached_profile(user_id, user, multisite_keys, non_contact_keys):
    # type: (UserId, UserSpec, List[str], List[str]) -> None
    # Only save contact AND multisite attributes to the profile. Not the
    # infos that are stored in the custom attribute files.
    cache = {}
    for key in user.keys():
        if key in multisite_keys or key not in non_contact_keys:
            cache[key] = user[key]

    config.save_user_file("cached_profile", cache, user_id=user_id)
Exemplo n.º 2
0
    def save_user_instances(cls, owner: _Optional[UserId] = None) -> None:
        if not owner:
            owner = config.user.id

        save_dict = {}
        for page in cls.instances():
            if page.owner() == owner:
                save_dict[page.name()] = page.internal_representation()

        config.save_user_file('user_%ss' % cls.type_name(), save_dict, owner)
Exemplo n.º 3
0
def save_cached_profile(user_id: UserId, cached_profile: UserSpec) -> None:
    config.save_user_file("cached_profile", cached_profile, user_id=user_id)