Resolve "dynamic_preferences.preferences.InvalidNameError: Sequence "__" is forbidden in section and preferences name, since it is used to access values via managers" #135

Owner

Closes #30

Closes #30
Author
Owner

assigned to @hansegucker

assigned to @hansegucker
Author
Owner

added 1 commit

  • 6a2a2b69 - Use re to replace underscores in preference names

Compare with previous version

added 1 commit <ul><li>6a2a2b69 - Use re to replace underscores in preference names</li></ul> [Compare with previous version](/AlekSIS/official/AlekSIS-App-LDAP/-/merge_requests/78/diffs?diff_id=11528&start_sha=57f4005094a9d3ba04ac72d99d9fd53fe1a5ec0c)
Author
Owner

assigned to @nik and unassigned @hansegucker

assigned to @nik and unassigned @hansegucker
Author
Owner

marked this merge request as ready

marked this merge request as **ready**
Author
Owner

added 3 commits

  • 6a2a2b69...53022534 - 2 commits from branch master
  • 776f9167 - Merge branch 'master' into...

Compare with previous version

added 3 commits <ul><li>6a2a2b69...53022534 - 2 commits from branch <code>master</code></li><li>776f9167 - Merge branch &#39;master&#39; into...</li></ul> [Compare with previous version](/AlekSIS/official/AlekSIS-App-LDAP/-/merge_requests/78/diffs?diff_id=11530&start_sha=6a2a2b690c4dac9185d57f5a5d29b0682dcdb71d)
Owner

This change is invalid, because it produces name clashes. The . must not be replaced by a character sequence which is a valid part in a field name.

This change is invalid, because it produces name clashes. The `.` must not be replaced by a character sequence which is a valid part in a field name.
Author
Owner

But then it was already wrong?

But then it was already wrong?
Owner

Umm… maybe. But maybe not. Isn't __ invalid in field names as well? In that case, the function is entirely useless…

In any case, if we fix it, we should fix it for real.

Umm… maybe. But maybe not. Isn't `__` invalid in field names as well? In that case, the function is entirely useless… In any case, if we fix it, we should fix it for real.
Author
Owner

Isn't __ invalid in field names as well? In that case, the function is entirely useless…

It definitely occurs in field names, so it can't be invalid.

This change is invalid, because it produces name clashes.

Can you please give me an example for such a name clash?

> Isn't `__` invalid in field names as well? In that case, the function is entirely useless… It definitely occurs in field names, so it can't be invalid. > This change is invalid, because it produces name clashes. Can you please give me an example for such a name clash?
Owner

Yes, well, obviously…

foo__bar → foo_bar clashes with foo_bar → foo_bar

Yes, well, obviously… `foo__bar → foo_bar` clashes with `foo_bar → foo_bar`
Owner

Oh, and:

https://docs.djangoproject.com/en/3.2/topics/db/models/#field-name-restrictions

"A field name cannot contain more than one underscore in a row […]"

Where do we have a field name with more than one underscore in a row, in your opinion?

Oh, and: https://docs.djangoproject.com/en/3.2/topics/db/models/#field-name-restrictions "A field name cannot contain more than one underscore in a row […]" Where do we have a field name with more than one underscore in a row, in your opinion?
Author
Owner

changed this line in version 3 of the diff

changed this line in [version 3 of the diff](/AlekSIS/official/AlekSIS-App-LDAP/-/merge_requests/78/diffs?diff_id=11624&start_sha=776f9167c1042ded4b408950faae493c8b7a2b8a#c33d3bebee06aec596b3ba501d9b4cbb66047970_33_34)
Author
Owner

added 1 commit

  • a102cf5b - Add hash to preference names to prevent double names

Compare with previous version

added 1 commit <ul><li>a102cf5b - Add hash to preference names to prevent double names</li></ul> [Compare with previous version](/AlekSIS/official/AlekSIS-App-LDAP/-/merge_requests/78/diffs?diff_id=11624&start_sha=776f9167c1042ded4b408950faae493c8b7a2b8a)
Author
Owner

resolved all threads

resolved all threads
Author
Owner

@nik Can you please review again?

@nik Can you please review again?
Owner

name_without_underscores is a misleading name, give nthat this substitution's replacement character is an underscore.

`name_without_underscores` is a misleading name, give nthat this substitution's replacement character is an underscore.
Owner

This will produce an invalid name for fields ending in _ (e.g. key_)

This will produce an invalid name for fields ending in `_` (e.g. `key_`)
Owner

This needs a migration path from the old setting names!

This needs a migration path from the old setting names!
Author
Owner

changed this line in version 4 of the diff

changed this line in [version 4 of the diff](/AlekSIS/official/AlekSIS-App-LDAP/-/merge_requests/78/diffs?diff_id=11630&start_sha=a102cf5b5325dd1fa2f05fbce41fdb4dba077c07#c33d3bebee06aec596b3ba501d9b4cbb66047970_35_35)
Author
Owner

changed this line in version 4 of the diff

changed this line in [version 4 of the diff](/AlekSIS/official/AlekSIS-App-LDAP/-/merge_requests/78/diffs?diff_id=11630&start_sha=a102cf5b5325dd1fa2f05fbce41fdb4dba077c07#c33d3bebee06aec596b3ba501d9b4cbb66047970_36_35)
Author
Owner

added 1 commit

  • 7781cbea - Add hash to preference names to prevent double names

Compare with previous version

added 1 commit <ul><li>7781cbea - Add hash to preference names to prevent double names</li></ul> [Compare with previous version](/AlekSIS/official/AlekSIS-App-LDAP/-/merge_requests/78/diffs?diff_id=11630&start_sha=a102cf5b5325dd1fa2f05fbce41fdb4dba077c07)
Owner

Please choose a better name. I was always thinking of preficēs reading this abbreviated name, and then found it to be sufficēs ;)

Please choose a better name. I was always thinking of `preficēs` reading this abbreviated name, and then found it to be sufficēs ;)
Author
Owner

resolved all threads

resolved all threads
Author
Owner

changed this line in version 5 of the diff

changed this line in [version 5 of the diff](/AlekSIS/official/AlekSIS-App-LDAP/-/merge_requests/78/diffs?diff_id=11642&start_sha=7781cbea782f873fa417233a20d38e7801f900f5#2bfb3051c9f9f269ee14db2cf6667bd845a2352e_7_7)
Author
Owner

added 1 commit

  • 1459327b - Add hash to preference names to prevent double names

Compare with previous version

added 1 commit <ul><li>1459327b - Add hash to preference names to prevent double names</li></ul> [Compare with previous version](/AlekSIS/official/AlekSIS-App-LDAP/-/merge_requests/78/diffs?diff_id=11642&start_sha=7781cbea782f873fa417233a20d38e7801f900f5)
Author
Owner

@nik I tested the migration and it worked fine. So, please review again and then merge.

@nik I tested the migration and it worked fine. So, please review again and then merge.
Owner

mentioned in commit f7ea0c24a7

mentioned in commit f7ea0c24a742368cd075aa4c7f2b67a3f7288e82
nik merged commit f7ea0c24a7 into master 2021-09-15 21:53:41 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
aleksis/AlekSIS-App-LDAP!135
No description provided.