Copy deepcopy fix to src/web (thanks P. Franklin); removed workaround
svn: r18314
This commit is contained in:
parent
9b90430c29
commit
b07514e0d1
@ -31,7 +31,6 @@
|
|||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
import math
|
import math
|
||||||
import copy
|
import copy
|
||||||
import sys
|
|
||||||
from gen.ggettext import gettext as _
|
from gen.ggettext import gettext as _
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
@ -109,11 +108,7 @@ class AncestorReport(Report):
|
|||||||
|
|
||||||
# Copy the global NameDisplay so that we don't change application
|
# Copy the global NameDisplay so that we don't change application
|
||||||
# defaults.
|
# defaults.
|
||||||
try:
|
|
||||||
self._name_display = copy.deepcopy(global_name_display)
|
self._name_display = copy.deepcopy(global_name_display)
|
||||||
except:
|
|
||||||
print >> sys.stderr, "WARNING: unable to deepcopy name_display; continuing..."
|
|
||||||
self._name_display = global_name_display
|
|
||||||
name_format = menu.get_option_by_name("name_format").get_value()
|
name_format = menu.get_option_by_name("name_format").get_value()
|
||||||
if name_format != 0:
|
if name_format != 0:
|
||||||
self._name_display.set_default_format(name_format)
|
self._name_display.set_default_format(name_format)
|
||||||
|
@ -34,7 +34,6 @@
|
|||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
import copy
|
import copy
|
||||||
import sys
|
|
||||||
from gen.ggettext import gettext as _
|
from gen.ggettext import gettext as _
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
@ -141,11 +140,7 @@ class DetAncestorReport(Report):
|
|||||||
|
|
||||||
# Copy the global NameDisplay so that we don't change application
|
# Copy the global NameDisplay so that we don't change application
|
||||||
# defaults.
|
# defaults.
|
||||||
try:
|
|
||||||
self._name_display = copy.deepcopy(global_name_display)
|
self._name_display = copy.deepcopy(global_name_display)
|
||||||
except:
|
|
||||||
print >> sys.stderr, "WARNING: unable to deepcopy name_display; continuing..."
|
|
||||||
self._name_display = global_name_display
|
|
||||||
|
|
||||||
name_format = menu.get_option_by_name("name_format").get_value()
|
name_format = menu.get_option_by_name("name_format").get_value()
|
||||||
if name_format != 0:
|
if name_format != 0:
|
||||||
|
@ -130,3 +130,13 @@ CACHE_BACKEND = 'locmem://'
|
|||||||
TRANSACTIONS_MANAGED = False
|
TRANSACTIONS_MANAGED = False
|
||||||
LOCALE_PATHS = tuple()
|
LOCALE_PATHS = tuple()
|
||||||
|
|
||||||
|
# In versions < 2.7 python does not properly copy methods when doing a
|
||||||
|
# deepcopy. This workaround makes the copy work properly. When Gramps no longer
|
||||||
|
# supports python 2.6, this workaround can be removed.
|
||||||
|
import sys
|
||||||
|
if sys.version_info < (2, 7) :
|
||||||
|
import copy
|
||||||
|
import types
|
||||||
|
def _deepcopy_method(x, memo):
|
||||||
|
return type(x)(x.im_func, copy.deepcopy(x.im_self, memo), x.im_class)
|
||||||
|
copy._deepcopy_dispatch[types.MethodType] = _deepcopy_method
|
||||||
|
Loading…
Reference in New Issue
Block a user