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
5523c288
Commit
5523c288
authored
Aug 06, 2012
by
Victor Shnayder
Committed by
Calen Pennington
Aug 07, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Generate error module url_names using sha1
* means we get the same url_name on each import of the same data.
parent
ecf432ad
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
common/lib/xmodule/xmodule/error_module.py
+3
-3
No files found.
common/lib/xmodule/xmodule/error_module.py
View file @
5523c288
import
hashlib
import
logging
import
random
import
string
...
...
@@ -48,13 +49,12 @@ class ErrorDescriptor(EditingDescriptor):
definition
=
{
'data'
:
inner
}
inner
[
'error_msg'
]
=
str
(
error_msg
)
# Pick a unique
(random) url_name
.
# Pick a unique
url_name -- the sha1 hash of the xml_data
.
# NOTE: We could try to pull out the url_name of the errored descriptor,
# but url_names aren't guaranteed to be unique between descriptor types,
# and ErrorDescriptor can wrap any type. When the wrapped module is fixed,
# it will be written out with the original url_name.
chars
=
string
.
ascii_uppercase
+
string
.
ascii_lowercase
+
string
.
digits
url_name
=
''
.
join
(
random
.
choice
(
chars
)
for
i
in
range
(
16
))
url_name
=
hashlib
.
sha1
(
xml_data
)
.
hexdigest
()
try
:
# If this is already an error tag, don't want to re-wrap 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