Commit b8a8b202 by Chris Dodge

update comments and some code violation drive by fixes

parent cf7b744f
...@@ -33,11 +33,13 @@ class HtmlFields(object): ...@@ -33,11 +33,13 @@ class HtmlFields(object):
class HtmlModule(HtmlFields, XModule): class HtmlModule(HtmlFields, XModule):
js = {'coffee': [resource_string(__name__, 'js/src/javascript_loader.coffee'), js = {
resource_string(__name__, 'js/src/collapsible.coffee'), 'coffee': [
resource_string(__name__, 'js/src/html/display.coffee') resource_string(__name__, 'js/src/javascript_loader.coffee'),
] resource_string(__name__, 'js/src/collapsible.coffee'),
} resource_string(__name__, 'js/src/html/display.coffee')
]
}
js_module_name = "HTMLModule" js_module_name = "HTMLModule"
css = {'scss': [resource_string(__name__, 'css/html/display.scss')]} css = {'scss': [resource_string(__name__, 'css/html/display.scss')]}
...@@ -118,8 +120,10 @@ class HtmlDescriptor(HtmlFields, XmlDescriptor, EditingDescriptor): ...@@ -118,8 +120,10 @@ class HtmlDescriptor(HtmlFields, XmlDescriptor, EditingDescriptor):
# from .html # from .html
# 'filename' in html pointers is a relative path # 'filename' in html pointers is a relative path
# (not same as 'html/blah.html' when the pointer is in a directory itself) # (not same as 'html/blah.html' when the pointer is in a directory itself)
pointer_path = "{category}/{url_path}".format(category='html', pointer_path = "{category}/{url_path}".format(
url_path=name_to_pathname(location.name)) category='html',
url_path=name_to_pathname(location.name)
)
base = path(pointer_path).dirname() base = path(pointer_path).dirname()
# log.debug("base = {0}, base.dirname={1}, filename={2}".format(base, base.dirname(), filename)) # log.debug("base = {0}, base.dirname={1}, filename={2}".format(base, base.dirname(), filename))
filepath = "{base}/{name}.html".format(base=base, name=filename) filepath = "{base}/{name}.html".format(base=base, name=filename)
...@@ -168,10 +172,12 @@ class HtmlDescriptor(HtmlFields, XmlDescriptor, EditingDescriptor): ...@@ -168,10 +172,12 @@ class HtmlDescriptor(HtmlFields, XmlDescriptor, EditingDescriptor):
string to filename.html. string to filename.html.
''' '''
# Not proper format. Write html to file, return an empty tag # Write html to file, return an empty tag
pathname = name_to_pathname(self.url_name) pathname = name_to_pathname(self.url_name)
filepath = u'{category}/{pathname}.html'.format(category=self.category, filepath = u'{category}/{pathname}.html'.format(
pathname=pathname) category=self.category,
pathname=pathname
)
resource_fs.makedir(os.path.dirname(filepath), recursive=True, allow_recreate=True) resource_fs.makedir(os.path.dirname(filepath), recursive=True, allow_recreate=True)
with resource_fs.open(filepath, 'w') as filestream: with resource_fs.open(filepath, 'w') as filestream:
...@@ -185,6 +191,7 @@ class HtmlDescriptor(HtmlFields, XmlDescriptor, EditingDescriptor): ...@@ -185,6 +191,7 @@ class HtmlDescriptor(HtmlFields, XmlDescriptor, EditingDescriptor):
elt.set("filename", relname) elt.set("filename", relname)
return elt return elt
class AboutFields(object): class AboutFields(object):
display_name = String( display_name = String(
help="Display name for this module", help="Display name for this module",
...@@ -197,12 +204,14 @@ class AboutFields(object): ...@@ -197,12 +204,14 @@ class AboutFields(object):
scope=Scope.content scope=Scope.content
) )
class AboutModule(AboutFields, HtmlModule): class AboutModule(AboutFields, HtmlModule):
""" """
Overriding defaults but otherwise treated as HtmlModule. Overriding defaults but otherwise treated as HtmlModule.
""" """
pass pass
class AboutDescriptor(AboutFields, HtmlDescriptor): class AboutDescriptor(AboutFields, HtmlDescriptor):
""" """
These pieces of course content are treated as HtmlModules but we need to overload where the templates are located These pieces of course content are treated as HtmlModules but we need to overload where the templates are located
...@@ -211,6 +220,7 @@ class AboutDescriptor(AboutFields, HtmlDescriptor): ...@@ -211,6 +220,7 @@ class AboutDescriptor(AboutFields, HtmlDescriptor):
template_dir_name = "about" template_dir_name = "about"
module_class = AboutModule module_class = AboutModule
class StaticTabFields(object): class StaticTabFields(object):
""" """
The overrides for Static Tabs The overrides for Static Tabs
...@@ -236,6 +246,7 @@ class StaticTabModule(StaticTabFields, HtmlModule): ...@@ -236,6 +246,7 @@ class StaticTabModule(StaticTabFields, HtmlModule):
""" """
pass pass
class StaticTabDescriptor(StaticTabFields, HtmlDescriptor): class StaticTabDescriptor(StaticTabFields, HtmlDescriptor):
""" """
These pieces of course content are treated as HtmlModules but we need to overload where the templates are located These pieces of course content are treated as HtmlModules but we need to overload where the templates are located
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment