gedcom import works on-line

svn: r19546
This commit is contained in:
Doug Blank 2012-05-17 02:59:37 +00:00
parent cb0d0a2c81
commit 5d6f91a82e
4 changed files with 1221 additions and 11 deletions

View File

@ -960,31 +960,40 @@ class DbDjango(DbWriteBase, DbReadBase):
return obj.handle return obj.handle
def commit_person(self, person, trans, change_time=None): def commit_person(self, person, trans, change_time=None):
self.import_cache[person.handle] = person if person.handle not in self.import_cache:
self.import_cache[person.handle] = person
def commit_family(self, family, trans, change_time=None): def commit_family(self, family, trans, change_time=None):
self.import_cache[family.handle] = family if family.handle not in self.import_cache:
self.import_cache[family.handle] = family
def commit_citation(self, citation, trans, change_time=None): def commit_citation(self, citation, trans, change_time=None):
self.import_cache[citation.handle] = citation if citation.handle not in self.import_cache:
self.import_cache[citation.handle] = citation
def commit_source(self, source, trans, change_time=None): def commit_source(self, source, trans, change_time=None):
self.import_cache[source.handle] = source if source.handle not in self.import_cache:
self.import_cache[source.handle] = source
def commit_repository(self, repository, trans, change_time=None): def commit_repository(self, repository, trans, change_time=None):
self.import_cache[repository.handle] = repository if repository.handle not in self.import_cache:
self.import_cache[repository.handle] = repository
def commit_note(self, note, trans, change_time=None): def commit_note(self, note, trans, change_time=None):
self.import_cache[note.handle] = note if note.handle not in self.import_cache:
self.import_cache[note.handle] = note
def commit_place(self, place, trans, change_time=None): def commit_place(self, place, trans, change_time=None):
self.import_cache[place.handle] = place if place.handle not in self.import_cache:
self.import_cache[place.handle] = place
def commit_event(self, event, trans, change_time=None): def commit_event(self, event, trans, change_time=None):
self.import_cache[event.handle] = event if event.handle not in self.import_cache:
self.import_cache[event.handle] = event
def commit_tag(self, tag, trans, change_time=None): def commit_tag(self, tag, trans, change_time=None):
self.import_cache[tag.handle] = tag if tag.handle not in self.import_cache:
self.import_cache[tag.handle] = tag
def commit_media_object(self, obj, transaction, change_time=None): def commit_media_object(self, obj, transaction, change_time=None):
""" """

1183
src/webapp/empty.sql Normal file

File diff suppressed because it is too large Load Diff

View File

@ -65,7 +65,7 @@ def import_file(db, filename, callback):
etype, exception, traceback = error_tuple etype, exception, traceback = error_tuple
print "ERROR:", name, exception print "ERROR:", name, exception
return False return False
import_function = getattr(mod, pdata.import_function) retval = import_function = getattr(mod, pdata.import_function)
db.prepare_import() db.prepare_import()
import_function(db, filename, callback) import_function(db, filename, callback)
db.commit_import() db.commit_import()
@ -73,7 +73,7 @@ def import_file(db, filename, callback):
for person in Person.objects.all(): for person in Person.objects.all():
person.probably_alive = not bool(person.death) person.probably_alive = not bool(person.death)
person.save() person.save()
return True return retval
return False return False
def download(url, filename=None): def download(url, filename=None):

18
src/webapp/shell.py Normal file
View File

@ -0,0 +1,18 @@
from django.conf import settings
import webapp.settings as default_settings
try:
settings.configure(default_settings)
except RuntimeError:
# already configured; ignore
pass
from webapp.grampsdb.models import *
from webapp.dbdjango import DbDjango
from webapp.reports import import_file
db = DbDjango()
def Print(m):
print m
import_file(db, "/tmp/dblank-im_ged.ged", Print)