gedcom import works on-line
svn: r19546
This commit is contained in:
parent
cb0d0a2c81
commit
5d6f91a82e
@ -960,30 +960,39 @@ 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):
|
||||||
|
if person.handle not in self.import_cache:
|
||||||
self.import_cache[person.handle] = person
|
self.import_cache[person.handle] = person
|
||||||
|
|
||||||
def commit_family(self, family, trans, change_time=None):
|
def commit_family(self, family, trans, change_time=None):
|
||||||
|
if family.handle not in self.import_cache:
|
||||||
self.import_cache[family.handle] = family
|
self.import_cache[family.handle] = family
|
||||||
|
|
||||||
def commit_citation(self, citation, trans, change_time=None):
|
def commit_citation(self, citation, trans, change_time=None):
|
||||||
|
if citation.handle not in self.import_cache:
|
||||||
self.import_cache[citation.handle] = citation
|
self.import_cache[citation.handle] = citation
|
||||||
|
|
||||||
def commit_source(self, source, trans, change_time=None):
|
def commit_source(self, source, trans, change_time=None):
|
||||||
|
if source.handle not in self.import_cache:
|
||||||
self.import_cache[source.handle] = source
|
self.import_cache[source.handle] = source
|
||||||
|
|
||||||
def commit_repository(self, repository, trans, change_time=None):
|
def commit_repository(self, repository, trans, change_time=None):
|
||||||
|
if repository.handle not in self.import_cache:
|
||||||
self.import_cache[repository.handle] = repository
|
self.import_cache[repository.handle] = repository
|
||||||
|
|
||||||
def commit_note(self, note, trans, change_time=None):
|
def commit_note(self, note, trans, change_time=None):
|
||||||
|
if note.handle not in self.import_cache:
|
||||||
self.import_cache[note.handle] = note
|
self.import_cache[note.handle] = note
|
||||||
|
|
||||||
def commit_place(self, place, trans, change_time=None):
|
def commit_place(self, place, trans, change_time=None):
|
||||||
|
if place.handle not in self.import_cache:
|
||||||
self.import_cache[place.handle] = place
|
self.import_cache[place.handle] = place
|
||||||
|
|
||||||
def commit_event(self, event, trans, change_time=None):
|
def commit_event(self, event, trans, change_time=None):
|
||||||
|
if event.handle not in self.import_cache:
|
||||||
self.import_cache[event.handle] = event
|
self.import_cache[event.handle] = event
|
||||||
|
|
||||||
def commit_tag(self, tag, trans, change_time=None):
|
def commit_tag(self, tag, trans, change_time=None):
|
||||||
|
if tag.handle not in self.import_cache:
|
||||||
self.import_cache[tag.handle] = tag
|
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
1183
src/webapp/empty.sql
Normal file
File diff suppressed because it is too large
Load Diff
@ -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
18
src/webapp/shell.py
Normal 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)
|
Loading…
Reference in New Issue
Block a user