James Gardner: Home > Work > Code > DreamweaverTemplate > 0.1.1 > API Documentation

DreamweaverTemplate v0.1.1 documentation

API Documentation

Parse Dreamweaver templates (.dwt files) and pages.

dreamweavertemplate.DWT
alias of DreamweaverTemplateInstance
class dreamweavertemplate.DreamweaverTemplateInstance(filename=None, template=None, version=4)

Class to parse Macromedia Dreamweaver MX Template files and handle the assignment of content to regions

append(key, value)
Append value to the end of the editable region specified by key.
get(key)
Return the current value of the editable region key.
has_key(key)
Simulate mapping’s methods
items()
Simulate mapping’s methods
keys()
Simulate mapping’s methods
save_as_page(filename=None, template_path=None, old_path=None, new_path=None, tidy=False)

Merge the Editable Regions with the information in the Template to create the HTML page to be output. Returns the HTML.

Each of the regions use InstanceBegin instead of TemplateBegin and the whole document is wrapped in an <!-- InstanceBegin template="..." --> comment

Regions which have changed do not have there links updated as it is assumed you have updated them with the correct links already.

save_as_template(filename=None, tidy=False)
Merge the Editable Regions with the information in the Template to create the HTML page to be output. Returns the HTML.
set(key, value)
Set the editable region specified by key to value.
to_dict()
Return a dictionary containing a copy of the text in editable regions of the page as it stands with the names of theeditable regions as the keys.
exception dreamweavertemplate.TemplateError(msg)

Raised when a general Error in the templates.py module occurs.

Attributes:

msg
explanation of what the specific error is.
dreamweavertemplate.determine_instance_type(template, version)
Check for the presence of an InstanceBegin comment with a template attribute and if it exists, assume the instance is a page, otherwise assume it is a template.
dreamweavertemplate.end_of_start_html_tag(template, filename=None)
dreamweavertemplate.start_of_end_html_tag(template, filename=None)
dreamweavertemplate.tidy_output(output)
James Gardner: Home > Work > Code > DreamweaverTemplate > 0.1.1 > API Documentation