1623 |
1623 |
|
1624 |
1624 |
|
1625 |
1625 |
class FormBackOfficeStatusPage(FormStatusPage):
|
1626 |
|
_q_exports = ['', 'download', 'json', 'action', 'inspect']
|
|
1626 |
_q_exports = ['', 'download', 'json', 'action', 'inspect', 'validate']
|
1627 |
1627 |
form_page_class = FormFillPage
|
1628 |
1628 |
|
1629 |
1629 |
def html_top(self, title = None):
|
... | ... | |
1805 |
1805 |
if not (get_publisher().get_backoffice_root().is_accessible('forms') or
|
1806 |
1806 |
get_publisher().get_backoffice_root().is_accessible('workflows')):
|
1807 |
1807 |
raise errors.AccessForbiddenError()
|
|
1808 |
charset = get_publisher().site_charset
|
1808 |
1809 |
get_response().breadcrumb.append(('inspect', _('Form Inspector')))
|
1809 |
1810 |
self.html_top(self.formdef.name)
|
1810 |
1811 |
r = TemplateIO(html=True)
|
... | ... | |
1814 |
1815 |
r += htmltext(' <li><h3>%s</h3></li>') % _('Substitution variables')
|
1815 |
1816 |
substvars = self.filled.get_substitution_variables()
|
1816 |
1817 |
substvars.update(self.filled.formdef.get_substitution_variables())
|
|
1818 |
|
|
1819 |
def safe(v):
|
|
1820 |
if isinstance(v, str):
|
|
1821 |
try:
|
|
1822 |
unicode(v, charset)
|
|
1823 |
except UnicodeDecodeError:
|
|
1824 |
v = repr(v)
|
|
1825 |
else:
|
|
1826 |
try:
|
|
1827 |
v = unicode(v).encode(charset)
|
|
1828 |
except UnicodeDecodeError:
|
|
1829 |
v = repr(v)
|
|
1830 |
return v
|
1817 |
1831 |
for k, v in sorted(substvars.items()):
|
|
1832 |
k = safe(k)
|
1818 |
1833 |
r += htmltext('<li><code title="%s">%s</code>') % (k, k)
|
1819 |
|
r += htmltext(' <div class="value"><span>%s</span>') % v
|
|
1834 |
r += htmltext(' <div class="value"><span>%s</span>') % safe(v)
|
1820 |
1835 |
if not isinstance(v, basestring):
|
1821 |
1836 |
r += htmltext(' <span class="type">(%s)</span>') % type(v)
|
1822 |
1837 |
r += htmltext('</div>')
|
1823 |
|
-
|