-
-
Notifications
You must be signed in to change notification settings - Fork 185
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
Make export constants consistent with FormPack - fix #2037
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ | |
from django.utils.six.moves.urllib import parse as urlparse | ||
|
||
import formpack.constants | ||
from formpack.schema.fields import ValidationStatusCopyField | ||
from pyxform import xls2json_backends | ||
from formpack.utils.string import ellipsize | ||
from kobo.apps.reports.report_data import build_formpack | ||
|
@@ -342,9 +343,11 @@ class ExportTask(ImportExportTask): | |
`data` attribute to a dictionary with the following keys: | ||
* `type`: required; `xls` or `csv` | ||
* `source`: required; URL of a deployed `Asset` | ||
* `lang`: optional; `xml` for XML names or the name of the language to be | ||
used for labels. Leave unset, or use `_default` or `None`, for | ||
labels in the default language | ||
* `lang`: optional; It can be: | ||
- unset (`None`) or `formpack.constants.UNTRANSLATED` for labels in the default language (default: `None`). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I try to keep lines under 80 characters for readability. It can certainly be a pain sometimes. Is there a docstring parser you like to use that doesn't handle line breaks within these parameter descriptions well? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jnm , I kept the default of my IDE which is 120 characters instead of 80. Nowadays, screen resolutions are wider than before. 80 is really narrow, but if you want me to go with 80. I will. |
||
- `formpack.constants.UNSPECIFIED_TRANSLATION` for XML names. | ||
- language code for labels in one of the translated language (e.g. `en` for English). | ||
|
||
* `hierarchy_in_labels`: optional; when `true`, include the labels for all | ||
ancestor groups in each field label, separated by | ||
`group_sep`. Defaults to `False` | ||
|
@@ -375,7 +378,13 @@ class ExportTask(ImportExportTask): | |
last_submission_time = models.DateTimeField(null=True) | ||
result = PrivateFileField(upload_to=export_upload_to, max_length=380) | ||
|
||
COPY_FIELDS = ('_id', '_uuid', '_submission_time') | ||
COPY_FIELDS = ( | ||
'_id', | ||
'_uuid', | ||
'_submission_time', | ||
ValidationStatusCopyField | ||
) | ||
|
||
TIMESTAMP_KEY = '_submission_time' | ||
# Above 244 seems to cause 'Download error' in Chrome 64/Linux | ||
MAXIMUM_FILENAME_LENGTH = 240 | ||
|
@@ -445,8 +454,6 @@ def _build_export_options(self, pack): | |
group_sep = self.data.get('group_sep', '/') | ||
translations = pack.available_translations | ||
lang = self.data.get('lang', None) or next(iter(translations), None) | ||
if lang == '_default': | ||
lang = formpack.constants.UNTRANSLATED | ||
tag_cols_for_header = self.data.get('tag_cols_for_header', ['hxl']) | ||
|
||
return { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Admirable, but this wraps onto a second line:
Also, for every language it's the
values and headers
, but we probably wouldn't want to sayEnglish (en) values and headers
either.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the suggestion? OnlyXML
in caps?I've seen your change. Sounds good.