Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding new terms to the glossary is not possible #6192

Closed
ghost opened this issue Jun 17, 2021 · 1 comment
Closed

Adding new terms to the glossary is not possible #6192

ghost opened this issue Jun 17, 2021 · 1 comment
Assignees
Labels
bug Something is broken. duplicate Similar issue or pull request already exists.
Milestone

Comments

@ghost
Copy link

ghost commented Jun 17, 2021

Description
An exception occurs (unique constraint violation) when trying to add a new term to the glossary.

I already tried

  • Checked your documentation
  • Tried different configurations for the glossary, specifically changed the file format configuration
  • Reset the entire installation/database to make sure the db is fresh
  • Upgraded from 4.6 to 4.6.2 - problem exists in both versions

To Reproduce the issue

  1. Add a new project
  2. Add a new component 'Start from Scratch' and use Java Properties ISO 8859-1
  3. Go to the glossary component and add another translation - German. It then contains English & German
  4. Click on 'Add new glossary term', fill in the fields and select 'Terminology'.
  5. Click on 'Add'

Expected behavior
The term is added

Actual behavior
An error screen is shown: unique constraint violation

Screenshots
image
image
image

Exception traceback

[17/Jun/2021 05:35:55] "POST /new-unit/test-project/glossary/de/ HTTP/1.1" 500 226066
[17/Jun/2021 05:36:48] "GET /projects/test-project/glossary/de/ HTTP/1.1" 200 94469
[2021-06-17 05:39:14,930: ERROR/7945] Internal Server Error: /new-unit/test-project/glossary/de/
Traceback (most recent call last):
  File "/root/weblate-env/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "trans_unit_translation_id_id_hash_ab945589_uniq"
