Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-ora2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-ora2
Commits
43bb8fc9
Commit
43bb8fc9
authored
Oct 21, 2015
by
muhammad-ammar
Committed by
muzaffaryousaf
Nov 13, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix RemovedInDjango19Warning warnings
TNL-3450
parent
4573317d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
4 deletions
+19
-4
.travis.yml
+2
-0
openassessment/assessment/models/ai.py
+16
-3
openassessment/fileupload/backends/filesystem.py
+1
-1
No files found.
.travis.yml
View file @
43bb8fc9
...
@@ -37,5 +37,7 @@ script:
...
@@ -37,5 +37,7 @@ script:
branches
:
branches
:
only
:
only
:
-
master
-
master
-
ora-staff-grading
-
ned/django-upgrade-1.8
after_success
:
after_success
:
coveralls
coveralls
openassessment/assessment/models/ai.py
View file @
43bb8fc9
...
@@ -5,8 +5,9 @@ from uuid import uuid4
...
@@ -5,8 +5,9 @@ from uuid import uuid4
import
json
import
json
import
logging
import
logging
from
django.conf
import
settings
from
django.conf
import
settings
from
django.core
import
signals
from
django.core.files.base
import
ContentFile
from
django.core.files.base
import
ContentFile
from
django.core.cache
import
cache
,
get
_cache
from
django.core.cache
import
cache
,
_create
_cache
from
django.db
import
models
,
transaction
,
DatabaseError
from
django.db
import
models
,
transaction
,
DatabaseError
from
django.utils.timezone
import
now
from
django.utils.timezone
import
now
from
django_extensions.db.fields
import
UUIDField
from
django_extensions.db.fields
import
UUIDField
...
@@ -21,11 +22,23 @@ AI_ASSESSMENT_TYPE = "AI"
...
@@ -21,11 +22,23 @@ AI_ASSESSMENT_TYPE = "AI"
logger
=
logging
.
getLogger
(
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
def
create_cache
(
backend
,
**
kwargs
):
"""
Create cache backend. Using this custom function to avoid deprecation warnings.
"""
cache
=
_create_cache
(
backend
,
**
kwargs
)
# Some caches -- python-memcached in particular -- need to do a cleanup at the
# end of a request cycle. If not implemented in a particular backend
# cache.close is a no-op
signals
.
request_finished
.
connect
(
cache
.
close
)
return
cache
# Use an in-memory cache to hold classifier data, but allow settings to override this.
# Use an in-memory cache to hold classifier data, but allow settings to override this.
# The classifier data will generally be larger than memcached's default max size
# The classifier data will generally be larger than memcached's default max size
CLASSIFIERS_CACHE_IN_MEM
=
getattr
(
CLASSIFIERS_CACHE_IN_MEM
=
getattr
(
settings
,
'ORA2_CLASSIFIERS_CACHE_IN_MEM'
,
settings
,
'ORA2_CLASSIFIERS_CACHE_IN_MEM'
,
get
_cache
(
create
_cache
(
'django.core.cache.backends.locmem.LocMemCache'
,
'django.core.cache.backends.locmem.LocMemCache'
,
LOCATION
=
'openassessment.ai.classifiers_dict'
LOCATION
=
'openassessment.ai.classifiers_dict'
)
)
...
@@ -33,7 +46,7 @@ CLASSIFIERS_CACHE_IN_MEM = getattr(
...
@@ -33,7 +46,7 @@ CLASSIFIERS_CACHE_IN_MEM = getattr(
CLASSIFIERS_CACHE_IN_FILE
=
getattr
(
CLASSIFIERS_CACHE_IN_FILE
=
getattr
(
settings
,
'ORA2_CLASSIFIERS_CACHE_IN_FILE'
,
settings
,
'ORA2_CLASSIFIERS_CACHE_IN_FILE'
,
get
_cache
(
create
_cache
(
'django.core.cache.backends.filebased.FileBasedCache'
,
'django.core.cache.backends.filebased.FileBasedCache'
,
LOCATION
=
'/tmp/ora2_classifier_cache'
LOCATION
=
'/tmp/ora2_classifier_cache'
)
)
...
...
openassessment/fileupload/backends/filesystem.py
View file @
43bb8fc9
...
@@ -61,7 +61,7 @@ def get_cache():
...
@@ -61,7 +61,7 @@ def get_cache():
cache_name
=
getattr
(
settings
,
"ORA2_FILEUPLOAD_CACHE_NAME"
,
None
)
cache_name
=
getattr
(
settings
,
"ORA2_FILEUPLOAD_CACHE_NAME"
,
None
)
if
cache_name
is
None
:
if
cache_name
is
None
:
raise
exceptions
.
FileUploadInternalError
(
"Undefined cache backend for file upload"
)
raise
exceptions
.
FileUploadInternalError
(
"Undefined cache backend for file upload"
)
return
django
.
core
.
cache
.
get_cache
(
cache_name
)
return
django
.
core
.
cache
.
caches
[
cache_name
]
def
make_upload_url_available
(
url_key_name
,
timeout
):
def
make_upload_url_available
(
url_key_name
,
timeout
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment