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

Fix LangStringSet._check_language_tag_constraints after the spec has been clarified #157

Open
zrgt opened this issue Nov 9, 2023 · 3 comments
Labels
Specification An issue with the specification rather than our implementation

Comments

@zrgt
Copy link
Contributor

zrgt commented Nov 9, 2023

After the spec regarding language tags is clarified(admin-shell-io/aas-specs#293), we need to adapt the method LangStringSet._check_language_tag_constraints

Currently we demand that language tags:

  • can only have one or zero extensions
  • the only possible extension is region

Relevant codesnippet:
https://github.com/eclipse-basyx/basyx-python-sdk/blob/5eb895e1e64cdcd4ba98464d5fda4176292cf942/basyx/aas/model/base.py#L289C1-L296C56

    @classmethod
    def _check_language_tag_constraints(cls, ltag: str):
        split = ltag.split("-", 1)
        if len(split[0]) != 2 or not split[0].isalpha() or not split[0].islower():
            raise ValueError(f"The language code '{split[0]}' of the language tag '{ltag}' doesn't consist of exactly "
                             "two lower-case letters!")
        if len(split) > 1 and (len(split[1]) != 2 or not split[1].isalpha() or not split[1].isupper()):
            raise ValueError(f"The extension '{split[1]}' of the language tag '{ltag}' doesn't consist of exactly "
                             "two upper-case letters!")
@s-heppner s-heppner added the Specification An issue with the specification rather than our implementation label Nov 14, 2023
zrgt added a commit to rwth-iat/basyx-python-sdk that referenced this issue Nov 15, 2023
remove constraint, that if the second part of lang tag exists, it must be a region

See eclipse-basyx#157
s-heppner pushed a commit that referenced this issue Nov 16, 2023
remove constraint, that if the second part of lang tag exists, it must be a region

See #157
@s-heppner
Copy link
Contributor

s-heppner commented Nov 16, 2023

Temporary fix with #167

@zrgt
Copy link
Contributor Author

zrgt commented Nov 16, 2023

@s-heppner please reopen the issue, as #167 is only a temporary solution. The spec issue is still not clarified.

@s-heppner s-heppner reopened this Nov 18, 2023
@s-heppner
Copy link
Contributor

My bad, I also edited my comment above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Specification An issue with the specification rather than our implementation
Projects
None yet
Development

No branches or pull requests

2 participants