class Iso639(TableModel): __tablename__ = 'cc_iso639' charset = Unicode(1) code = Unicode(1, primary_key=True) lname = Unicode(1) name = Unicode(1, unique=True)
class Backup(TableModel): __tablename__ = 'cc_backup' creationdate = Date id = Integer64(primary_key=True) name = Unicode(1, unique=True) path = Unicode(1)
class Country(TableModel): __tablename__ = 'cc_country' id = Integer64(primary_key=True) countrycode = Unicode(1) countryname = Unicode(1) countryprefix = Unicode(1)
class Timezone(TableModel): __tablename__ = 'cc_timezone' id = Integer32(primary_key=True) gmtoffset = Integer64 gmttime = Unicode(1) gmtzone = Unicode(1)
class HelloWorldService(ServiceBase): @rpc(Unicode(default='World'), UnsignedInteger(default=5), _returns=Iterable(Unicode)) def say_hello(ctx, name, times): # workaround for Python2's lacking of nonlocal times = [times] def _cb(push): # This callback is called immediately after the function returns. if times[0] > 0: times[0] -= 1 data = u'Hello, %s' % name print data # The object passed to the append() method is immediately # serialized to bytes and pushed to the response stream's # file-like object. push.append(data) # When a push-callback returns anything other than a deferred, # the response gets closed. return deferLater(reactor, 1, _cb, push) # This is Spyne's way of returning NOT_DONE_YET return Iterable.Push(_cb) @rpc(Unicode(default='World'), _returns=Iterable(Unicode)) def say_hello_forever(ctx, name): def _cb(push): push.append(u'Hello, %s' % name) return deferLater(reactor, 0.1, _cb, push) return Iterable.Push(_cb)
class Support(TableModel): __tablename__ = 'cc_support' id = Integer32(primary_key=True) email = Unicode(1) language = Unicode(1) name = Unicode(1)
class StockService(Service): @rpc(Unicode(encoding='utf-8'), Float(ge=0.0), _in_header=(AuthHeader,), _operation_name='CreateStock', _returns=String) def create_stock(ctx, StockName, StockPrice): user_name = ctx.in_header.UserName token = ctx.in_header.Token if all([user_name, token]): result = handlers.create_stock(user_name, token, StockName, StockPrice) if result['result']: return result['message'] raise Fault(result['side'], result['message']) raise Fault('Client', 'Нет прав доступа') @rpc(Unicode(encoding='utf-8'), _operation_name='GetStockPrice', _returns=Float) def get_stock_price(ctx, StockName): result = handlers.get_stock_price(StockName) if result['result']: return result['message'] raise Fault(result['side'], result['message']) @rpc(Unicode(encoding='utf-8'), Float(ge=0.0), _in_header=(AuthHeader,), _operation_name='SetStockPrice', _returns=Integer) def set_stock_price(ctx, StockName, Price): user_name = ctx.in_header.UserName token = ctx.in_header.Token if all([user_name, token]): result = handlers.set_stock_price(user_name, token, StockName, Price) if result['result']: return result['message'] raise Fault(result['side'], result['message']) raise Fault('Client', 'Нет прав доступа.')
class Campaign(TableModel): __tablename__ = 'cc_campaign' id = Integer64(primary_key=True) creationdate = Date daily_start_time = Time daily_stop_time = Time description = Unicode expirationdate = Date forward_number = Unicode(1) frequency = Integer32 friday = Integer32 id_campaign_config = Integer32 id_card = Integer64 id_cid_group = Integer32 monday = Integer32 name = Unicode(1, unique=True) nb_callmade = Integer32 saturday = Integer32 secondusedreal = Integer32 startingdate = Date status = Integer32 sunday = Integer32 thursday = Integer32 tuesday = Integer32 wednesday = Integer32
class CampaignConfig(TableModel): __tablename__ = 'cc_campaign_config' id = Integer32(primary_key=True) context = Unicode(1) description = Unicode flatrate = Decimal name = Unicode(1)
class Callerid(TableModel): __tablename__ = 'cc_callerid' id = Integer64(primary_key=True) # id_cc_card = Integer64 cc_card = Card.store_as(table(left='id_cc_card')) activated = Unicode(1, default='t') cid = Unicode(1, unique=True)
class Permission(TableModel): __tablename__ = 'permission' __namespace__ = 'spyne.examples.user_manager' __table_args__ = {"sqlite_autoincrement": True} id = UnsignedInteger32(pk=True) application = Unicode(values=('usermgr', 'accountmgr')) operation = Unicode(values=('read', 'modify', 'delete'))
class Permission(TableModel): __tablename__ = 'permission' __namespace__ = 'spyne.examples.sql_crud' __table_args__ = {"sqlite_autoincrement": True} id = UnsignedInteger32(primary_key=True) application = Unicode(256) operation = Unicode(256)
class User(TableModel): __tablename__ = 'user' id = Integer64(primary_key=True) active = Integer32 admin = Integer32 email = Unicode(1, unique=True) password = Unicode(1) username = Unicode(1, unique=True)
class SubscriptionSignup(TableModel): __tablename__ = 'cc_subscription_signup' description = Unicode(1) enable = Integer32 id = Integer64(primary_key=True) id_callplan = Integer64 id_subscription = Integer64 label = Unicode(1)
class Speeddial(TableModel): __tablename__ = 'cc_speeddial' creationdate = Date id = Integer64(primary_key=True) id_cc_card = Integer64 name = Unicode(1) phone = Unicode(1) speeddial = Integer32
class SomeObject(ComplexModel): _type_info = [ ('i0', Integer), ('s0', Unicode), ('i1', Integer(fieldset=fset_one)), ('s1', Unicode(fieldset=fset_one)), ('i2', Integer(fieldset=fset_two)), ('s2', Unicode(fieldset=fset_two)), ]
class Extensions(TableModel): __tablename__ = 'cc_extension' id = Integer32(primary_key=True) context = Unicode(64, default='home') exten = Unicode(20, default='') priority = Unicode(4, default='0') app = Unicode(20, default='Dial') appdata = Unicode(128, default='')
class Currencies(TableModel): __tablename__ = 'cc_currencies' id = Integer32(primary_key=True) basecurrency = Unicode(1) currency = Unicode(1, unique=True) lastupdate = Date name = Unicode(1) value = Decimal
class User(TableModel): __tablename__ = 'user' __namespace__ = 'spyne.examples.sql_crud' __table_args__ = {"sqlite_autoincrement": True} id = UnsignedInteger32(primary_key=True) name = Unicode(256) first_name = Unicode(256) last_name = Unicode(256) permissions = Array(Permission, store_as='table')
class User(TableModel): __tablename__ = 'user' __namespace__ = 'spyne.examples.user_manager' __table_args__ = {"sqlite_autoincrement": True} id = UnsignedInteger32(pk=True) email = Unicode(64, pattern=r'[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}') user_name = Unicode(32, min_len=4, pattern='[a-z0-9.]+') full_name = Unicode(64, pattern='\w+( \w+)+') permissions = Array(Permission).store_as('table')
class ServerManager(TableModel): __tablename__ = 'cc_server_manager' id = Integer64(primary_key=True) id_group = Integer32 lasttime_used = Date manager_host = Unicode(1) manager_secret = Unicode(1) manager_username = Unicode(1) server_ip = Unicode(1)
class Phonenumber(TableModel): __tablename__ = 'cc_phonenumber' amount = Integer32 creationdate = Date id = Integer64(primary_key=True) id_phonebook = Integer32 info = Unicode name = Unicode(1) number = Unicode(1) status = Integer32
class Notification(TableModel): __tablename__ = 'cc_notification' date = Date from_ = Integer64(db_column='from_id') from_type = Integer32 id = Integer64(primary_key=True) key_value = Unicode(1) link = Integer64(db_column='link_id') link_type = Unicode(1) priority = Integer32
class Invoice(TableModel): __tablename__ = 'cc_invoice' date = Date description = Unicode id = Integer64(primary_key=True) id_card = Integer64 paid_status = Integer32 reference = Unicode(1, unique=True) status = Integer32 title = Unicode(1)
class Preferences(ComplexModel): _type_info = [ ('timezone', M(Unicode(values=pytz.all_timezones_set))), ('font_size', UnsignedInteger8( values_dict={10: 'Small', 20: 'Medium', 30: 'Large'}, default=20, )), ('theme', Unicode( values={'dark', 'light'}, default='light', )), ]
class Monitor(TableModel): __tablename__ = 'cc_monitor' description = Unicode(1) dial_code = Integer32 enable = Integer32 id = Integer64(primary_key=True) label = Unicode(1) query = Unicode(1) query_type = Integer32 result_type = Integer32 text_intro = Unicode(1)
class LogEntryMixin(TableModel): __mixin__ = True __table_args__ = {"sqlite_autoincrement": True} id = Integer64(primary_key=True) time = DateTime(timezone=False) user = Unicode(256, index='btree') method = Unicode(64, index='btree') req_xml = AnyXml req_json = AnyDict(store_as='json') err_code = Integer resp_err = AnyDict(store_as='json') resp_int = Integer duration = Integer
class SystemLog(TableModel): __tablename__ = 'cc_system_log' id = Integer64(primary_key=True) action = Unicode agent = Integer32 creationdate = Date data = Unicode description = Unicode iduser = Integer32 ipaddress = Unicode(1) loglevel = Integer32 pagename = Unicode(1) tablename = Unicode(1)
class CardSubscription(TableModel): __tablename__ = 'cc_card_subscription' id = Integer64(primary_key=True) id_cc_card = Integer64 id_subscription_fee = Integer32 last_run = Date limit_pay_date = Date next_billing_date = Date paid_status = Integer32 product = Unicode(1, db_column='product_id') product_name = Unicode(1) startdate = Date stopdate = Date
class Voucher(TableModel): __tablename__ = 'cc_voucher' activated = Unicode(1) creationdate = Date credit = Float currency = Unicode(1) expirationdate = Date id = Integer64(primary_key=True) tag = Unicode(1) used = Integer32 usedate = Date usedcardnumber = Unicode(1) voucher = Unicode(1, unique=True)