Back to being able to import; need to decide how to store alt_name_list

This commit is contained in:
Doug Blank 2015-05-09 21:29:48 -04:00
parent 40fa203659
commit 4e0927eba4
3 changed files with 13 additions and 6 deletions

View File

@ -266,7 +266,7 @@ class DbDjango(DbWriteBase, DbReadBase):
self.use_import_cache = True
self.import_cache = {}
@transaction.commit_on_success
@transaction.atomic
def commit_import(self):
"""
Commits the items that were queued up during the last gedcom

View File

@ -439,10 +439,10 @@ class Tag(models.Model):
if self.dji is None:
self.dji = DjangoInterface()
raw = self.dji.get_tag(self)
return base64.encodestring(pickle.dumps(raw))
return base64.encodebytes(pickle.dumps(raw))
def from_cache(self):
return pickle.loads(base64.decodestring(self.cache))
return pickle.loads(base64.decodebytes(bytes(self.cache, "utf-8")))
def save_cache(self):
cache = self.make_cache()
@ -529,10 +529,10 @@ class PrimaryObject(models.Model):
raw = self.dji.get_tag(self)
else:
raise Exception("Don't know how to get raw '%s'" % type(item))
return base64.encodestring(pickle.dumps(raw))
return base64.encodebytes(pickle.dumps(raw))
def from_cache(self):
return pickle.loads(base64.decodestring(self.cache))
return pickle.loads(base64.decodebytes(bytes(self.cache, "utf-8")))
def save_cache(self):
cache = self.make_cache()

View File

@ -454,7 +454,7 @@ class DjangoInterface(object):
media.gramps_id,
conv_to_unicode(media.path, None),
str(media.mime),
fix_encoding(media.desc),
str(media.desc),
media.checksum,
attribute_list,
citation_list,
@ -806,6 +806,9 @@ class DjangoInterface(object):
for family_handle in family_list:
self.add_family_ref(person, family_handle)
def add_alt_name_list(self, place, alt_name_list):
print("FIXME: add alt_name_list!", alt_name_list)
## Export reference objects:
def add_person_ref_default(self, obj, person, private=False, desc=None):
@ -1579,9 +1582,11 @@ class DjangoInterface(object):
#obj.save()
def add_place(self, data):
## ('cef246c95c132bcf6a0255d4d17', 'P0036', 'Santa Clara Co., CA, USA', '', '', [('cef243fb5634559442323368f63', None)], 'Santa Clara Co.', [], (3, ''), '', [], [], [], [], [], 1422124781, [], False)
(handle, gid, title, long, lat,
place_ref_list,
name,
alt_name_list,
place_type,
code,
alt_location_list,
@ -1612,6 +1617,7 @@ class DjangoInterface(object):
(handle, gid, title, long, lat,
place_ref_list,
name,
alt_name_list,
place_type,
code,
alt_location_list,
@ -1635,6 +1641,7 @@ class DjangoInterface(object):
self.add_note_list(place, note_list)
self.add_tag_list(place, tag_list)
self.add_place_ref_list(place, place_ref_list)
self.add_alt_name_list(place, alt_name_list)
count = 1
for loc_data in alt_location_list:
self.add_location("place", place, loc_data, count)