Example #1
0
File: rest.py Project: darius/hmph
 def post_id_V_delete(self, http, hid, serial_id):
     actor = get_actor(hid)
     previous_element = actor.delete_element(int(serial_id))
     if previous_element is None:
         uri = get_uri(actor)
     else:
         uri = element_uri(actor, previous_element)
     http.redirect(uri)
Example #2
0
File: rest.py Project: void4/hmph
 def post_id_V_delete(self, http, hid, serial_id):
     actor = get_actor(hid)
     previous_element = actor.delete_element(int(serial_id))
     if previous_element is None:
         uri = get_uri(actor)
     else:
         uri = element_uri(actor, previous_element)
     http.redirect(uri)
Example #3
0
File: rest.py Project: void4/hmph
 def post_id_V_addmethod(self, http, hid, content):
     actor = get_actor(hid)
     selector, parameters = parse_signature(content)
     actor.add_method(selector, parameters)
     element = actor.get_method(selector)
     http.redirect('%s/edit?%s#%s' % \
                   (get_uri(actor),
                    urllib.parse.urlencode({'serial_id': element.serial_id}),
                    element.serial_id))
Example #4
0
File: rest.py Project: darius/hmph
 def post_id_V_addmethod(self, http, hid, content):
     actor = get_actor(hid)
     selector, parameters = parse_signature(content)
     actor.add_method(selector, parameters)
     element = actor.get_method(selector)
     http.redirect('%s/edit?%s#%s' % \
                   (get_uri(actor), 
                    urllib.urlencode({'serial_id': element.serial_id}),
                    element.serial_id))
Example #5
0
File: rest.py Project: void4/hmph
 def post_id_V_addtext(self, http, hid, content):
     actor = get_actor(hid)
     text = actor.add_text(content)
     http.redirect(element_uri(actor, text))
Example #6
0
File: rest.py Project: void4/hmph
 def post_id_V_addexample(self, http, hid, content):
     actor = get_actor(hid)
     example = actor.add_example(content)
     http.redirect(element_uri(actor, example))
Example #7
0
File: rest.py Project: void4/hmph
 def post_id_V_update(self, http, hid, serial_id, body):
     actor = get_actor(hid)
     element = actor.get_element(int(serial_id))
     element.set_body(body)
     http.redirect(element_uri(actor, element))
Example #8
0
File: rest.py Project: void4/hmph
 def get_id_V_edit(self, http, hid, serial_id):
     actor = get_actor(hid)
     # XXX complain if serial_id is not an existing element
     http.send_html(actor.show_editable(int(serial_id)))
Example #9
0
File: rest.py Project: darius/hmph
 def get_id_V(self, http, hid):
     if not id_is_defined(hid):
         http.send_error(404, 'Object Not Found: %s' % http.path)
     else:
         access_id(hid)
         http.send_html(get_actor(hid).show())
Example #10
0
File: rest.py Project: darius/hmph
 def post_id_V_call(self, http, hid, selector, **query):
     actor = get_actor(hid)
     # XXX what if query needs to contain 'selector' as a key?
     arguments = parse_args(actor.get_method(selector), query)
     result = actor.call(selector, arguments)
     http.redirect('%s' % get_uri(result))
Example #11
0
File: rest.py Project: darius/hmph
 def post_id_V_addtext(self, http, hid, content):
     actor = get_actor(hid)
     text = actor.add_text(content)
     http.redirect(element_uri(actor, text))
Example #12
0
File: rest.py Project: darius/hmph
 def post_id_V_addexample(self, http, hid, content):
     actor = get_actor(hid)
     example = actor.add_example(content)
     http.redirect(element_uri(actor, example))
Example #13
0
File: rest.py Project: darius/hmph
 def post_id_V_update(self, http, hid, serial_id, body):
     actor = get_actor(hid)
     element = actor.get_element(int(serial_id))
     element.set_body(body)
     http.redirect(element_uri(actor, element))
Example #14
0
File: rest.py Project: darius/hmph
 def get_id_V_edit(self, http, hid, serial_id):
     actor = get_actor(hid)
     # XXX complain if serial_id is not an existing element
     http.send_html(actor.show_editable(int(serial_id)))
Example #15
0
File: rest.py Project: void4/hmph
 def post_id_V_call(self, http, hid, selector, **query):
     actor = get_actor(hid)
     # XXX what if query needs to contain 'selector' as a key?
     arguments = parse_args(actor.get_method(selector), query)
     result = actor.call(selector, arguments)
     http.redirect('%s' % get_uri(result))
Example #16
0
File: rest.py Project: void4/hmph
 def get_id_V(self, http, hid):
     if not id_is_defined(hid):
         http.send_error(404, 'Object Not Found: %s' % http.path)
     else:
         access_id(hid)
         http.send_html(get_actor(hid).show())
Example #17
0
 def eval(self, env):
     return get_actor(self.hid)
Example #18
0
 def eval(self, env):
     return get_actor(self.hid)