def _test_type(cls, inst): from spyne.util import appreg appreg._applications.clear() class SomeService(ServiceBase): @rpc(_returns=cls, _body_style='bare') def some_call(ctx): return inst prot = HtmlForm(cloth=T_TEST) app = Application([SomeService], 'some_ns', out_protocol=prot) null = NullServer(app, ostr=True) ret = ''.join(null.service.some_call()) try: elt = html.fromstring(ret) except: print(ret) raise show(elt, stdout=False) elt = elt.xpath('//*[@spyne]')[0][ 0] # get the form tag inside the body tag elt = strip_ns(elt) # get rid of namespaces to simplify xpaths in tests print(etree.tostring(elt, pretty_print=True)) return elt
def _test_type_no_root_cloth(cls, inst): from spyne.util import appreg appreg._applications.clear() class SomeService(ServiceBase): @rpc(_returns=cls, _body_style='bare') def some_call(ctx): return inst prot = HtmlForm() app = Application([SomeService], 'some_ns', out_protocol=prot) null = NullServer(app, ostr=True) elt = etree.fromstring(''.join(null.service.some_call())) show(elt) return elt
def __init__(self, app=None, ignore_uncap=False, ignore_wrappers=True, cloth=None, attr_name='spyne_id', root_attr_name='spyne', polymorphic=True, doctype=None, hier_delim='.', cloth_parser=None, produce_header=True, table_name_attr='class', field_name_attr='class', border=0, row_class=None, cell_class=None, header_cell_class=None, can_add=True, can_remove=True): super(HtmlFormTable, self).__init__(app=app, ignore_uncap=ignore_uncap, ignore_wrappers=ignore_wrappers, polymorphic=polymorphic, hier_delim=hier_delim, doctype=doctype, cloth=cloth, attr_name=attr_name, root_attr_name=root_attr_name, cloth_parser=cloth_parser, produce_header=produce_header, table_name_attr=table_name_attr, field_name_attr=field_name_attr, border=border, row_class=row_class, cell_class=cell_class, header_cell_class=header_cell_class) self.prot_form = HtmlForm() self.can_add = can_add self.can_remove = can_remove self.use_global_null_handler = False
from a2billing_spyne.service import ReaderServiceBase, ScreenBase, DalBase SIP_BUDDY_CUST = dict( name=dict(order=1, exc=False), callerid=dict(order=2, exc=False), context=dict(order=3, write=False, exc=False), dtmfmode=dict(order=4, exc=False), host=dict(order=5, write=False, exc=False), secret=dict(order=6, exc=False), type=dict(order=7, exc=False), ) SipBuddyScreen = SipBuddy.customize( prot=HtmlForm(), form_action="put_sip_buddy", child_attrs_all=dict(exc=True,), child_attrs=dict( id=dict(order=0, write=False, exc=False), **SIP_BUDDY_CUST ), ) class NewSipBuddyScreen(ScreenBase): main = SipBuddyScreen class SipBuddyDetailScreen(ScreenBase): main = SipBuddyScreen
class CardDetailScreen(ScreenBase): main = Card.customize( prot=HtmlForm(), form_action="put_card", child_attrs=dict(id=dict(write=False), ), )
class NewCardScreen(ScreenBase): main = Card.customize( prot=HtmlForm(), form_action="put_card", child_attrs=dict(id=dict(exc=True), ), )
from spyne.const.http import HTTP_302 from spyne.protocol.html.table import HtmlColumnTable from neurons.form import HtmlForm, HrefWidget from a2billing_spyne.model import Extensions from a2billing_spyne.service import ReaderServiceBase, ScreenBase, DalBase EXTENSION_CUST = dict(exten=dict(order=1), priority=dict(order=2), app=dict(order=3), appdata=dict(order=4), context=dict(order=5)) ExtScreen = Extensions.customize( prot=HtmlForm(), form_action="put_ext", child_attrs_all=dict(exc=False, ), child_attrs=dict(id=dict(order=0, write=False), **EXTENSION_CUST), ) class NewExtScreen(ScreenBase): main = ExtScreen class NewExtDetailScreen(ScreenBase): main = ExtScreen def _write_new_ext_link(ctx, cls, inst, parent, name, *kwargs):