DETAIL:  Key (translation_id, id_hash)=(12, -4294227979123926682) already exists.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/root/weblate-env/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/root/weblate-env/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/root/weblate-env/lib/python3.8/site-packages/django/views/decorators/http.py", line 40, in inner
    return func(request, *args, **kwargs)
  File "/root/weblate-env/lib/python3.8/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/root/weblate-env/lib/python3.8/site-packages/weblate/trans/views/edit.py", line 922, in new_unit
    new_unit = translation.add_unit(request, **form.as_kwargs())
  File "/usr/lib/python3.8/contextlib.py", line 75, in inner
    return func(*args, **kwds)
  File "/root/weblate-env/lib/python3.8/site-packages/weblate/trans/models/translation.py", line 1267, in add_unit
    unit.save(force_insert=True)
  File "/root/weblate-env/lib/python3.8/site-packages/weblate/trans/models/unit.py", line 373, in save
    super().save(
  File "/root/weblate-env/lib/python3.8/site-packages/django/db/models/base.py", line 726, in save
    self.save_base(using=using, force_insert=force_insert,
  File "/root/weblate-env/lib/python3.8/site-packages/django/db/models/base.py", line 763, in save_base
    updated = self._save_table(
  File "/root/weblate-env/lib/python3.8/site-packages/django/db/models/base.py", line 868, in _save_table
    results = self._do_insert(cls._base_manager, using, fields, returning_fields, raw)
  File "/root/weblate-env/lib/python3.8/site-packages/django/db/models/base.py", line 906, in _do_insert
    return manager._insert(
  File "/root/weblate-env/lib/python3.8/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/root/weblate-env/lib/python3.8/site-packages/django/db/models/query.py", line 1270, in _insert
    return query.get_compiler(using=using).execute_sql(returning_fields)
  File "/root/weblate-env/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1410, in execute_sql
    cursor.execute(sql, params)
  File "/root/weblate-env/lib/python3.8/site-packages/django/db/backends/utils.py", line 98, in execute
    return super().execute(sql, params)
  File "/root/weblate-env/lib/python3.8/site-packages/django/db/backends/utils.py", line 66, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/root/weblate-env/lib/python3.8/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/root/weblate-env/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/root/weblate-env/lib/python3.8/site-packages/django/db/utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/root/weblate-env/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
django.db.utils.IntegrityError: duplicate key value violates unique constraint "trans_unit_translation_id_id_hash_ab945589_uniq"
DETAIL:  Key (translation_id, id_hash)=(12, -4294227979123926682) already exists.

Internal Server Error: /new-unit/test-project/glossary/de/
Traceback (most recent call last):
  File "/root/weblate-env/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "trans_unit_translation_id_id_hash_ab945589_uniq"
DETAIL:  Key (translation_id, id_hash)=(12, -4294227979123926682) already exists.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/root/weblate-env/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/root/weblate-env/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/root/weblate-env/lib/python3.8/site-packages/django/views/decorators/http.py", line 40, in inner
    return func(request, *args, **kwargs)
  File "/root/weblate-env/lib/python3.8/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/root/weblate-env/lib/python3.8/site-packages/weblate/trans/views/edit.py", line 922, in new_unit
    new_unit = translation.add_unit(request, **form.as_kwargs())
  File "/usr/lib/python3.8/contextlib.py", line 75, in inner
    return func(*args, **kwds)
  File "/root/weblate-env/lib/python3.8/site-packages/weblate/trans/models/translation.py", line 1267, in add_unit
    unit.save(force_insert=True)
  File "/root/weblate-env/lib/python3.8/site-packages/weblate/trans/models/unit.py", line 373, in save
    super().save(
  File "/root/weblate-env/lib/python3.8/site-packages/django/db/models/base.py", line 726, in save
    self.save_base(using=using, force_insert=force_insert,
  File "/root/weblate-env/lib/python3.8/site-packages/django/db/models/base.py", line 763, in save_base
    updated = self._save_table(
  File "/root/weblate-env/lib/python3.8/site-packages/django/db/models/base.py", line 868, in _save_table
    results = self._do_insert(cls._base_manager, using, fields, returning_fields, raw)
  File "/root/weblate-env/lib/python3.8/site-packages/django/db/models/base.py", line 906, in _do_insert
    return manager._insert(
  File "/root/weblate-env/lib/python3.8/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/root/weblate-env/lib/python3.8/site-packages/django/db/models/query.py", line 1270, in _insert
    return query.get_compiler(using=using).execute_sql(returning_fields)
  File "/root/weblate-env/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1410, in execute_sql
    cursor.execute(sql, params)
  File "/root/weblate-env/lib/python3.8/site-packages/django/db/backends/utils.py", line 98, in execute
    return super().execute(sql, params)
  File "/root/weblate-env/lib/python3.8/site-packages/django/db/backends/utils.py", line 66, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/root/weblate-env/lib/python3.8/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/root/weblate-env/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/root/weblate-env/lib/python3.8/site-packages/django/db/utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/root/weblate-env/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
django.db.utils.IntegrityError: duplicate key value violates unique constraint "trans_unit_translation_id_id_hash_ab945589_uniq"
DETAIL:  Key (translation_id, id_hash)=(12, -4294227979123926682) already exists.

Server configuration and status

This is a fresh installation following this guide: https://docs.weblate.org/en/weblate-4.6/admin/install/venv-debian.html
This is an installation for evaluation purposes and the Celery configuration has been changed to 'development' as suggested here

Weblate deploy checks

SystemCheckError: System check identified some issues:

CRITICALS:
?: (weblate.E012) The server e-mail address should be changed from its default value
        HINT: https://docs.weblate.org/en/weblate-4.6.2/admin/install.html#production-email
?: (weblate.E013) The "From" e-mail address should be changed from its default value
        HINT: https://docs.weblate.org/en/weblate-4.6.2/admin/install.html#production-email

ERRORS:
?: (weblate.E005) Celery is configured in the eager mode
        HINT: https://docs.weblate.org/en/weblate-4.6.2/admin/install.html#celery
?: (weblate.E011) E-mail addresses for site admins is misconfigured
        HINT: https://docs.weblate.org/en/weblate-4.6.2/admin/install.html#production-admins

WARNINGS:
?: (security.W004) You have not set a value for the SECURE_HSTS_SECONDS setting. If your entire site is served only over SSL, you may want to consider setting a value and enabling HTTP Strict Transport Security. Be sure to read the documentation first; enabling HSTS carelessly can cause serious, irreversible problems.
?: (security.W008) Your SECURE_SSL_REDIRECT setting is not set to True. Unless your site should be available over both SSL and non-SSL connections, you may want to either set this setting True or configure a load balancer or reverse-proxy server to redirect all connections to HTTPS.
?: (security.W009) Your SECRET_KEY has less than 50 characters, less than 5 unique characters, or it's prefixed with 'django-insecure-' indicating that it was generated automatically by Django. Please generate a long and random SECRET_KEY, otherwise many of Django's security-critical features will be vulnerable to attack.
?: (security.W012) SESSION_COOKIE_SECURE is not set to True. Using a secure-only session cookie makes it more difficult for network traffic sniffers to hijack user sessions.
?: (security.W018) You should not have DEBUG set to True in deployment.
?: (weblate.W025.ini) Failure in loading handler for ini file format: Missing iniparse library.
        HINT: https://docs.weblate.org/en/weblate-4.6.2/admin/install.html#optional-deps
?: (weblate.W025.islu) Failure in loading handler for islu file format: Missing iniparse library.
        HINT: https://docs.weblate.org/en/weblate-4.6.2/admin/install.html#optional-deps
?: (weblate.W025.laravel) Failure in loading handler for laravel file format: No module named 'phply'
        HINT: https://docs.weblate.org/en/weblate-4.6.2/admin/install.html#optional-deps
?: (weblate.W025.php) Failure in loading handler for php file format: No module named 'phply'
        HINT: https://docs.weblate.org/en/weblate-4.6.2/admin/install.html#optional-deps
?: (weblate.W033.Gerrit) Failure in loading VCS module for Gerrit: git: 'review' is not a git command. See 'git --help'.
 (1)
        HINT: https://docs.weblate.org/en/weblate-4.6.2/vcs.html
?: (weblate.W033.Mercurial) Failure in loading VCS module for Mercurial: [Errno 2] No such file or directory: 'hg'
        HINT: https://docs.weblate.org/en/weblate-4.6.2/vcs.html
?: (weblate.W033.Subversion) Failure in loading VCS module for Subversion: git: 'svn' is not a git command. See 'git --help'.

The most similar commands are
        fsck
        mv
        show
 (1)
        HINT: https://docs.weblate.org/en/weblate-4.6.2/vcs.html

INFOS:
?: (weblate.I021) Error collection is not set up, it is highly recommended for production use
        HINT: https://docs.weblate.org/en/weblate-4.6.2/admin/install.html#collecting-errors
?: (weblate.I028) Backups are not configured, it is highly recommended for production use
        HINT: https://docs.weblate.org/en/weblate-4.6.2/admin/backup.html
?: (weblate.I031) New Weblate version is available, please upgrade to 4.7.
        HINT: https://docs.weblate.org/en/weblate-4.6.2/admin/upgrade.html

Additional context

I experienced other issues with the glossary as well and am not sure if they are related to this one as the error is different: I can also not add new terms when setting the glossary up for use with a Java Property files with a monolingual base language file defined.

@nijel nijel added bug Something is broken. duplicate Similar issue or pull request already exists. labels Jun 17, 2021
@nijel nijel added this to the 4.7 milestone Jun 17, 2021
@nijel
Copy link
Member

nijel commented Jun 17, 2021

Duplicate of #6056

@nijel nijel marked this as a duplicate of #6056 Jun 17, 2021
@nijel nijel closed this as completed Jun 17, 2021
@nijel nijel self-assigned this Jun 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken. duplicate Similar issue or pull request already exists.
Projects
None yet
Development

No branches or pull requests

1 participant