Changeset 4446
- Timestamp:
- 04/05/09 15:14:47 (4 years ago)
- Location:
- trunk/umit/merger
- Files:
-
- 1 added
- 3 modified
-
errors.py (added)
-
merge_ini.py (modified) (3 diffs)
-
sqlitedb.py (modified) (2 diffs)
-
tests/test_sqlitemerge.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/umit/merger/merge_ini.py
r4437 r4446 2 2 import shutil 3 3 import ConfigParser 4 5 from umit.merger.errors import OriginError, DestinationError 4 6 5 7 def merge(from_file, to_file): … … 9 11 @return true or false 10 12 """ 11 if not os.path.exists(from_file) or not os.path.exists(to_file): 12 return False 13 if not os.path.exists(from_file): 14 raise OriginError(from_file) 15 if not os.path.exists(to_file): 16 raise DestinationError(to_file) 13 17 14 18 # Read new file … … 43 47 config.write(f) 44 48 45 return True46 47 49 def copy_section(config, config_new, section): 48 50 config.add_section(section) -
trunk/umit/merger/sqlitedb.py
r4432 r4446 9 9 except ImportError: 10 10 from pysqlite2 import dbapi2 as sqlite 11 12 from umit.merger.errors import OriginError, DestinationError 11 13 12 14 def _dict_factory(cursor, row): … … 154 156 155 157 def _merge(self): 158 if not os.path.isfile(self._fromdb): 159 raise OriginError("%r is not a file." % self._fromdb) 160 156 161 new = sqlite.connect(self._fromdb) 157 162 self._fromcursor = new_cursor = new.cursor(_DictCursor) 158 163 159 164 if not os.path.isfile(self._todb): 160 raise Exception("The older db%r is not a file." % self._todb)165 raise DestinationError("%r is not a file." % self._todb) 161 166 162 167 old = sqlite.connect(self._todb) -
trunk/umit/merger/tests/test_sqlitemerge.py
r4431 r4446 3 3 from test.test_support import run_unittest 4 4 5 from sqlitedb import sqlite, merge, column_definitions, _DictCursor5 from umit.merger.sqlitedb import sqlite, merge, column_definitions, _DictCursor 6 6 7 7 def conn_cursor(name):
