Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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-platform
Commits
ed1a0738
Commit
ed1a0738
authored
Sep 13, 2013
by
Ned Batchelder
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #974 from edx/ned/keep-bson-in-mongo-code
keep-bson-in-mongo-code
parents
47ce9082
37e81007
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
14 deletions
+14
-14
common/lib/xmodule/xmodule/modulestore/__init__.py
+0
-11
common/lib/xmodule/xmodule/modulestore/mongo/base.py
+12
-1
common/lib/xmodule/xmodule/modulestore/mongo/draft.py
+2
-2
No files found.
common/lib/xmodule/xmodule/modulestore/__init__.py
View file @
ed1a0738
...
@@ -10,7 +10,6 @@ from collections import namedtuple
...
@@ -10,7 +10,6 @@ from collections import namedtuple
from
.exceptions
import
InvalidLocationError
,
InsufficientSpecificationError
from
.exceptions
import
InvalidLocationError
,
InsufficientSpecificationError
from
xmodule.errortracker
import
make_error_tracker
from
xmodule.errortracker
import
make_error_tracker
from
bson.son
import
SON
log
=
logging
.
getLogger
(
'mitx.'
+
'modulestore'
)
log
=
logging
.
getLogger
(
'mitx.'
+
'modulestore'
)
...
@@ -449,13 +448,3 @@ class ModuleStoreBase(ModuleStore):
...
@@ -449,13 +448,3 @@ class ModuleStoreBase(ModuleStore):
if
c
.
id
==
course_id
:
if
c
.
id
==
course_id
:
return
c
return
c
return
None
return
None
def
namedtuple_to_son
(
namedtuple
,
prefix
=
''
):
"""
Converts a namedtuple into a SON object with the same key order
"""
son
=
SON
()
for
idx
,
field_name
in
enumerate
(
namedtuple
.
_fields
):
son
[
prefix
+
field_name
]
=
namedtuple
[
idx
]
return
son
common/lib/xmodule/xmodule/modulestore/mongo/base.py
View file @
ed1a0738
...
@@ -17,6 +17,7 @@ import sys
...
@@ -17,6 +17,7 @@ import sys
import
logging
import
logging
import
copy
import
copy
from
bson.son
import
SON
from
fs.osfs
import
OSFS
from
fs.osfs
import
OSFS
from
itertools
import
repeat
from
itertools
import
repeat
from
path
import
path
from
path
import
path
...
@@ -31,7 +32,7 @@ from xblock.runtime import DbModel
...
@@ -31,7 +32,7 @@ from xblock.runtime import DbModel
from
xblock.exceptions
import
InvalidScopeError
from
xblock.exceptions
import
InvalidScopeError
from
xblock.fields
import
Scope
,
ScopeIds
from
xblock.fields
import
Scope
,
ScopeIds
from
xmodule.modulestore
import
ModuleStoreBase
,
Location
,
namedtuple_to_son
,
MONGO_MODULESTORE_TYPE
from
xmodule.modulestore
import
ModuleStoreBase
,
Location
,
MONGO_MODULESTORE_TYPE
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
from
xmodule.modulestore.inheritance
import
own_metadata
,
InheritanceMixin
,
inherit_metadata
,
InheritanceKeyValueStore
from
xmodule.modulestore.inheritance
import
own_metadata
,
InheritanceMixin
,
inherit_metadata
,
InheritanceKeyValueStore
...
@@ -215,6 +216,16 @@ class CachingDescriptorSystem(MakoDescriptorSystem):
...
@@ -215,6 +216,16 @@ class CachingDescriptorSystem(MakoDescriptorSystem):
)
)
def
namedtuple_to_son
(
namedtuple
,
prefix
=
''
):
"""
Converts a namedtuple into a SON object with the same key order
"""
son
=
SON
()
for
idx
,
field_name
in
enumerate
(
namedtuple
.
_fields
):
son
[
prefix
+
field_name
]
=
namedtuple
[
idx
]
return
son
def
location_to_query
(
location
,
wildcard
=
True
):
def
location_to_query
(
location
,
wildcard
=
True
):
"""
"""
Takes a Location and returns a SON object that will query for that location.
Takes a Location and returns a SON object that will query for that location.
...
...
common/lib/xmodule/xmodule/modulestore/mongo/draft.py
View file @
ed1a0738
...
@@ -9,10 +9,10 @@ and otherwise returns i4x://org/course/cat/name).
...
@@ -9,10 +9,10 @@ and otherwise returns i4x://org/course/cat/name).
from
datetime
import
datetime
from
datetime
import
datetime
from
xmodule.exceptions
import
InvalidVersionError
from
xmodule.exceptions
import
InvalidVersionError
from
xmodule.modulestore
import
Location
,
namedtuple_to_son
from
xmodule.modulestore
import
Location
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
,
DuplicateItemError
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
,
DuplicateItemError
from
xmodule.modulestore.inheritance
import
own_metadata
from
xmodule.modulestore.inheritance
import
own_metadata
from
xmodule.modulestore.mongo.base
import
location_to_query
,
get_course_id_no_run
,
MongoModuleStore
from
xmodule.modulestore.mongo.base
import
location_to_query
,
namedtuple_to_son
,
get_course_id_no_run
,
MongoModuleStore
import
pymongo
import
pymongo
from
pytz
import
UTC
from
pytz
import
UTC
...
...
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