コード例 #1
0
ファイル: db.py プロジェクト: mfkaptan/spynepi
class Person(TableModel):
    __tablename__ = "%s_person" % TABLE_PREFIX
    __table_args__ = {"sqlite_autoincrement": True}

    id = Integer32(primary_key=True)
    person_name = String(256)
    person_email = String(256)
コード例 #2
0
    def test_max_len(self):
        StrictType = String(max_len=3)

        self.assertEquals(StrictType.validate_string(StrictType, 'a'), True)
        self.assertEquals(StrictType.validate_string(StrictType, 'aaa'), True)
        self.assertEquals(StrictType.validate_string(StrictType, 'aaaa'),
                          False)
コード例 #3
0
class DetailedHospitalInfo(ComplexModel):
    __namespace__ = SOAP_NAMESPACE

    uid = Unicode()
    uid.Annotations.doc = u'Уникальный идентификатор ЛПУ'
    name = Unicode()
    name.Annotations.doc = u'Полное наименование ЛПУ'
    type = Unicode()
    type.Annotations.doc = u'Наименование типа (категории) ЛПУ'
    phone = String()
    phone.Annotations.doc = u'Номер телефона ЛПУ'
    email = Unicode()
    email.Annotations.doc = u'Адрес электронной почты ЛПУ'
    siteURL = String()
    siteURL.Annotations.doc = u'Адрес сайта ЛПУ'
    schedule = Unicode()
    schedule.Annotations.doc = (
        u'Информация о расписании работы объекта, '
        u'если оно отличается от общего расписания работы ЛПУ')
    buildings = HospitalAddress.customize(
        max_occurs='unbounded',
        doc=u'Перечень адресов зданий, входящих в состав ЛПУ')
    servicedDistricts = ServicedDistrict.customize(max_occurs='unbounded')

    def __init__(self, **kwargs):
        super(DetailedHospitalInfo,
              self).__init__(doc=u'Подробная информация о ЛПУ', **kwargs)
コード例 #4
0
        class SomeService(ServiceBase):
            @srpc(String(pattern='a'))
            def some_method(s):
                pass

            @srpc(String(pattern='a', max_occurs=2))
            def some_other_method(s):
                pass
コード例 #5
0
    def test_pattern(self):
        # Pattern match needs to be checked after the string is decoded, that's
        # why we need to use validate_native here.
        StrictType = String(pattern='[a-z]')

        self.assertEquals(StrictType.validate_native(StrictType, 'a'), True)
        self.assertEquals(StrictType.validate_native(StrictType, 'a1'), False)
        self.assertEquals(StrictType.validate_native(StrictType, '1'), False)
コード例 #6
0
class SisMsg(ComplexModel):
    """Container with metadata for Jiva integration messages
    carried in the MQ payload.
    """
    data_source = String(nillable=False, min_occurs=1, max_occurs=1, max_len=50)
    direction = String(nillable=False, min_occurs=1, max_occurs=1, max_len=50)
    interface_name = String(nillable=False, min_occurs=1, max_occurs=1, max_len=50)
    crt_dt = DateTime(nillable=False)
コード例 #7
0
ファイル: test_soft_validation.py プロジェクト: knoxsp/spyne
    def test_pattern(self):
        # Pattern match needs to be checked after the string is decoded, that's
        # why we need to use validate_native here.
        StrictType = String(pattern='[a-z]')

        self.assertEquals(StrictType.validate_native(StrictType, 'a'), True)
        self.assertEquals(StrictType.validate_native(StrictType, 'a1'), False)
        self.assertEquals(StrictType.validate_native(StrictType, '1'), False)
コード例 #8
0
class CancelRequest(ComplexModel):
    __namespace__ = SOAP_NAMESPACE

    hospitalUid = String(doc=u'Уникальный идентификатор ЛПУ')
    ticketUid = String(
        doc=u'Идентификатор ранее поданной заявки о записи на приём')

    def __init__(self):
        super(CancelRequest,
              self).__init__(doc=u'Данные запроса об отмене записи на приём')
