Commit fdecaef7 by kimth

Fix datetime name conflict

parent 95a7a5b0
...@@ -7,7 +7,7 @@ import traceback ...@@ -7,7 +7,7 @@ import traceback
import re import re
import sys import sys
from datetime import datetime, timedelta from datetime import timedelta
from django.conf import settings from django.conf import settings
from lxml import etree from lxml import etree
from pkg_resources import resource_string from pkg_resources import resource_string
...@@ -465,10 +465,11 @@ class CapaModule(XModule): ...@@ -465,10 +465,11 @@ class CapaModule(XModule):
# Problem queued. Students must wait XQUEUE_WAITTIME_BETWEEN_REQUESTS # Problem queued. Students must wait XQUEUE_WAITTIME_BETWEEN_REQUESTS
if self.lcp.is_queued(): if self.lcp.is_queued():
current_time = datetime.now() current_time = datetime.datetime.now()
prev_submit_time = self.lcp.get_recentmost_queuetime() prev_submit_time = self.lcp.get_recentmost_queuetime()
if (current_time-prev_submit_time).total_seconds() < settings.XQUEUE_WAITTIME_BETWEEN_REQUESTS: waittime_between_requests = settings.XQUEUE_WAITTIME_BETWEEN_REQUESTS
msg = 'You must wait %d seconds between queueing requests' % settings.XQUEUE_WAITTIME_BETWEEN_REQUESTS if (current_time-prev_submit_time).total_seconds() < waittime_between_requests:
msg = 'You must wait at least %d seconds between queue submissions' % waittime_between_requests
return {'success': msg, 'html': ''} return {'success': msg, 'html': ''}
try: try:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment