aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas "Cakeisalie5" Touhey <thomas@touhey.fr>2018-10-05 13:58:57 +0200
committerThomas "Cakeisalie5" Touhey <thomas@touhey.fr>2018-10-05 13:58:57 +0200
commitaacdcf1e860c9afc687b868dc7417307e75efc8a (patch)
treefcd041e98a20fd8faa148d9d0bc9c7e998aa6fd6
parent01943b11bb2c6822aea034bb5939e0001386a138 (diff)
Corrected a little thing about operations parsing.
-rwxr-xr-xsgdfi/__main__.py6
-rwxr-xr-xsgdfi/_manager.py8
-rwxr-xr-xsgdfi/_repr.py8
3 files changed, 17 insertions, 5 deletions
diff --git a/sgdfi/__main__.py b/sgdfi/__main__.py
index 4e6776e..d729e77 100755
--- a/sgdfi/__main__.py
+++ b/sgdfi/__main__.py
@@ -71,7 +71,7 @@ def test_load():
from ._manager import Manager
man = Manager()
- ret = man.load_dump("2018100414530000-functions.xml")
+ ret = man.load_dump("2018100513245400-operations.html")
if type(ret) == list:
for e in ret:
@@ -89,8 +89,8 @@ def test_funcs():
s.export_functions(f)
if __name__ == '__main__':
- test_repr()
- #test_session()
+ #test_repr()
+ test_session()
#test_save()
#test_load()
#test_funcs()
diff --git a/sgdfi/_manager.py b/sgdfi/_manager.py
index aec2eb4..8630030 100755
--- a/sgdfi/_manager.py
+++ b/sgdfi/_manager.py
@@ -530,9 +530,15 @@ class Manager:
# Operation creation.
op = _Operation()
+ op.author.name = ename
+ if not op.author.name:
+ # XXX: Bogus event of type `Individu /`… for now we're
+ # ignoring it.
+
+ continue
+
op.time = dt
op.type = etype
- op.author = ename
op.fields = edesc
# Objects decoding.
diff --git a/sgdfi/_repr.py b/sgdfi/_repr.py
index 3d73312..9ff0334 100755
--- a/sgdfi/_repr.py
+++ b/sgdfi/_repr.py
@@ -52,6 +52,8 @@ class _Name:
raise ValueError("Expected a string.")
value = value.split()
+ if not value:
+ return
# Try to decode the title (if there is one).
@@ -81,6 +83,9 @@ class _Name:
return f"{self.__class__.__name__}({', '.join(p)})"
+ def __bool__(self):
+ return bool(str(self))
+
def __str__(self):
ops = []
@@ -341,7 +346,8 @@ class Operation(_Base):
time = _DateProperty()
type = _ValueProperty(cls = _OperationTypeData)
- author = _ObjectProperty(types = (Adherent,), default = Adherent())
+ author = _ObjectProperty(types = (Adherent,),
+ default = Adherent())
fields = _OperationFieldsProperty()
related = _ArrayProperty(types = (Structure, Adherent,
RallyRegistration, Camp, Place))