dji.rebuild_cache(item) where item is Person; need rest of items

svn: r19590
This commit is contained in:
Doug Blank 2012-05-19 13:11:36 +00:00
parent 85dcc46d39
commit 12f00bf61d
2 changed files with 12 additions and 3 deletions

View File

@ -1467,6 +1467,14 @@ class DjangoInterface(object):
self.add_media_ref_list(event, media_list)
self.add_citation_list(event, citation_list)
def rebuild_cache(self, item):
if isinstance(item, models.Person):
raw = self.get_person(item)
item.cache = base64.encodestring(cPickle.dumps(raw))
item.save()
else:
raise Exception("Don't know how to cache '%s'" % type(item))
def rebuild_caches(self, callback=None):
"""
Call this to rebuild the caches for all primary models.

View File

@ -9,10 +9,11 @@ except RuntimeError:
from webapp.grampsdb.models import *
from webapp.dbdjango import DbDjango
from webapp.reports import import_file
from webapp.libdjango import DjangoInterface
db = DbDjango()
dji = DjangoInterface()
def Print(m):
print m
#def Print(m):
# print m
#import_file(db, "/tmp/dblank-im_ged.ged", Print)