Closed vecna closed 10 years ago
details to test the bug:
@vecna can you describe the temporary solution you see?
2013-10-03 20:31:29+0200 [D] Fields proposed do not match with previous language schema (Unexpected shit) 2013-10-03 20:31:29+0200 [D] Fields proposed do not match with previous language schema (Unexpected stuff) 2013-10-03 20:31:29+0200 [D] Fields proposed do not match with previous language schema (Missing [u'Files description'])
it's completely broken, we can't supports multi fields language in this way
"en": [
{
"hint": "Describe your Tip with a short title",
"key": "Short title",
"name": "Short title",
"presentation_order": 1,
"preview": true,
"required": true,
"type": "text",
"value": ""
},
{
"hint": "Describe the details of your Tip",
"key": "Full description",
"name": "Full description",
"presentation_order": 2,
"preview": true,
"required": true,
"type": "text",
"value": ""
},
{
"hint": "shit",
"key": "shit",
"name": "shit",
"presentation_order": 0,
"preview": true,
"required": true,
"type": "textarea",
"value": ""
},
{
"hint": "stuff",
"key": "stuff",
"name": "stuff",
"options": [
{
"name": "aaaaa",
"order": 0,
"value": "aaaaa"
},
{
"name": "bbbbbbb",
"order": 0,
"value": "bbbbbbb"
}
],
"presentation_order": 0,
"preview": true,
"required": true,
"type": "radio",
"value": ""
}
],
"it": [
{
"hint": "Describe your Tip with a short title",
"key": "Titolo",
"name": "Titolo",
"presentation_order": 1,
"preview": true,
"required": true,
"type": "text",
"value": ""
},
{
"hint": "Describe the details of your Tip",
"key": "descrizione",
"name": "descrizione",
"presentation_order": 2,
"preview": true,
"required": true,
"type": "text",
"value": ""
},
{
"hint": "Describe the submitted files",
"key": "file descriviti",
"name": "file descriviti",
"presentation_order": 3,
"preview": false,
"required": false,
"type": "text",
"value": ""
}
]
},
This thing need to be changed. The public API need to remain the same, so, the output from /contexts and the input of /submission MUST remain the same. but /admin/context need to change, and permit a separate handling of language and fields.
fields need to be unique, with an unique ID inside, ID is the 'key'
tranlation of 'name' and 'hint' would be addressed by the same ID, but almost we avoid this desync, that's is very difficult to handle in safety.
for obtain this, we've to:
The goal of today is refactor the internal usage of context.fields with two separate variables:
- fields = Pickle()
+ fields = Pickle() # TO BE REMOVED
+
+ # Unique fields is a dict with a unique ID as key,
+ # and as value another dict, containing the field
+ # descriptive values:
+ # "presentation_order" : int
+ # "preview" : bool
+ # "required" : bool
+ # "type" : unicode
+ # "options" : dict (optional!)
+ unique_fields = Pickle()
+
+ # Localized fields is a dict having as keys, the same
+ # keys of unique_fields, and as value a dict, containing:
+ # 'name' : unicode
+ # 'hint' : unicode
+ localized_fields = Pickle()
The things are going good, but there are three elements:
Update:
Missing:
The API is not changed, so by theory, these software would not have trouble. But now fields[\'key\'] is different from fields[\'name\'] ... (before was the same) and this may expose bugs in the existing clients.
closing this because really old.
Having more than one language configured, and translated fields, cause failure in validation.
This bug contains some logic bug, and need to be addressed seriously with the fields refactor (changing of the translation method, creation of the fields database, initialization with default value, etc)
At the moment a temporary solution would be provided, because this bug impair the launch of a bilingual adopter.