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
91fd6170
Commit
91fd6170
authored
Oct 01, 2012
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make cloned items used uuid4 hexes for names, to ensure uniqueness. TODO: Make prettier names
parent
aa0aa653
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
3 deletions
+2
-3
cms/djangoapps/contentstore/views.py
+2
-3
No files found.
cms/djangoapps/contentstore/views.py
View file @
91fd6170
...
@@ -6,6 +6,7 @@ import sys
...
@@ -6,6 +6,7 @@ import sys
import
mimetypes
import
mimetypes
import
StringIO
import
StringIO
from
collections
import
defaultdict
from
collections
import
defaultdict
from
uuid
import
uuid4
# to install PIL on MacOSX: 'easy_install http://dist.repoze.org/PIL-1.1.6.tar.gz'
# to install PIL on MacOSX: 'easy_install http://dist.repoze.org/PIL-1.1.6.tar.gz'
from
PIL
import
Image
from
PIL
import
Image
...
@@ -407,16 +408,14 @@ def save_item(request):
...
@@ -407,16 +408,14 @@ def save_item(request):
def
clone_item
(
request
):
def
clone_item
(
request
):
parent_location
=
Location
(
request
.
POST
[
'parent_location'
])
parent_location
=
Location
(
request
.
POST
[
'parent_location'
])
template
=
Location
(
request
.
POST
[
'template'
])
template
=
Location
(
request
.
POST
[
'template'
])
display_name
=
request
.
POST
[
'name'
]
if
not
has_access
(
request
.
user
,
parent_location
):
if
not
has_access
(
request
.
user
,
parent_location
):
raise
Http404
# TODO (vshnayder): better error
raise
Http404
# TODO (vshnayder): better error
parent
=
modulestore
()
.
get_item
(
parent_location
)
parent
=
modulestore
()
.
get_item
(
parent_location
)
dest_location
=
parent_location
.
_replace
(
category
=
template
.
category
,
name
=
Location
.
clean_for_url_name
(
display_name
)
)
dest_location
=
parent_location
.
_replace
(
category
=
template
.
category
,
name
=
uuid4
()
.
hex
)
new_item
=
modulestore
()
.
clone_item
(
template
,
dest_location
)
new_item
=
modulestore
()
.
clone_item
(
template
,
dest_location
)
new_item
.
metadata
[
'display_name'
]
=
display_name
# TODO: This needs to be deleted when we have proper storage for static content
# TODO: This needs to be deleted when we have proper storage for static content
new_item
.
metadata
[
'data_dir'
]
=
parent
.
metadata
[
'data_dir'
]
new_item
.
metadata
[
'data_dir'
]
=
parent
.
metadata
[
'data_dir'
]
...
...
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