1
# -*- coding: utf-8 -*-
2
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
4
##########################################################################
5
# OpenLP - Open Source Lyrics Projection #
6
# ---------------------------------------------------------------------- #
7
# Copyright (c) 2008-2019 OpenLP Developers #
8
# ---------------------------------------------------------------------- #
9
# This program is free software: you can redistribute it and/or modify #
10
# it under the terms of the GNU General Public License as published by #
11
# the Free Software Foundation, either version 3 of the License, or #
12
# (at your option) any later version. #
14
# This program is distributed in the hope that it will be useful, #
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
17
# GNU General Public License for more details. #
19
# You should have received a copy of the GNU General Public License #
20
# along with this program. If not, see <https://www.gnu.org/licenses/>. #
21
##########################################################################
23
This module contains some helpers for serializing Path objects in Pyro4
26
from openlp.core.common.path import Path
28
from pathlib import Path
30
from Pyro4.util import SerializerBase
33
def path_class_to_dict(obj):
35
Serialize a Path object for Pyro4
43
def path_dict_to_class(classname, d):
44
return Path(d['parts'])
47
def register_classes():
49
Register the serializers
51
SerializerBase.register_class_to_dict(Path, path_class_to_dict)
52
SerializerBase.register_dict_to_class('Path', path_dict_to_class)