Пример #1
0
    def show(self, script, actor, editable):
        # XXX some code duplication wrt Element.show()
        if actor is None:
            maybe_call = ''
            env = global_env
        else:
            maybe_call = \
                rest.method_call_form(actor or script,
                                      self.selector, 
                                      self._argument_field())
            env = actor.get_env()
        if editable:
            maybe_edit = \
                rest.element_edit_form(actor or script, self.serial_id)
            maybe_delete = \
                rest.element_delete_form(actor or script, self.serial_id)
        else:
            maybe_edit = ''
            maybe_delete = ''
        return '''
<table>
 <tr>
  <td>%(maybe_edit)s
  <td>%(maybe_delete)s
  <td>%(maybe_call)s
 <tr>
  <td colspan="3">
   %(signature)s
   <blockquote>%(body)s</blockquote>
</table>''' % { 'maybe_edit': maybe_edit,
                'maybe_delete': maybe_delete,
                'maybe_call': maybe_call,
                'signature': self.get_heading(),
                'body': self.mark_up_body(env) }
Пример #2
0
    def show_bare(self, script, actor):
        heading = self.get_heading()
        if actor is None:
            return heading
        else:
            call = rest.method_call_form(actor or script,
                                         self.selector, 
                                         self._argument_field())
            return '''
<table>
 <tr>
  <td>%(call)s
 <tr>
  <td>
   %(signature)s
</table>''' % { 'call': call,
                'signature': heading }
Пример #3
0
    def show_bare(self, script, actor):
        heading = self.get_heading()
        if actor is None:
            return heading
        else:
            call = rest.method_call_form(actor or script, self.selector,
                                         self._argument_field())
            return '''
<table>
 <tr>
  <td>%(call)s
 <tr>
  <td>
   %(signature)s
</table>''' % {
                'call': call,
                'signature': heading
            }
Пример #4
0
    def show(self, script, actor, editable):
        # XXX some code duplication wrt Element.show()
        if actor is None:
            maybe_call = ''
            env = global_env
        else:
            maybe_call = \
                rest.method_call_form(actor or script,
                                      self.selector,
                                      self._argument_field())
            env = actor.get_env()
        if editable:
            maybe_edit = \
                rest.element_edit_form(actor or script, self.serial_id)
            maybe_delete = \
                rest.element_delete_form(actor or script, self.serial_id)
        else:
            maybe_edit = ''
            maybe_delete = ''
        return '''
<table>
 <tr>
  <td>%(maybe_edit)s
  <td>%(maybe_delete)s
  <td>%(maybe_call)s
 <tr>
  <td colspan="3">
   %(signature)s
   <blockquote>%(body)s</blockquote>
</table>''' % {
            'maybe_edit': maybe_edit,
            'maybe_delete': maybe_delete,
            'maybe_call': maybe_call,
            'signature': self.get_heading(),
            'body': self.mark_up_body(env)
        }