From 5da10c5a807c007ff31d5682d327b68493fc196a Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Sat, 14 Mar 2015 23:48:32 +0000 Subject: [PATCH] Replace cuni with str --- gramps/cli/test/cli_test.py | 5 +- gramps/gen/constfunc.py | 4 +- gramps/gen/datehandler/_datehandler.py | 6 +- gramps/gen/db/read.py | 16 +- gramps/gen/db/test/grampsdbtestbase.py | 4 +- gramps/gen/db/upgrade.py | 4 +- gramps/gen/db/write.py | 16 +- gramps/gen/display/name.py | 4 +- gramps/gen/lib/baseobj.py | 9 +- gramps/gen/lib/citation.py | 5 +- gramps/gen/lib/eventtype.py | 3 +- gramps/gen/lib/grampstype.py | 3 +- gramps/gen/lib/note.py | 3 +- gramps/gen/lib/repo.py | 5 +- gramps/gen/lib/src.py | 17 +- gramps/gen/lib/styledtext.py | 1 - gramps/gen/lib/tableobj.py | 3 +- gramps/gen/plug/_options.py | 1 - gramps/gen/plug/docbackend/docbackend.py | 17 +- gramps/gen/plug/report/_book.py | 5 +- gramps/gen/plug/report/utils.py | 3 +- gramps/gen/utils/db.py | 3 +- gramps/gen/utils/debug.py | 3 +- gramps/gen/utils/docgen/odstab.py | 3 +- gramps/gen/utils/file.py | 4 +- gramps/gui/clipboard.py | 5 +- gramps/gui/dialog.py | 1 - gramps/gui/displaystate.py | 9 +- gramps/gui/editors/addmedia.py | 8 +- gramps/gui/editors/displaytabs/gallerytab.py | 4 +- gramps/gui/editors/editperson.py | 3 +- gramps/gui/editors/filtereditor.py | 13 +- gramps/gui/filters/_filtercombobox.py | 7 +- gramps/gui/filters/_searchbar.py | 6 +- .../filters/sidebar/_citationsidebarfilter.py | 25 +- .../filters/sidebar/_eventsidebarfilter.py | 15 +- .../filters/sidebar/_familysidebarfilter.py | 13 +- .../filters/sidebar/_mediasidebarfilter.py | 15 +- .../gui/filters/sidebar/_notesidebarfilter.py | 7 +- .../filters/sidebar/_personsidebarfilter.py | 5 +- .../filters/sidebar/_placesidebarfilter.py | 13 +- .../gui/filters/sidebar/_reposidebarfilter.py | 13 +- .../filters/sidebar/_sourcesidebarfilter.py | 15 +- gramps/gui/plug/_guioptions.py | 8 +- gramps/gui/plug/report/_bookdialog.py | 7 +- gramps/gui/plug/report/_papermenu.py | 9 +- gramps/gui/plug/report/_stylecombobox.py | 4 +- gramps/gui/plug/report/_styleeditor.py | 7 +- gramps/gui/thumbnails.py | 4 +- gramps/gui/views/tags.py | 3 +- .../gui/views/treemodels/citationbasemodel.py | 27 +-- gramps/gui/views/treemodels/eventmodel.py | 5 +- gramps/gui/views/treemodels/familymodel.py | 5 +- gramps/gui/views/treemodels/flatbasemodel.py | 4 +- gramps/gui/views/treemodels/mediamodel.py | 18 +- gramps/gui/views/treemodels/notemodel.py | 7 +- gramps/gui/views/treemodels/peoplemodel.py | 9 +- gramps/gui/views/treemodels/placemodel.py | 9 +- gramps/gui/views/treemodels/repomodel.py | 29 ++- gramps/gui/views/treemodels/sourcemodel.py | 11 +- gramps/gui/views/treemodels/treebasemodel.py | 1 - gramps/gui/widgets/grampletpane.py | 1 - gramps/gui/widgets/monitoredwidgets.py | 11 +- gramps/gui/widgets/styledtextbuffer.py | 5 +- gramps/gui/widgets/undoablebuffer.py | 5 +- gramps/gui/widgets/validatedmaskedentry.py | 7 +- gramps/guiQML/views/centralview.py | 2 - gramps/guiQML/views/dbman.py | 1 - gramps/guiQML/views/personview.py | 1 - gramps/plugins/docgen/rtfdoc.py | 3 +- gramps/plugins/export/exportgedcom.py | 9 +- gramps/plugins/export/exportxml.py | 6 +- gramps/plugins/gramplet/eval.py | 3 +- gramps/plugins/gramplet/recordsgramplet.py | 3 +- gramps/plugins/gramplet/soundgen.py | 3 +- gramps/plugins/importer/importcsv.py | 2 +- gramps/plugins/importer/importgeneweb.py | 4 +- gramps/plugins/lib/libgedcom.py | 2 +- gramps/plugins/lib/libhtml.py | 5 +- gramps/plugins/lib/libsubstkeyword.py | 7 +- gramps/plugins/textreport/recordsreport.py | 3 +- gramps/plugins/tool/check.py | 4 +- gramps/plugins/tool/mediamanager.py | 11 +- gramps/plugins/tool/notrelated.py | 3 +- gramps/plugins/tool/testcasegenerator.py | 13 +- gramps/plugins/view/mediaview.py | 4 +- gramps/plugins/webreport/narrativeweb.py | 48 ++-- gramps/webapp/grampsdb/models.py | 77 +++--- gramps/webapp/grampsdb/profile.py | 4 +- gramps/webapp/utils.py | 227 +++++++++--------- 90 files changed, 433 insertions(+), 532 deletions(-) diff --git a/gramps/cli/test/cli_test.py b/gramps/cli/test/cli_test.py index 20cbcea8d..c62b7de92 100644 --- a/gramps/cli/test/cli_test.py +++ b/gramps/cli/test/cli_test.py @@ -26,7 +26,6 @@ import re import io import subprocess -from gramps.gen.constfunc import cuni from gramps.gen.const import TEMP_DIR test_ged = """0 HEAD @@ -126,8 +125,8 @@ class UnicodeTest(unittest.TestCase): from gramps.gen.config import set as setconfig, get as getconfig from gramps.gen.dbstate import DbState self.newpath = os.path.join(os.path.dirname(__file__), - cuni('\u0393\u03c1\u03b1\u03bc\u03c3\u03c0')) - self.newtitle = cuni('Gr\u00e4mps T\u00e9st') + '\u0393\u03c1\u03b1\u03bc\u03c3\u03c0') + self.newtitle = 'Gr\u00e4mps T\u00e9st' os.makedirs(self.newpath) self.old_path = getconfig('behavior.database-path') setconfig('behavior.database-path', self.newpath) diff --git a/gramps/gen/constfunc.py b/gramps/gen/constfunc.py index 2a2d4641e..1860ccb1f 100644 --- a/gramps/gen/constfunc.py +++ b/gramps/gen/constfunc.py @@ -50,10 +50,8 @@ WINDOWS = ["Windows", "win32"] # Public Functions # #------------------------------------------------------------------------- - -cuni = str def conv_to_unicode(x, y='utf8'): - return x if x is None or isinstance(x, str) else cuni(x, y) if y else cuni(x) + return x if x is None or isinstance(x, str) else str(x, y) if y else str(x) # handle in database is bytes, while internally Gramps wants unicode for py3 handle2internal = lambda x: conv_to_unicode(x, 'utf-8') diff --git a/gramps/gen/datehandler/_datehandler.py b/gramps/gen/datehandler/_datehandler.py index 9362bbaf9..54fbbb98b 100644 --- a/gramps/gen/datehandler/_datehandler.py +++ b/gramps/gen/datehandler/_datehandler.py @@ -44,7 +44,7 @@ log = logging.getLogger(".gen.datehandler") #------------------------------------------------------------------------- from ._dateparser import DateParser from ._datedisplay import DateDisplay, DateDisplayEn -from ..constfunc import win, cuni +from ..constfunc import win from ..const import GRAMPS_LOCALE as glocale from gramps.gen.utils.grampslocale import GrampsLocale @@ -69,8 +69,8 @@ if LANG: else: LANG_SHORT = "C" -LANG = cuni(LANG) -LANG_SHORT = cuni(LANG_SHORT) +LANG = str(LANG) +LANG_SHORT = str(LANG_SHORT) LANG_TO_PARSER = { 'C' : DateParser, diff --git a/gramps/gen/db/read.py b/gramps/gen/db/read.py index 190674117..87dc112d6 100644 --- a/gramps/gen/db/read.py +++ b/gramps/gen/db/read.py @@ -73,7 +73,7 @@ from ..utils.cast import conv_dbstr_to_unicode from . import (BsddbBaseCursor, DbReadBase) from ..utils.id import create_id from ..errors import DbError -from ..constfunc import cuni, handle2internal, get_env_var +from ..constfunc import handle2internal, get_env_var from ..const import GRAMPS_LOCALE as glocale _ = glocale.translation.gettext @@ -1307,7 +1307,7 @@ class DbBsddbRead(DbReadBase, Callback): if id_number.isdigit(): id_value = int(id_number, 10) ## this code never ran, as an int compared to str with > is False! -## if len(cuni(id_value)) > nr_width: +## if len(str(id_value)) > nr_width: ## # The ID to be imported is too large to fit in the ## # users format. For now just create a new ID, ## # because that is also what happens with IDs that @@ -1784,14 +1784,14 @@ class DbBsddbRead(DbReadBase, Callback): first = first.encode('utf-8') if isinstance(second, str): second = second.encode('utf-8') - source1 = cuni(self.source_map[first][2]) - source2 = cuni(self.source_map[second][2]) + source1 = str(self.source_map[first][2]) + source2 = str(self.source_map[second][2]) return glocale.strcoll(source1, source2) def __sortbysource_key(self, key): if isinstance(key, str): key = key.encode('utf-8') - source = cuni(self.source_map[key][2]) + source = str(self.source_map[key][2]) return glocale.sort_key(source) def __sortbycitation(self, first, second): @@ -1799,14 +1799,14 @@ class DbBsddbRead(DbReadBase, Callback): first = first.encode('utf-8') if isinstance(second, str): second = second.encode('utf-8') - citation1 = cuni(self.citation_map[first][3]) - citation2 = cuni(self.citation_map[second][3]) + citation1 = str(self.citation_map[first][3]) + citation2 = str(self.citation_map[second][3]) return glocale.strcoll(citation1, citation2) def __sortbycitation_key(self, key): if isinstance(key, str): key = key.encode('utf-8') - citation = cuni(self.citation_map[key][3]) + citation = str(self.citation_map[key][3]) return glocale.sort_key(citation) def __sortbymedia(self, first, second): diff --git a/gramps/gen/db/test/grampsdbtestbase.py b/gramps/gen/db/test/grampsdbtestbase.py index 278eb480c..cdb8f7895 100644 --- a/gramps/gen/db/test/grampsdbtestbase.py +++ b/gramps/gen/db/test/grampsdbtestbase.py @@ -27,8 +27,6 @@ from gramps.cli.clidbman import CLIDbManager from gramps.gen.lib import (Source, RepoRef, Citation, Repository, Person, Family, Event, Place, MediaObject) -from gramps.gen.constfunc import cuni - class GrampsDbBaseTest(unittest.TestCase): """Base class for unittest that need to be able to create test databases.""" @@ -40,7 +38,7 @@ class GrampsDbBaseTest(unittest.TestCase): self._db = DbBsddb() dbman = CLIDbManager(None) - self._filename, title = dbman.create_new_db_cli(title=cuni("Test")) + self._filename, title = dbman.create_new_db_cli(title="Test") self._db.load(self._filename, dummy_callback, "w") def tearDown(self): diff --git a/gramps/gen/db/upgrade.py b/gramps/gen/db/upgrade.py index e9aeedc77..29c5eb8ab 100644 --- a/gramps/gen/db/upgrade.py +++ b/gramps/gen/db/upgrade.py @@ -41,7 +41,7 @@ from bsddb3 import db #------------------------------------------------------------------------- from ..const import GRAMPS_LOCALE as glocale _ = glocale.translation.gettext -from ..constfunc import cuni, handle2internal +from ..constfunc import handle2internal from ..lib.markertype import MarkerType from ..lib.nameorigintype import NameOriginType from ..lib.place import Place @@ -1103,7 +1103,7 @@ def convert_marker(self, marker_field): """Convert a marker into a tag.""" marker = MarkerType() marker.unserialize(marker_field) - tag_name = cuni(marker) + tag_name = str(marker) if tag_name != '': if tag_name not in self.tags: diff --git a/gramps/gen/db/write.py b/gramps/gen/db/write.py index b387479b6..bcf4ece07 100644 --- a/gramps/gen/db/write.py +++ b/gramps/gen/db/write.py @@ -80,7 +80,7 @@ from ..utils.cast import conv_dbstr_to_unicode from ..utils.id import create_id from ..updatecallback import UpdateCallback from ..errors import DbError -from ..constfunc import (win, conv_to_unicode, cuni, handle2internal, +from ..constfunc import (win, conv_to_unicode, handle2internal, get_env_var) from ..const import HOME_DIR, GRAMPS_LOCALE as glocale _ = glocale.translation.gettext @@ -551,7 +551,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback): """Older version of Berkeley DB can't read data created by a newer version.""" bdb_version = db.version() - versionpath = os.path.join(self.path, cuni(BDBVERSFN)) + versionpath = os.path.join(self.path, str(BDBVERSFN)) # Compare the current version of the database (bsddb_version) with the # version of the database code (env_version). If it is a downgrade, # raise an exception because we can't do anything. If they are the same, @@ -721,7 +721,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback): self.__check_python_version(name, force_python_upgrade) # Check for pickle upgrade - versionpath = os.path.join(self.path, cuni(PCKVERSFN)) + versionpath = os.path.join(self.path, str(PCKVERSFN)) if not os.path.isfile(versionpath) and \ not self.readonly and not self.update_pickle_version: _LOG.debug("Make backup in case there is a pickle upgrade") @@ -729,7 +729,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback): self.update_pickle_version = True # Check for schema upgrade - versionpath = os.path.join(self.path, cuni(SCHVERSFN)) + versionpath = os.path.join(self.path, str(SCHVERSFN)) if os.path.isfile(versionpath): with open(versionpath, "r") as version_file: schema_version = int(version_file.read().strip()) @@ -864,7 +864,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback): from . import upgrade UpdateCallback.__init__(self, callback) upgrade.gramps_upgrade_pickle(self) - versionpath = os.path.join(name, cuni(PCKVERSFN)) + versionpath = os.path.join(name, str(PCKVERSFN)) with open(versionpath, "w") as version_file: version = "Yes" version_file.write(version) @@ -879,7 +879,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback): (oldschema, newschema)) if force_schema_upgrade == True: self.gramps_upgrade(callback) - versionpath = os.path.join(name, cuni(SCHVERSFN)) + versionpath = os.path.join(name, str(SCHVERSFN)) with open(versionpath, "w") as version_file: version = str(_DBVERSION) version_file.write(version) @@ -2419,13 +2419,13 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback): with open(versionpath, "w") as version_file: version_file.write(version) - versionpath = os.path.join(name, cuni(PCKVERSFN)) + versionpath = os.path.join(name, str(PCKVERSFN)) _LOG.debug("Write pickle version file to %s" % "Yes") with open(versionpath, "w") as version_file: version = "Yes" version_file.write(version) - versionpath = os.path.join(name, cuni(SCHVERSFN)) + versionpath = os.path.join(name, str(SCHVERSFN)) _LOG.debug("Write schema version file to %s" % str(_DBVERSION)) with open(versionpath, "w") as version_file: version = str(_DBVERSION) diff --git a/gramps/gen/display/name.py b/gramps/gen/display/name.py index 89a44fab5..50cc9e75b 100644 --- a/gramps/gen/display/name.py +++ b/gramps/gen/display/name.py @@ -68,7 +68,7 @@ LOG = logging.getLogger(".gramps.gen") #------------------------------------------------------------------------- from ..const import ARABIC_COMMA, ARABIC_SEMICOLON, GRAMPS_LOCALE as glocale _ = glocale.translation.sgettext -from ..constfunc import cuni, conv_to_unicode +from ..constfunc import conv_to_unicode from ..lib.name import Name from ..lib.nameorigintype import NameOriginType @@ -816,7 +816,7 @@ class NameDisplay(object): return sur.get_surname() def sort_string(self, name): - return cuni("%-25s%-30s%s") % (self.primary_surname(name), + return "%-25s%-30s%s" % (self.primary_surname(name), name.first_name, name.suffix) def sorted(self, person): diff --git a/gramps/gen/lib/baseobj.py b/gramps/gen/lib/baseobj.py index 9024ab105..d1cb7f698 100644 --- a/gramps/gen/lib/baseobj.py +++ b/gramps/gen/lib/baseobj.py @@ -29,13 +29,6 @@ Base Object class for Gramps #------------------------------------------------------------------------- import re -#------------------------------------------------------------------------- -# -# GRAMPS modules -# -#------------------------------------------------------------------------- -from ..constfunc import cuni - #------------------------------------------------------------------------- # # Base Object @@ -118,7 +111,7 @@ class BaseObject(object): for item in self.get_text_data_list(): # Some items are strings, which will fail in item.upper(), and some items are unicode. # Convert all items to unicode and the item.upper().find(patern_upper) will work OK. - item = cuni(item) + item = str(item) if not item: continue if case_sensitive: diff --git a/gramps/gen/lib/citation.py b/gramps/gen/lib/citation.py index 8bddf6956..1b6c1a9c1 100644 --- a/gramps/gen/lib/citation.py +++ b/gramps/gen/lib/citation.py @@ -44,7 +44,6 @@ from .datebase import DateBase from .tagbase import TagBase from .attrbase import SrcAttributeBase from .citationbase import IndirectCitationBase -from ..constfunc import cuni from .handle import Handle #------------------------------------------------------------------------- @@ -86,7 +85,7 @@ class Citation(MediaBase, NoteBase, SrcAttributeBase, IndirectCitationBase, return (self.handle, # 0 self.gramps_id, # 1 DateBase.serialize(self, no_text_date),# 2 - cuni(self.page), # 3 + str(self.page), # 3 self.confidence, # 4 self.source_handle, # 5 NoteBase.serialize(self), # 6 @@ -120,7 +119,7 @@ class Citation(MediaBase, NoteBase, SrcAttributeBase, IndirectCitationBase, "handle": Handle("Citation", self.handle), # 0 "gramps_id": self.gramps_id, # 1 "date": DateBase.to_struct(self), # 2 - "page": cuni(self.page), # 3 + "page": str(self.page), # 3 "confidence": self.confidence, # 4 "source_handle": Handle("Source", self.source_handle), # 5 "note_list": NoteBase.to_struct(self), # 6 diff --git a/gramps/gen/lib/eventtype.py b/gramps/gen/lib/eventtype.py index 043877a5e..998bd0789 100644 --- a/gramps/gen/lib/eventtype.py +++ b/gramps/gen/lib/eventtype.py @@ -37,7 +37,6 @@ _ = glocale.translation.sgettext # #------------------------------------------------------------------------- from .grampstype import GrampsType -from ..constfunc import cuni class EventType(GrampsType): """ @@ -366,7 +365,7 @@ class EventType(GrampsType): if self.value in self._ABBREVIATIONS: return trans_text(self._ABBREVIATIONS[self.value]) else: - abbrev = cuni(self) + abbrev = str(self) if " " in abbrev: return ".".join([letter[0].lower() for letter in abbrev.split()]) + "." else: diff --git a/gramps/gen/lib/grampstype.py b/gramps/gen/lib/grampstype.py index d4fd0db67..2e018ea6f 100644 --- a/gramps/gen/lib/grampstype.py +++ b/gramps/gen/lib/grampstype.py @@ -30,7 +30,6 @@ Base type for all gramps types. #------------------------------------------------------------------------- from ..const import GRAMPS_LOCALE as glocale _ = glocale.translation.gettext -from ..constfunc import cuni _UNKNOWN = _('Unknown') @@ -228,7 +227,7 @@ class GrampsType(GrampsTypeC): """ return {"_class": self.__class__.__name__, "value": self.__value, - "string": cuni(self)} + "string": str(self)} @classmethod def from_struct(cls, struct): diff --git a/gramps/gen/lib/note.py b/gramps/gen/lib/note.py index 05ae42a81..c4cb3b97a 100644 --- a/gramps/gen/lib/note.py +++ b/gramps/gen/lib/note.py @@ -34,7 +34,6 @@ from .tagbase import TagBase from .notetype import NoteType from .styledtext import StyledText from .styledtexttagtype import StyledTextTagType -from ..constfunc import cuni from .handle import Handle #------------------------------------------------------------------------- @@ -203,7 +202,7 @@ class Note(BasicPrimaryObject): :returns: The *clear* text of the note contents. :rtype: unicode """ - return cuni(self.text) + return str(self.text) def set_styledtext(self, text): """Set the text associated with the note to the passed string. diff --git a/gramps/gen/lib/repo.py b/gramps/gen/lib/repo.py index 9553fdc8d..cb5ed8ee7 100644 --- a/gramps/gen/lib/repo.py +++ b/gramps/gen/lib/repo.py @@ -35,7 +35,6 @@ from .addressbase import AddressBase from .urlbase import UrlBase from .tagbase import TagBase from .repotype import RepositoryType -from ..constfunc import cuni from .handle import Handle from .citationbase import IndirectCitationBase @@ -64,7 +63,7 @@ class Repository(NoteBase, AddressBase, UrlBase, Convert the object to a serialized tuple of data. """ return (self.handle, self.gramps_id, self.type.serialize(), - cuni(self.name), + str(self.name), NoteBase.serialize(self), AddressBase.serialize(self), UrlBase.serialize(self), @@ -94,7 +93,7 @@ class Repository(NoteBase, AddressBase, UrlBase, "handle": Handle("Repository", self.handle), "gramps_id": self.gramps_id, "type": self.type.to_struct(), - "name": cuni(self.name), + "name": str(self.name), "note_list": NoteBase.to_struct(self), "address_list": AddressBase.to_struct(self), "urls": UrlBase.to_struct(self), diff --git a/gramps/gen/lib/src.py b/gramps/gen/lib/src.py index ed59fa170..1ae4a8934 100644 --- a/gramps/gen/lib/src.py +++ b/gramps/gen/lib/src.py @@ -37,7 +37,6 @@ from .tagbase import TagBase from .attrbase import SrcAttributeBase from .reporef import RepoRef from .const import DIFFERENT, EQUAL, IDENTICAL -from ..constfunc import cuni from .handle import Handle from .citationbase import IndirectCitationBase @@ -68,12 +67,12 @@ class Source(MediaBase, NoteBase, SrcAttributeBase, IndirectCitationBase, """ return (self.handle, # 0 self.gramps_id, # 1 - cuni(self.title), # 2 - cuni(self.author), # 3 - cuni(self.pubinfo), # 4 + str(self.title), # 2 + str(self.author), # 3 + str(self.pubinfo), # 4 NoteBase.serialize(self), # 5 MediaBase.serialize(self), # 6 - cuni(self.abbrev), # 7 + str(self.abbrev), # 7 self.change, # 8 SrcAttributeBase.serialize(self), # 9 [rr.serialize() for rr in self.reporef_list], # 10 @@ -103,12 +102,12 @@ class Source(MediaBase, NoteBase, SrcAttributeBase, IndirectCitationBase, return {"_class": "Source", "handle": Handle("Source", self.handle), "gramps_id": self.gramps_id, - "title": cuni(self.title), - "author": cuni(self.author), - "pubinfo": cuni(self.pubinfo), + "title": str(self.title), + "author": str(self.author), + "pubinfo": str(self.pubinfo), "note_list": NoteBase.to_struct(self), "media_list": MediaBase.to_struct(self), - "abbrev": cuni(self.abbrev), + "abbrev": str(self.abbrev), "change": self.change, "srcattr_list": SrcAttributeBase.to_struct(self), "reporef_list": [rr.to_struct() for rr in self.reporef_list], diff --git a/gramps/gen/lib/styledtext.py b/gramps/gen/lib/styledtext.py index d26682d55..5a90070d9 100644 --- a/gramps/gen/lib/styledtext.py +++ b/gramps/gen/lib/styledtext.py @@ -27,7 +27,6 @@ # #------------------------------------------------------------------------- from .styledtexttag import StyledTextTag -from ..constfunc import cuni #------------------------------------------------------------------------- # diff --git a/gramps/gen/lib/tableobj.py b/gramps/gen/lib/tableobj.py index 01575fbe9..3d4f0594d 100644 --- a/gramps/gen/lib/tableobj.py +++ b/gramps/gen/lib/tableobj.py @@ -36,7 +36,6 @@ import time # #------------------------------------------------------------------------- from .baseobj import BaseObject -from ..constfunc import cuni #------------------------------------------------------------------------- # @@ -112,7 +111,7 @@ class TableObject(BaseObject): """ if self.change: - return cuni(time.strftime('%x %X', time.localtime(self.change)), + return str(time.strftime('%x %X', time.localtime(self.change)), CODESET) else: return '' diff --git a/gramps/gen/plug/_options.py b/gramps/gen/plug/_options.py index ab73825f4..67fd19c37 100644 --- a/gramps/gen/plug/_options.py +++ b/gramps/gen/plug/_options.py @@ -51,7 +51,6 @@ except: # gramps modules # #------------------------------------------------------------------------- -from ..constfunc import cuni from ..utils.cast import get_type_converter from .menu import Menu from ..plug import BasePluginManager diff --git a/gramps/gen/plug/docbackend/docbackend.py b/gramps/gen/plug/docbackend/docbackend.py index 85a17ad0a..4c6d0c6e5 100644 --- a/gramps/gen/plug/docbackend/docbackend.py +++ b/gramps/gen/plug/docbackend/docbackend.py @@ -30,19 +30,6 @@ from ...const import GRAMPS_LOCALE as glocale _ = glocale.translation.gettext import io -#------------------------------------------------------------------------- -# -# GTK modules -# -#------------------------------------------------------------------------- - -#------------------------------------------------------------------------ -# -# Gramps modules -# -#------------------------------------------------------------------------ -from ...constfunc import cuni - #------------------------------------------------------------------------ # # Set up logging @@ -290,7 +277,7 @@ class DocBackend(object): escape_func = self.ESCAPE_FUNC self.ESCAPE_FUNC = lambda: (lambda text: text) #unicode text must be sliced correctly - text = cuni(text) + text = str(text) FIRST = 0 LAST = 1 tagspos = {} @@ -312,7 +299,7 @@ class DocBackend(object): keylist.sort() keylist = [x for x in keylist if x <= len(text)] opentags = [] - otext = cuni("") #the output, text with markup + otext = "" #the output, text with markup lensplit = len(split) for pos in keylist: #write text up to tag diff --git a/gramps/gen/plug/report/_book.py b/gramps/gen/plug/report/_book.py index f9c4ce03d..4af478680 100644 --- a/gramps/gen/plug/report/_book.py +++ b/gramps/gen/plug/report/_book.py @@ -64,7 +64,6 @@ from ...utils.cast import get_type_converter_by_name, type_name from ..docgen import StyleSheet, StyleSheetList from .. import BasePluginManager from . import book_categories -from ...constfunc import cuni #------------------------------------------------------------------------ # @@ -478,7 +477,7 @@ class BookList(object): len(options[option_name]) ) ) for list_index in range(len(option_value)): option_type = type_name(option_value[list_index]) - value = escape(cuni(option_value[list_index])) + value = escape(str(option_value[list_index])) value = value.replace('"', '"') f.write(' \n' % ( @@ -488,7 +487,7 @@ class BookList(object): f.write(' \n') else: option_type = type_name(option_value) - value = escape(cuni(option_value)) + value = escape(str(option_value)) value = value.replace('"', '"') f.write('