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
6dab09f5
Commit
6dab09f5
authored
Jul 20, 2013
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PEP8 and Pylint fixes
parent
913c601a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
16 additions
and
10 deletions
+16
-10
common/lib/xmodule/xmodule/modulestore/exceptions.py
+3
-0
common/lib/xmodule/xmodule/modulestore/parsers.py
+7
-3
common/lib/xmodule/xmodule/modulestore/split_mongo/__init__.py
+1
-2
common/lib/xmodule/xmodule/modulestore/split_mongo/definition_lazy_loader.py
+1
-0
common/lib/xmodule/xmodule/modulestore/split_mongo/split_mongo_kvs.py
+4
-5
common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore.py
+0
-0
No files found.
common/lib/xmodule/xmodule/modulestore/exceptions.py
View file @
6dab09f5
...
@@ -14,9 +14,11 @@ class ItemWriteConflictError(Exception):
...
@@ -14,9 +14,11 @@ class ItemWriteConflictError(Exception):
class
InsufficientSpecificationError
(
Exception
):
class
InsufficientSpecificationError
(
Exception
):
pass
pass
class
OverSpecificationError
(
Exception
):
class
OverSpecificationError
(
Exception
):
pass
pass
class
InvalidLocationError
(
Exception
):
class
InvalidLocationError
(
Exception
):
pass
pass
...
@@ -28,6 +30,7 @@ class NoPathToItem(Exception):
...
@@ -28,6 +30,7 @@ class NoPathToItem(Exception):
class
DuplicateItemError
(
Exception
):
class
DuplicateItemError
(
Exception
):
pass
pass
class
VersionConflictError
(
Exception
):
class
VersionConflictError
(
Exception
):
"""
"""
The caller asked for either draft or published head and gave a version which conflicted with it.
The caller asked for either draft or published head and gave a version which conflicted with it.
...
...
common/lib/xmodule/xmodule/modulestore/parsers.py
View file @
6dab09f5
...
@@ -2,6 +2,7 @@ import re
...
@@ -2,6 +2,7 @@ import re
URL_RE
=
re
.
compile
(
r'^edx://(.+)$'
,
re
.
IGNORECASE
)
URL_RE
=
re
.
compile
(
r'^edx://(.+)$'
,
re
.
IGNORECASE
)
def
parse_url
(
string
):
def
parse_url
(
string
):
"""
"""
A url must begin with 'edx://' (case-insensitive match),
A url must begin with 'edx://' (case-insensitive match),
...
@@ -33,8 +34,9 @@ def parse_url(string):
...
@@ -33,8 +34,9 @@ def parse_url(string):
BLOCK_RE
=
re
.
compile
(
r'^\w+$'
,
re
.
IGNORECASE
)
BLOCK_RE
=
re
.
compile
(
r'^\w+$'
,
re
.
IGNORECASE
)
def
parse_block_ref
(
string
):
def
parse_block_ref
(
string
):
"""
r
"""
A block_ref is a string of word_chars.
A block_ref is a string of word_chars.
<word_chars> matches one or more Unicode word characters; this includes most
<word_chars> matches one or more Unicode word characters; this includes most
...
@@ -46,12 +48,13 @@ def parse_block_ref(string):
...
@@ -46,12 +48,13 @@ def parse_block_ref(string):
otherwise returns None.
otherwise returns None.
"""
"""
if
len
(
string
)
>
0
and
BLOCK_RE
.
match
(
string
):
if
len
(
string
)
>
0
and
BLOCK_RE
.
match
(
string
):
return
{
'block'
:
string
}
return
{
'block'
:
string
}
return
None
return
None
GUID_RE
=
re
.
compile
(
r'^(?P<version_guid>[A-F0-9]+)(#(?P<block>\w+))?$'
,
re
.
IGNORECASE
)
GUID_RE
=
re
.
compile
(
r'^(?P<version_guid>[A-F0-9]+)(#(?P<block>\w+))?$'
,
re
.
IGNORECASE
)
def
parse_guid
(
string
):
def
parse_guid
(
string
):
"""
"""
A version_guid is a string of hex digits (0-F).
A version_guid is a string of hex digits (0-F).
...
@@ -68,8 +71,9 @@ def parse_guid(string):
...
@@ -68,8 +71,9 @@ def parse_guid(string):
COURSE_ID_RE
=
re
.
compile
(
r'^(?P<id>(\w+)(\.\w+\w*)*)(;(?P<revision>\w+))?(#(?P<block>\w+))?$'
,
re
.
IGNORECASE
)
COURSE_ID_RE
=
re
.
compile
(
r'^(?P<id>(\w+)(\.\w+\w*)*)(;(?P<revision>\w+))?(#(?P<block>\w+))?$'
,
re
.
IGNORECASE
)
def
parse_course_id
(
string
):
def
parse_course_id
(
string
):
"""
r
"""
A course_id has a main id component.
A course_id has a main id component.
There may also be an optional revision (;published or ;draft).
There may also be an optional revision (;published or ;draft).
...
...
common/lib/xmodule/xmodule/modulestore/split_mongo/__init__.py
View file @
6dab09f5
from
split
import
SplitMongoModuleStore
from
split
import
SplitMongoModuleStore
\ No newline at end of file
common/lib/xmodule/xmodule/modulestore/split_mongo/definition_lazy_loader.py
View file @
6dab09f5
from
xmodule.modulestore.locator
import
DescriptionLocator
from
xmodule.modulestore.locator
import
DescriptionLocator
class
DefinitionLazyLoader
(
object
):
class
DefinitionLazyLoader
(
object
):
"""
"""
A placeholder to put into an xblock in place of its definition which
A placeholder to put into an xblock in place of its definition which
...
...
common/lib/xmodule/xmodule/modulestore/split_mongo/split_mongo_kvs.py
View file @
6dab09f5
...
@@ -58,7 +58,7 @@ class SplitMongoKVS(KeyValueStore):
...
@@ -58,7 +58,7 @@ class SplitMongoKVS(KeyValueStore):
if
isinstance
(
self
.
_definition
,
DefinitionLazyLoader
):
if
isinstance
(
self
.
_definition
,
DefinitionLazyLoader
):
self
.
_definition
=
self
.
_definition
.
fetch
()
self
.
_definition
=
self
.
_definition
.
fetch
()
if
(
key
.
field_name
==
'data'
and
if
(
key
.
field_name
==
'data'
and
not
isinstance
(
self
.
_definition
.
get
(
'data'
),
dict
)):
not
isinstance
(
self
.
_definition
.
get
(
'data'
),
dict
)):
return
self
.
_definition
.
get
(
'data'
)
return
self
.
_definition
.
get
(
'data'
)
elif
'data'
not
in
self
.
_definition
or
key
.
field_name
not
in
self
.
_definition
[
'data'
]:
elif
'data'
not
in
self
.
_definition
or
key
.
field_name
not
in
self
.
_definition
[
'data'
]:
raise
KeyError
()
raise
KeyError
()
...
@@ -85,7 +85,7 @@ class SplitMongoKVS(KeyValueStore):
...
@@ -85,7 +85,7 @@ class SplitMongoKVS(KeyValueStore):
if
isinstance
(
self
.
_definition
,
DefinitionLazyLoader
):
if
isinstance
(
self
.
_definition
,
DefinitionLazyLoader
):
self
.
_definition
=
self
.
_definition
.
fetch
()
self
.
_definition
=
self
.
_definition
.
fetch
()
if
(
key
.
field_name
==
'data'
and
if
(
key
.
field_name
==
'data'
and
not
isinstance
(
self
.
_definition
.
get
(
'data'
),
dict
)):
not
isinstance
(
self
.
_definition
.
get
(
'data'
),
dict
)):
self
.
_definition
.
get
(
'data'
)
self
.
_definition
.
get
(
'data'
)
else
:
else
:
self
.
_definition
.
setdefault
(
'data'
,
{})[
key
.
field_name
]
=
value
self
.
_definition
.
setdefault
(
'data'
,
{})[
key
.
field_name
]
=
value
...
@@ -111,7 +111,7 @@ class SplitMongoKVS(KeyValueStore):
...
@@ -111,7 +111,7 @@ class SplitMongoKVS(KeyValueStore):
if
isinstance
(
self
.
_definition
,
DefinitionLazyLoader
):
if
isinstance
(
self
.
_definition
,
DefinitionLazyLoader
):
self
.
_definition
=
self
.
_definition
.
fetch
()
self
.
_definition
=
self
.
_definition
.
fetch
()
if
(
key
.
field_name
==
'data'
and
if
(
key
.
field_name
==
'data'
and
not
isinstance
(
self
.
_definition
.
get
(
'data'
),
dict
)):
not
isinstance
(
self
.
_definition
.
get
(
'data'
),
dict
)):
self
.
_definition
.
setdefault
(
'data'
,
None
)
self
.
_definition
.
setdefault
(
'data'
,
None
)
else
:
else
:
try
:
try
:
...
@@ -135,7 +135,7 @@ class SplitMongoKVS(KeyValueStore):
...
@@ -135,7 +135,7 @@ class SplitMongoKVS(KeyValueStore):
if
isinstance
(
self
.
_definition
,
DefinitionLazyLoader
):
if
isinstance
(
self
.
_definition
,
DefinitionLazyLoader
):
self
.
_definition
=
self
.
_definition
.
fetch
()
self
.
_definition
=
self
.
_definition
.
fetch
()
if
(
key
.
field_name
==
'data'
and
if
(
key
.
field_name
==
'data'
and
not
isinstance
(
self
.
_definition
.
get
(
'data'
),
dict
)):
not
isinstance
(
self
.
_definition
.
get
(
'data'
),
dict
)):
return
self
.
_definition
.
get
(
'data'
)
is
not
None
return
self
.
_definition
.
get
(
'data'
)
is
not
None
else
:
else
:
return
key
.
field_name
in
self
.
_definition
.
get
(
'data'
,
{})
return
key
.
field_name
in
self
.
_definition
.
get
(
'data'
,
{})
...
@@ -161,4 +161,3 @@ class SplitMongoKVS(KeyValueStore):
...
@@ -161,4 +161,3 @@ class SplitMongoKVS(KeyValueStore):
Get the metadata set by the ancestors (which own metadata may override or not)
Get the metadata set by the ancestors (which own metadata may override or not)
"""
"""
return
self
.
_inherited_metadata
return
self
.
_inherited_metadata
common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore.py
View file @
6dab09f5
This diff is collapsed.
Click to expand it.
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