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
d0fcaf0a
Commit
d0fcaf0a
authored
Nov 26, 2012
by
Александр
Committed by
Alexander Kryklia
Jan 15, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
next step
parent
c5107d42
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
42 deletions
+43
-42
common/lib/xmodule/xmodule/gst_module.py
+43
-42
No files found.
common/lib/xmodule/xmodule/gst_module.py
View file @
d0fcaf0a
...
...
@@ -97,45 +97,46 @@ class GSTDescriptor(RawDescriptor):
module_class
=
GSTModule
template_dir_name
=
'gst'
# @classmethod
# def definition_from_xml(cls, xml_object, system):
# """
# Pull out the data into dictionary.
# Returns:
# {
# 'def1': 'def1-some-html',
# 'def2': 'def2-some-html'
# }
# """
# import ipdb; ipdb.set_trace()
# children = []
# for child in xml_object:
# try:
# children.append(system.process_xml(etree.tostring(child)).location.url())
# except:
# log.exception("Unable to load child when parsing GST. Continuing...")
# continue
# return {'children': children}
# def definition_to_xml(self, resource_fs):
# '''Return an xml element representing this definition.'''
# import ipdb; ipdb.set_trace()
# xml_object = etree.Element('gst')
# def add_child(k):
# # child_str = '<{tag}>{body}</{tag}>'.format(tag=k, body=self.definition[k])
# child_str = child.export_to_xml(resource_fs)
# child_node = etree.fromstring(child_str)
# xml_object.append(child_node)
# for child in self.get_children():
# add_child(child)
# return xml_object
@classmethod
def
definition_from_xml
(
cls
,
xml_object
,
system
):
"""
Pull out the data into dictionary.
# def __init__(self, system, definition, **kwargs):
# '''Render and save the template for this descriptor instance'''
# super(CustomTagDescriptor, self).__init__(system, definition, **kwargs)
# self.rendered_html = self.render_template(system, definition['data'])
\ No newline at end of file
Returns:
{
'def1': 'def1-some-html',
'def2': 'def2-some-html'
}
"""
import
ipdb
;
ipdb
.
set_trace
()
children
=
[]
for
child
in
xml_object
:
try
:
children
.
append
(
system
.
process_xml
(
etree
.
tostring
(
child
))
.
location
.
url
())
except
:
log
.
exception
(
"Unable to load child when parsing GST. Continuing..."
)
continue
return
{
'children'
:
children
}
def
definition_to_xml
(
self
,
resource_fs
):
'''Return an xml element representing this definition.'''
import
ipdb
;
ipdb
.
set_trace
()
xml_object
=
etree
.
Element
(
'gst'
)
def
add_child
(
k
):
# child_str = '<{tag}>{body}</{tag}>'.format(tag=k, body=self.definition[k])
child_str
=
child
.
export_to_xml
(
resource_fs
)
child_node
=
etree
.
fromstring
(
child_str
)
xml_object
.
append
(
child_node
)
for
child
in
self
.
get_children
():
add_child
(
child
)
return
xml_object
def
__init__
(
self
,
system
,
definition
,
**
kwargs
):
'''Render and save the template for this descriptor instance'''
import
ipdb
;
ipdb
.
set_trace
()
super
(
CustomTagDescriptor
,
self
)
.
__init__
(
system
,
definition
,
**
kwargs
)
self
.
rendered_html
=
self
.
render_template
(
system
,
definition
[
'data'
])
\ No newline at end of file
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