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

Sync with upstream to tag 2.018.48 #29

Open
wants to merge 44 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
d038f11
Added 'has_kpi_hooks' boolean field to 'XForm' model and 'mongo_succe…
noliveleger Jun 21, 2018
ec2694b
Renamed 'mongo_success' to 'is_sync_with_mongo'. Update its value on …
noliveleger Jun 21, 2018
0e8b298
New rest service for KPI and (un)register it on XForm.save()
noliveleger Jun 22, 2018
9f83d34
Use KPI_INTERNAL_URL to make call between KC and KPI in Rest Service
noliveleger Jun 22, 2018
e10b8c0
Updated pip requirements. Requests 2.4.1 > Request 2.19.1
noliveleger Jul 3, 2018
b14da18
Updated 'kpi_hook' service to post 'xml' and 'json' to kpi endpoint
noliveleger Jul 3, 2018
0ceccc7
Added XML representation of an instance in API endpoint
noliveleger Jul 3, 2018
bf66b77
Added XML format in Instance detail endpoint
noliveleger Jul 3, 2018
6969e3e
Added instance_id in payload of kpi_hook service, renamed uuid to uid…
noliveleger Jul 5, 2018
576b7dd
Changed json representation to match Mongo data
noliveleger Jul 6, 2018
c5d97fb
Removed logger_instance.uid from kpi_hook payload
noliveleger Jul 9, 2018
fc4a6f6
Moved rest_service process to a Celery task
noliveleger Aug 8, 2018
4962943
Updated remongo & sync mongo command to handle is_synced_with_mongo f…
noliveleger Aug 8, 2018
a3eb2d2
Changed Instance.save() to update only with need fields
noliveleger Aug 9, 2018
5194de4
Removed useless and redundant Instance.save(), fixed sync_mongo --all…
noliveleger Aug 10, 2018
a14f388
Send only UUID to kpi hook service
noliveleger Aug 21, 2018
5f67122
Bugfix when saving kpi_hook result
noliveleger Aug 30, 2018
9615617
Refactor submission counting without locking
jnm Sep 20, 2018
24ce281
Merge pull request #479 from kobotoolbox/remove-submission-count-locks
noliveleger Sep 20, 2018
f4fb829
Remove SPSS label export feature
jnm Sep 24, 2018
f439a21
Upgrade pyxform to 0.11.5; closes #480
jnm Sep 24, 2018
fb334b3
Merge remote-tracking branch 'origin/master' into kpi_rest_services
jnm Sep 25, 2018
3dd4778
Merge pull request #481 from kobotoolbox/480-upstream-pyxform
noliveleger Sep 26, 2018
0c0f55d
Changed Instance.save() to Instance.objects.update() to gain performance
noliveleger Sep 28, 2018
5102a15
Merge branch 'kpi_rest_services' of github.com:kobotoolbox/kobocat in…
noliveleger Sep 28, 2018
4038ebd
Send instance_id instead of instance_uuid to KPI
noliveleger Sep 28, 2018
f0dcf51
update_is_sync_with_mongo - Order queryset by id
noliveleger Oct 1, 2018
f73476d
Merge pull request #482 from kobotoolbox/kpi_rest_services
jnm Oct 2, 2018
40c67f2
Disable automatic export creation in `export_list`
jnm Oct 4, 2018
ad21245
Merge pull request #485 from kobotoolbox/484-no-auto-export
noliveleger Oct 9, 2018
877e155
Just get the XForm: don't bother counting first!
jnm Oct 25, 2018
8370d27
Do not lock any rows until attachments are saved
jnm Oct 25, 2018
504fbb9
Merge pull request #491 from kobotoolbox/490-optimize-submission-coun…
noliveleger Oct 31, 2018
75eb550
Add a new `media_file_basename` column to improve
jnm Nov 20, 2018
39c0996
Merge pull request #496 from kobotoolbox/495-media-file-query-optimiz…
noliveleger Nov 20, 2018
93cea58
Remove Fabric configuration. Closes #497
jnm Nov 20, 2018
31a067e
Merge pull request #498 from kobotoolbox/497-remove-fabric-configuration
noliveleger Nov 22, 2018
ed1b011
Bug fix for 'media_file_basename' always saved as empty string
noliveleger Nov 28, 2018
4549276
Management command to update 'media_file_basename'
noliveleger Nov 28, 2018
85244d0
Use already existing 'filename' property' to initialize 'media_file_b…
noliveleger Nov 28, 2018
f48dba1
Merge pull request #501 from kobotoolbox/500-images-collected-not-found
jnm Nov 28, 2018
43f8e1e
Applied PR#501 suggested changes
noliveleger Nov 30, 2018
b2d8d13
Merge pull request #503 from kobotoolbox/500-images-not-found-PR-changes
noliveleger Nov 30, 2018
6096284
Merge branch 'upstream-2.018.48' into update-upstream-2.018.48
Tomatosoup97 Jan 27, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion fabfile/__init__.py