コード例 #9
0
class NewEnqueue(ComplexModel):
    __namespace__ = SOAP_NAMESPACE

    id = String(doc=u'Уникальный идентификатор услуги в Реестре')
    LPUKey = String(doc=u'Key LPU')
    EPGUKey = String(doc=u'ключ на EPGU')
    Status = Unicode(doc=u'Статус')
    data = Unicode(doc=u'Наименование услуги')

    def __init__(self, **kwargs):
        super(NewEnqueue, self).__init__(doc=u'Запись пациента', **kwargs)
コード例 #10
0
class SetTicketReadStatusRequest(ComplexModel):
    __namespace__ = SOAP_NAMESPACE

    ticketID = String(doc=u'Один идентификатор записи')
    EPGUKey = String(doc=u'EPGU Key')
    LPUKey = String(doc=u'LPU Key')
    value = Unicode(doc=u'значение')

    def __init__(self):
        super(SetTicketReadStatusRequest, self).__init__(
            doc=u'Параметры запроса для обновления  информация о записи')
コード例 #11
0
class ServTypesInfo(ComplexModel):
    __namespace__ = SOAP_NAMESPACE

    id = String(doc=u'Уникальный идентификатор услуги в Реестре')
    servTypeName = Unicode(doc=u'Наименование услуги')
    speciality = Unicode(doc=u'Наименование специальности')
    keyEPGU = String(doc=u'ключ на EPGU')

    def __init__(self, **kwargs):
        super(ServTypesInfo, self).__init__(doc=u'Информация об услугах',
                                            **kwargs)
コード例 #12
0
class SetHospitalInfoRequest(ComplexModel):
    __namespace__ = SOAP_NAMESPACE

    hospitalUid = String()
    hospitalUid.Annotations.doc = u'Один идентификатор ЛПУ'
    keyEPGU = String()
    keyEPGU.Annotations.doc = u'идентификатор ЛПУ на ЕПГУ'

    def __init__(self):
        super(SetHospitalInfoRequest, self).__init__(
            doc=u'Параметры запроса для обновления информация о ЛПУ')
コード例 #13
0
class DetailedOperationStatus(ComplexModel):
    __namespace__ = SOAP_NAMESPACE

    status = String()
    status.Annotations.doc = u'Статус операции'
    errMessage = String()
    errMessage.Annotations.doc = u'Сообщение об ошибке'

    def __init__(self):
        super(DetailedOperationStatus,
              self).__init__(doc=u'Подробная информация о статусе')
コード例 #14
0
class GetTicketStatusRequest(ComplexModel):
    __namespace__ = SOAP_NAMESPACE

    hospitalUid = String(doc=u'Уникальный идентификатор ЛПУ')
    ticketUid = String(
        doc=
        u'Уникальный для МИС соответствующего ЛПУ идентификатор ранее поданной заявки на приём'
    )
    lastUid = String(doc=u'Последний обработанный тикет')

    def __init__(self):
        super(GetTicketStatusRequest, self).__init__(
            doc=u'Данные запроса о текущем статусе заявки на приём')
コード例 #15
0
ファイル: db.py プロジェクト: mfkaptan/spynepi
class Release(TableModel):
    __tablename__ = "%s_release" % TABLE_PREFIX
    __table_args__ = {"sqlite_autoincrement": True}

    id = Integer32(primary_key=True)
    release_cdate = Date
    rdf_about = String(256)
    release_version = String(10)
    meta_version = String(10)
    release_summary = String(256)
    release_platform = String(30)

    distributions = Array(Distribution).store_as(table(right="release_id"))
コード例 #16
0
class ListSpecialitiesRequest(ComplexModel):
    __namespace__ = SOAP_NAMESPACE

    hospitalUid = String(
        doc=
        u'Перечень уникальных идентификаторов ЛПУ, для которых надо вернуть перечень специальностей'
    )
    hospitalUidFrom = String(doc=u'Идентификатор отправителя')

    def __init__(self):
        super(
            ListSpecialitiesRequest,
            self).__init__(doc=u'Критерии для получения списка специальностей')
