7582: [Python2] Cannot remove a person having an event reference

This commit is contained in:
Josip 2014-04-06 19:07:41 +02:00
parent f7e144f853
commit fa3645bf15
2 changed files with 9 additions and 9 deletions

View File

@ -419,10 +419,7 @@ class DbUndoBSDDB(DbUndo):
"""
Open the undo/redo database
"""
path = (self.path.encode(sys.getfilesystemencoding())
if (isinstance(self.path, UNITYPE) and win()
and sys.version_info[0] < 3)
else self.path)
path = self.path
self.undodb.open(path, db.DB_RECNO, db.DB_CREATE)
def close(self):

View File

@ -437,7 +437,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
dbmap = db.DB(self.env)
dbmap.set_flags(flags)
fname = _encode(os.path.join(file_name, table_name + DBEXT))
fname = os.path.join(file_name, table_name + DBEXT)
if self.readonly:
dbmap.open(fname, table_name, dbtype, DBFLAGS_R)
@ -448,7 +448,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
def __open_shelf(self, file_name, table_name, dbtype=db.DB_HASH):
dbmap = dbshelve.DBShelf(self.env)
fname = _encode(os.path.join(file_name, table_name + DBEXT))
fname = os.path.join(file_name, table_name + DBEXT)
if self.readonly:
dbmap.open(fname, table_name, dbtype, DBFLAGS_R)
@ -778,7 +778,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
env_name = name
try:
self.env.open(_encode(env_name), env_flags)
self.env.open(env_name, env_flags)
except Exception as msg:
_LOG.warning("Error opening db environment: " + str(msg))
try:
@ -1304,7 +1304,10 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
raise DbError(_('An attempt is made to save a reference key '
'which is partly bytecode, this is not allowed.\n'
'Key is %s') % str(key))
key = str(key)
if sys.version_info[0] >= 3:
key= str(tuple(k for k in key))
else:
key = str(tuple(k.decode('utf-8') for k in key))
if isinstance(key, UNITYPE):
key = key.encode('utf-8')
if not self.readonly:
@ -2404,7 +2407,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
# Environment name is now based on the filename
env_name = name
self.env.open(_encode(env_name), env_flags)
self.env.open(env_name, env_flags)
self.env.txn_checkpoint()
self.metadata = self.__open_shelf(full_name, META)