This file was deleted.

261 changes: 0 additions & 261 deletions fabfile/docker.py

This file was deleted.

54 changes: 0 additions & 54 deletions onadata/apps/api/__init__.py
Original file line number Diff line number Diff line change
@@ -1,54 +0,0 @@

import re

import pyxform.odk_validate


#############################################################################
# WARNING
# This is a monkey patch to fix a bug in odk and should be removed as soon as
# the fix is upstream
#############################################################################

def _cleanup_errors(error_message):

# this is the same code as the original function
def get_last_item(xpathStr):
l = xpathStr.split("/")
return l[len(l) - 1]

def replace_function(match):
strmatch = match.group()
if strmatch.startswith("/html/body") \
or strmatch.startswith("/root/item") \
or strmatch.startswith("/html/head/model/bind") \
or strmatch.endswith("/item/value"):
return strmatch
return "${%s}" % get_last_item(match.group())
pattern = "(/[a-z0-9\-_]+(?:/[a-z0-9\-_]+)+)"
error_message = re.compile(pattern, flags=re.I).sub(replace_function,
error_message)
k = []
lastline = ''
for line in error_message.splitlines():
has_java_filename = line.find('.java:') is not -1
is_a_java_method = line.find('\tat') is not -1
is_duplicate = (line == lastline)
lastline = line
if not has_java_filename and not is_a_java_method and not is_duplicate:
if line.startswith('java.lang.RuntimeException: '):
line = line.replace('java.lang.RuntimeException: ', '')
if line.startswith('org.javarosa.xpath.XPathUnhandledException: '):
line = line.replace('org.javarosa.xpath.XPathUnhandledException: ', '')
if line.startswith('java.lang.NullPointerException'):
continue
k.append(line)

# original value causing UnicodeDecodeError
#return u'\n'.join(k)

# Fix:
return '\n'.join(k).decode('ascii', errors="replace")


pyxform.odk_validate._cleanup_errors = _cleanup_errors
3 changes: 1 addition & 2 deletions onadata/apps/api/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,8 +440,7 @@ def add_validation_status_to_instance(request, instance):
if validation_status:
instance.validation_status = validation_status
instance.save()
instance.parsed_instance.update_mongo()
success = True
success = instance.parsed_instance.update_mongo(async=False)

return success

Expand Down
11 changes: 10 additions & 1 deletion onadata/apps/api/viewsets/data_viewset.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,9 +395,10 @@ class DataViewSet(AnonymousUserPublicFormsMixin, ModelViewSet):
renderers.CSVRenderer,
renderers.CSVZIPRenderer,
renderers.SAVZIPRenderer,
renderers.SurveyRenderer
renderers.RawXMLRenderer
]

content_negotiation_class = renderers.InstanceContentNegotiation
filter_backends = (filters.AnonDjangoObjectPermissionFilter,
filters.XFormOwnerFilter)
permission_classes = (XFormPermissions,)
Expand Down Expand Up @@ -561,6 +562,14 @@ def enketo(self, request, *args, **kwargs):

return Response(data=data)

def retrieve(self, request, *args, **kwargs):
# XML rendering does not a serializer
if request.accepted_renderer.format == "xml":
instance = self.get_object()
return Response(instance.xml)
else:
return super(DataViewSet, self).retrieve(request, *args, **kwargs)

def destroy(self, request, *args, **kwargs):
self.object = self.get_object()

Expand Down
2 changes: 1 addition & 1 deletion onadata/apps/api/viewsets/xform_viewset.py
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ class XFormViewSet(AnonymousUserPublicFormsMixin, LabelsMixin, ModelViewSet):
renderers.CSVRenderer,
renderers.CSVZIPRenderer,
renderers.SAVZIPRenderer,
renderers.SurveyRenderer
renderers.RawXMLRenderer
]
queryset = XForm.objects.all()
serializer_class = XFormSerializer
Expand Down
Loading