コード例 #17
0
class ListNewEnqueueRequest(ComplexModel):
    __namespace__ = SOAP_NAMESPACE

    hospitalUid = String(
        doc=
        u'Уникальный идентификатор ЛПУ, для которого надо вернуть список новых записей'
    )
    EPGUKey = String(doc=u'Key EPGU')

    def __init__(self):
        super(
            ListNewEnqueueRequest,
            self).__init__(doc=u'Критерии для получения списка новых записей')
コード例 #18
0
class EnqueueResponse(ComplexModel):
    __namespace__ = SOAP_NAMESPACE

    result = Boolean(doc=u'Результат запроса о записи на приём')
    message = String(doc=u'Сообщение об ошибке')
    ticketUid = String(
        doc=u'Уникальный для МИС данного ЛПУ идентификатор принятой заявки')
    printableDocument = String(
        doc=
        u'Данныее электронного документа с печатной формой заявки на приём (талоном)'
    )

    def __init__(self):
        super(EnqueueResponse,
              self).__init__(doc=u'Данные запроса о записи на приём')
コード例 #19
0
class Transporte(Servicio):
    empresa = String
    tipoTransporte = String(values=["TERRESTRE", "AEREO", "MARITIMO"])
    origen = String
    destino = String
    horaSalida = String
    horaLlegada = String
コード例 #20
0
def get_spyne_type(v):
    """This function maps sqlalchemy types to spyne types."""

    rpc_type = None

    if isinstance(v.type, sqlalchemy.Enum):
        if v.type.convert_unicode:
            rpc_type = Unicode(values=v.type.enums)
        else:
            rpc_type = Enum(*v.type.enums, **{'type_name': v.type.name})

    elif isinstance(v.type, sqlalchemy.Unicode):
        rpc_type = Unicode(v.type.length)

    elif isinstance(v.type, sqlalchemy.String):
        rpc_type = String(v.type.length)

    elif isinstance(v.type, sqlalchemy.UnicodeText):
        rpc_type = Unicode

    elif isinstance(v.type, sqlalchemy.Text):
        rpc_type = String

    elif isinstance(v.type, (sqlalchemy.Numeric)):
        rpc_type = Decimal(v.type.precision, v.type.scale)

    elif type(v.type) in _sq2sp_type_map:
        rpc_type = _sq2sp_type_map[type(v.type)]

    else:
        raise Exception("soap_type was not found. maybe _type_map needs a "
                        "new entry. %r" % v)

    return rpc_type
コード例 #21
0
class SetParameterAttributesStruct(Tr069ComplexModel):
    _type_info = odict()
    _type_info["Name"] = String(max_length=256)
    _type_info["NotificationChange"] = Boolean
    _type_info["Notification"] = Integer
    _type_info["AccessListChange"] = Boolean
    _type_info["AccessList"] = AccessList
コード例 #22
0
ファイル: test_msgpack.py プロジェクト: yanni21/spyne
 class SomeService(Service):
     @rpc(String(max_occurs='unbounded'),
          _returns=Array(KeyValuePair),
          _in_variable_names={'keys': 'key'})
     def get_values(ctx, keys):
         for k in keys:
             yield KeyValuePair(key=k, value=data[k])
コード例 #23
0
ファイル: _test_dictdoc.py プロジェクト: wrightrocket/spyne
 class SomeService(ServiceBase):
     @srpc(String(encoding='utf8'), _returns=String)
     def some_call(p):
         print(p)
         print(type(p))
         assert isinstance(p, str)
         return p
コード例 #24
0
ファイル: server_basic.py プロジェクト: mangroovie/spyne
class User(ComplexModel):
    __namespace__ = 'spyne.examples.user_manager'

    user_id = Integer
    user_name = String
    first_name = String
    last_name = String
    email = String(pattern=r'[a-z0-9._%+-]+@[a-z0-9.-]+\.[A-Z]{2,4}')
    permissions = Array(Permission)
コード例 #25
0
class NonNillableClass(ComplexModel):
    __namespace__ = "hunk.sunk"

    nillable = False
    min_occurs = 1

    dt = DateTime(min_occurs=1, nillable=False)
    i = Integer(nillable=False)
    s = String(min_len=1, nillable=False)
