Mercurial > p > roundup > code
annotate locale/GNUmakefile @ 6433:c1d3fbcdbfbd
issue2551142 - Import of retired node ... unique constraint failure.
Title: Import of retired node with username after active node fails
with unique constraint failure.
More fixes needed for mysql and postgresql.
mysql: add unique constraint for (keyvalue, __retired__) when
creating class in the database.
On schema change if class is changed, remove the unique
constraint too.
upgrade version of rdbms database from 5 to 6 to add constraint
to all version 5 databases that were created as version 5
and didn't get the unique constraint. Make no changes
on version 5 databases upgraded from version 4, the upgrade
process to 5 added the constraint. Make no changes
to other databases (sqlite, postgres) during upgrade from
version 5 to 6.
postgres: Handle the exception raised on unique constraint violation.
The exception invalidates the database connection so it
can't be used to recover from the exception.
Added two new database methods:
checkpoint_data - performs a db.commit under postgres
does nothing on other backends
restore_connection_on_error - does a db.rollback on
postgres, does nothing on other
backends
with the rollback() done on the connection I can use the
database connection to fixup the import that failed on the
unique constraint. This makes postgres slower but without the
commit after every imported object, the rollback will delete
all the entries done up to this point.
Trying to figure out how to make the caller do_import batch
and recover from this failure is beyond me.
Also dismissed having to process the export csv file before
importing. Pushing that onto a user just seems wrong. Also
since import/export isn't frequently done the lack of
surprise on having a failing import and reduced
load/frustration for the user seems worth it. Also the import
can be run in verbose mode where it prints out a row as it is
processed, so it may take a while, ut the user can get
feedback.
db_test-base.py: add test for upgrade from 5 to 6.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Thu, 10 Jun 2021 12:52:05 -0400 |
| parents | a21b574554c3 |
| children | 0f0cee081990 |
| rev | line source |
|---|---|
|
2330
8ae58eda9331
in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2306
diff
changeset
|
1 # Extract translatable strings from Roundup sources, |
|
8ae58eda9331
in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2306
diff
changeset
|
2 # update and compile all existing translations |
|
8ae58eda9331
in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2306
diff
changeset
|
3 |
|
8ae58eda9331
in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2306
diff
changeset
|
4 # tool locations |
|
8ae58eda9331
in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2306
diff
changeset
|
5 XPOT ?= xpot |
|
8ae58eda9331
in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2306
diff
changeset
|
6 MSGFMT ?= msgfmt |
|
8ae58eda9331
in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2306
diff
changeset
|
7 MSGMERGE ?= msgmerge |
|
8ae58eda9331
in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2306
diff
changeset
|
8 XGETTEXT ?= xgettext |
|
2384
33469189bf86
extract messages from web templates
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2383
diff
changeset
|
9 PYTHON ?= python |
|
2330
8ae58eda9331
in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2306
diff
changeset
|
10 |
|
8ae58eda9331
in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2306
diff
changeset
|
11 TEMPLATE=roundup.pot |
|
2306
1421b19cd61b
build message template file
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
diff
changeset
|
12 |
|
4094
5a9631828e33
update message template file building:
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
3761
diff
changeset
|
13 PACKAGES=$(shell find ../roundup ../share/roundup/templates -name '*.py' \ |
|
3761
800bc51a9c8e
add template directories to the list of Python packages for message extraction
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
3593
diff
changeset
|
14 | sed -e 's,/[^/]*$$,,' | sort | uniq) |
|
2330
8ae58eda9331
in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2306
diff
changeset
|
15 SOURCES=$(PACKAGES:=/*.py) |
|
8ae58eda9331
in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2306
diff
changeset
|
16 PO_FILES=$(wildcard *.po) |
|
8ae58eda9331
in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2306
diff
changeset
|
17 MO_FILES=$(PO_FILES:.po=.mo) |
|
6222
2c0f7f16ce04
Check that build link is present otherwise abort.
John Rouillard <rouilj@ieee.org>
parents:
4570
diff
changeset
|
18 PYTHON_BUILD=../build/lib |
|
2c0f7f16ce04
Check that build link is present otherwise abort.
John Rouillard <rouilj@ieee.org>
parents:
4570
diff
changeset
|
19 RUN_PYTHON=PYTHONPATH=$(PYTHON_BUILD) $(PYTHON) -O |
|
2330
8ae58eda9331
in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2306
diff
changeset
|
20 |
|
2455
ece6ed48dd3d
by default, build binary message catalogs only...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2384
diff
changeset
|
21 all: dist |
|
ece6ed48dd3d
by default, build binary message catalogs only...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2384
diff
changeset
|
22 |
|
ece6ed48dd3d
by default, build binary message catalogs only...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2384
diff
changeset
|
23 help: |
|
ece6ed48dd3d
by default, build binary message catalogs only...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2384
diff
changeset
|
24 @echo "$(MAKE) - build MO files. Run this before sdist" |
|
ece6ed48dd3d
by default, build binary message catalogs only...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2384
diff
changeset
|
25 @echo "$(MAKE) template - update message template from sources" |
|
ece6ed48dd3d
by default, build binary message catalogs only...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2384
diff
changeset
|
26 @echo "$(MAKE) locale.po - update message file from template" |
|
ece6ed48dd3d
by default, build binary message catalogs only...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2384
diff
changeset
|
27 @echo "$(MAKE) locale.mo - compile individual message file" |
|
ece6ed48dd3d
by default, build binary message catalogs only...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2384
diff
changeset
|
28 @echo "$(MAKE) help - this text"\ |
|
2330
8ae58eda9331
in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2306
diff
changeset
|
29 |
|
2455
ece6ed48dd3d
by default, build binary message catalogs only...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2384
diff
changeset
|
30 # This will rebuild all MO files without updating their corresponding PO |
|
ece6ed48dd3d
by default, build binary message catalogs only...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2384
diff
changeset
|
31 # files first. Run before creating Roundup distribution (hence the name). |
|
ece6ed48dd3d
by default, build binary message catalogs only...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2384
diff
changeset
|
32 # PO files should be updated by their translators only, automatic update |
|
ece6ed48dd3d
by default, build binary message catalogs only...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2384
diff
changeset
|
33 # adds unwanted fuzzy labels. |
|
ece6ed48dd3d
by default, build binary message catalogs only...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2384
diff
changeset
|
34 dist: |
|
ece6ed48dd3d
by default, build binary message catalogs only...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2384
diff
changeset
|
35 for file in $(PO_FILES); do \ |
|
ece6ed48dd3d
by default, build binary message catalogs only...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2384
diff
changeset
|
36 ${MSGFMT} -o `basename $$file .po`.mo $$file; \ |
|
ece6ed48dd3d
by default, build binary message catalogs only...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2384
diff
changeset
|
37 done |
|
2306
1421b19cd61b
build message template file
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
diff
changeset
|
38 |
|
2455
ece6ed48dd3d
by default, build binary message catalogs only...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2384
diff
changeset
|
39 template: |
|
6222
2c0f7f16ce04
Check that build link is present otherwise abort.
John Rouillard <rouilj@ieee.org>
parents:
4570
diff
changeset
|
40 test -d $(PYTHON_BUILD) || (echo "Missing build directory. ln -s lib to build library"; exit 1) |
|
2459
fd04f41ab988
fix: 'template' target was meant to make 'roundup.pot' file
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2455
diff
changeset
|
41 ${XPOT} -n -o $(TEMPLATE) $(SOURCES) |
|
6222
2c0f7f16ce04
Check that build link is present otherwise abort.
John Rouillard <rouilj@ieee.org>
parents:
4570
diff
changeset
|
42 |
|
2459
fd04f41ab988
fix: 'template' target was meant to make 'roundup.pot' file
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2455
diff
changeset
|
43 ${RUN_PYTHON} ../roundup/cgi/TAL/talgettext.py -u $(TEMPLATE) \ |
|
4094
5a9631828e33
update message template file building:
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
3761
diff
changeset
|
44 ../share/roundup/templates/classic/html/*.html \ |
|
6405
a21b574554c3
extract translatable strings from devel and responsive templates
John Rouillard <rouilj@ieee.org>
parents:
6222
diff
changeset
|
45 ../share/roundup/templates/devel/html/*.html \ |
|
a21b574554c3
extract translatable strings from devel and responsive templates
John Rouillard <rouilj@ieee.org>
parents:
6222
diff
changeset
|
46 ../share/roundup/templates/minimal/html/*.html \ |
|
a21b574554c3
extract translatable strings from devel and responsive templates
John Rouillard <rouilj@ieee.org>
parents:
6222
diff
changeset
|
47 ../share/roundup/templates/responsive/html/*.html |
|
2330
8ae58eda9331
in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2306
diff
changeset
|
48 ${XGETTEXT} -j -w 80 -F \ |
|
8ae58eda9331
in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2306
diff
changeset
|
49 --msgid-bugs-address=roundup-devel@lists.sourceforge.net \ |
|
8ae58eda9331
in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2306
diff
changeset
|
50 --copyright-holder="See Roundup README.txt" \ |
|
2459
fd04f41ab988
fix: 'template' target was meant to make 'roundup.pot' file
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2455
diff
changeset
|
51 -o $(TEMPLATE) $(SOURCES) |
|
2330
8ae58eda9331
in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2306
diff
changeset
|
52 |
|
3578
782287e01b99
added template diff target: view changes in message strings
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2459
diff
changeset
|
53 # helps to check template file before check in |
|
782287e01b99
added template diff target: view changes in message strings
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2459
diff
changeset
|
54 diff: |
|
4094
5a9631828e33
update message template file building:
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
3761
diff
changeset
|
55 svn diff roundup.pot|grep -v '^[-+]#'|vim -Rv - |
|
3578
782287e01b99
added template diff target: view changes in message strings
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2459
diff
changeset
|
56 |
|
2330
8ae58eda9331
in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2306
diff
changeset
|
57 %.po: $(TEMPLATE) |
|
3593
3d9e1906ba58
don't wrap po files at position 72
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
3578
diff
changeset
|
58 ${MSGMERGE} -U --suffix=.bak $@ $< |
|
2330
8ae58eda9331
in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2306
diff
changeset
|
59 |
|
8ae58eda9331
in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2306
diff
changeset
|
60 %.mo: %.po |
|
2342
106737dbe689
show statistics for message catalogs
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2330
diff
changeset
|
61 ${MSGFMT} --statistics -o $@ $< |