コード例 #26
0
class DynProtService(ServiceBase):
    protocols = {}

    @rpc(String(values=protocols.keys(), encoding='ascii'), _returns=DateTime,
                                _patterns=[HttpPattern('/get_utc_time.<prot>')])
    def get_utc_time(ctx, prot):
        DynProtService.protocols[prot](ctx)

        return datetime.utcnow()
コード例 #27
0
ファイル: events.py プロジェクト: mangroovie/spyne
class HelloWorldService(ServiceBase):
    @srpc(String, Integer, _returns=String(max_occurs='unbounded'))
    def say_hello(name, times):
        results = []

        for i in range(0, times):
            results.append('Hello, %s' % name)

        return results
コード例 #28
0
ファイル: test_primitive.py プロジェクト: jpunwin/spyne
    def test_string(self):
        s = String()
        element = etree.Element('test')
        XmlDocument().to_parent(None, String, 'value', element, ns_test)
        element = element[0]

        self.assertEquals(element.text, 'value')
        value = XmlDocument().from_element(None, String, element)
        self.assertEquals(value, 'value')
コード例 #29
0
ファイル: db.py プロジェクト: mfkaptan/spynepi
class Package(TableModel):
    __tablename__ = "%s_package" % TABLE_PREFIX
    __table_args__ = (
        (UniqueConstraint("package_name"), ),
        {
            "sqlite_autoincrement": True
        },
    )

    id = Integer32(primary_key=True)
    rdf_about = Unicode(256)
    package_name = String(40)
    package_cdate = Date
    package_description = Unicode
    package_license = Unicode(256)
    package_home_page = String(256)

    owners = Array(Person).store_as(table(right="owner_id"))
    releases = Array(Release).store_as(table(right="package_id"))
コード例 #30
0
class GetHospitalUidRequest(ComplexModel):
    __namespace__ = SOAP_NAMESPACE

    hospitalCode = String(doc=u'ИНФИС код ЛПУ')

    def __init__(self):
        super(GetHospitalUidRequest, self).__init__(
            doc=
            u'Параметры запроса для получения идентификатора ЛПУ по его ИНФИС коду'
        )
コード例 #31
0
class DeviceIdStruct(Tr069ComplexModel):
    _type_info = odict()
    _type_info["Manufacturer"] = String(max_length=64)
    _type_info["OUI"] = String(length=6)
    _type_info["ProductClass"] = String(max_length=64)
    _type_info["SerialNumber"] = String(max_length=64)

    def as_dict(self):
        """
        Overriding default implementation to fix memory leak. Can remove if
        or after https://github.com/arskom/spyne/pull/579 lands.

        Only patching it for this model because it's the only place in enodebd
        where we call this method.
        """
        flat_type_info = self.get_flat_type_info(self.__class__)
        return dict((
            (k, getattr(self, k)) for k in flat_type_info
            if getattr(self, k) is not None
        ))
コード例 #32
0
ファイル: test_soft_validation.py プロジェクト: rahims/spyne
    def test_min_len(self):
        StrictType = String(min_len=3)

        self.assertEquals(StrictType.validate_string(StrictType, "aaa"), True)
        self.assertEquals(StrictType.validate_string(StrictType, "a"), False)
コード例 #33
0
ファイル: test_soft_validation.py プロジェクト: rahims/spyne
    def test_pattern(self):
        StrictType = String(pattern="[a-z]")

        self.assertEquals(StrictType.validate_string(StrictType, "a"), True)
        self.assertEquals(StrictType.validate_string(StrictType, "a1"), False)
        self.assertEquals(StrictType.validate_string(StrictType, "1"), False)
コード例 #34
0
    def test_pattern(self):
        StrictType = String(pattern='[a-z]')

        self.assertEquals(StrictType.validate_string(StrictType, 'a'), True)
        self.assertEquals(StrictType.validate_string(StrictType, 'a1'), False)
        self.assertEquals(StrictType.validate_string(StrictType, '1'), False)
コード例 #35
0
    def test_max_len(self):
        StrictType = String(max_len=3)

        self.assertEquals(StrictType.validate_string(StrictType, 'a'), True)
        self.assertEquals(StrictType.validate_string(StrictType, 'aaa'), True)
        self.assertEquals(StrictType.validate_string(StrictType, 'aaaa'), False)