예제 #1
0
class LW(ComplexModel):
    __namespace__ = '%s/CostOfLiving' % NAMESPACE

    CostOfLiving = Float(
        min_occurs=1,
        doc='Загальний показник',
    )
    CostOfLiving6 = Float(
        min_occurs=1,
        doc='Діти до 6 років',
    )
    CostOfLiving18 = Float(
        min_occurs=1,
        doc='Діти від 6 до 18 років',
    )
    CostOfLivingEmployable = Float(
        min_occurs=1,
        doc='Працездатні особи',
    )
    CostOfLivingInvalid = Float(
        min_occurs=1,
        doc='Особи, що втратили працездатність',
    )
    Begin = Date(min_occurs=1, doc='Дата впровадження, формат (YYYY-MM-DD)')
    End = Date(min_occurs=0, doc='Дата закінчення, формат (YYYY-MM-DD)')
예제 #2
0
class MW(ComplexModel):
    __namespace__ = '%s/MinWage' % NAMESPACE
    MinWageMonth = Float(min_occurs=1, doc='Мінімальна заробітна плата')
    MinWageHour = Float(min_occurs=1,
                        doc='Мінімальна погодина заробітна плата')
    Begin = Date(min_occurs=1, doc='Дата впровадження, формат (YYYY-MM-DD)')
    End = Date(nullable=True, doc='Дата закінчення, формат (YYYY-MM-DD)')
예제 #3
0
    def test_date_format(self):
        t = datetime.date.today()
        format = "%Y %m %d"

        element = etree.Element('test')
        XmlDocument().to_parent(None, Date(format=format), t, element, ns_test)
        assert element[0].text == datetime.date.strftime(t, format)

        dt = XmlDocument().from_element(None, Date(format=format), element[0])
        assert t == dt
예제 #4
0
class ServiceDateResult(ComplexModel):
    inn = String()
    firstname = String()
    surname = String()
    birthdate = Date()
    passport_ser = String()
    passport_num = String()
예제 #5
0
class Call(TableModel):
    __tablename__ = 'cc_call'

    id = Integer64(primary_key=True)
    sessionid = Unicode(1, default=0)
    uniqueid = Unicode(1, null=False)
    card_id = Integer64(null=False, db_column='card_id')
    nasipaddress = Unicode(1, null=False)
    starttime = Date(index=True, default_factory=date.today)
    stoptime = Unicode(1, default="0000-00-00 00:00:00")
    buycost = Decimal
    calledstation = Unicode(1, index=True)
    destination = Integer32
    dnid = Unicode(1, null=False)
    id_card_package_offer = Integer32
    id_did = Integer32
    id_ratecard = Integer32
    id_tariffgroup = Integer32
    id_tariffplan = Integer32
    id_trunk = Integer32
    real_sessiontime = Integer32
    sessionbill = Float
    sessiontime = Integer32
    sipiax = Integer32
    src = Unicode(1)
    terminatecauseid = Integer32(index=True)
예제 #6
0
 def test_date_exclusive_boundaries(self):
     test_model = Date.customize(gt=datetime.date(2016, 1, 1),
         lt=datetime.date(2016, 2, 1))
     self.assertFalse(
           test_model.validate_native(test_model, datetime.date(2016, 1, 1)))
     self.assertFalse(
           test_model.validate_native(test_model, datetime.date(2016, 2, 1)))
예제 #7
0
 def test_date_inclusive_boundaries(self):
     test_model = Date.customize(ge=datetime.date(2016, 1, 1),
         le=datetime.date(2016, 2, 1))
     self.assertTrue(
           test_model.validate_native(test_model, datetime.date(2016, 1, 1)))
     self.assertTrue(
           test_model.validate_native(test_model, datetime.date(2016, 2, 1)))
예제 #8
0
class CallArchive(TableModel):
    __tablename__ = 'cc_call_archive'

    buycost = Decimal
    calledstation = Unicode(1, index=True)
    card = Integer64(db_column='card_id')
    destination = Integer32
    dnid = Unicode(1)
    id = Integer64(primary_key=True)
    id_card_package_offer = Integer32
    id_did = Integer32
    id_ratecard = Integer32
    id_tariffgroup = Integer32
    id_tariffplan = Integer32
    id_trunk = Integer32
    nasipaddress = Unicode(1)
    real_sessiontime = Integer32
    sessionbill = Float
    sessionid = Unicode(1)
    sessiontime = Integer32
    sipiax = Integer32
    src = Unicode(1)
    starttime = Date(index=True)
    stoptime = Date
    terminatecauseid = Integer32(index=True)
    uniqueid = Unicode(1)
예제 #9
0
class CardPackageOffer(TableModel):
    __tablename__ = 'cc_card_package_offer'

    date_consumption = Date(index=True)
    id = Integer64(primary_key=True)
    id_cc_card = Integer64(index=True)
    id_cc_package_offer = Integer64(index=True)
    used_secondes = Integer64
예제 #10
0
class Logpayment(TableModel):
    __tablename__ = 'cc_logpayment'

    id = Integer64(primary_key=True)
    card = Integer64(db_column='card_id')
    date = Date(default_factory=date.today)
    description = Unicode
    payment = Decimal(default=0.0)
    # payment_type (amount:0, correction:1, extra fee:2,agent refund:3)
    payment_type = Integer32(default=0)
    id_logrefill = Integer64
    added_commission = Integer32(default=0)
    added_refill = Integer32(default=0)
    agent = Integer64(db_column='agent_id')
예제 #11
0
class Campaign(TableModel):
    """
    Represents a Campaign entity
    """

    __tablename__ = 'campaign'
    __namespace__ = 'pvtranslator'

    id = UnsignedInteger32(pk=True)
    name = Unicode(32, unique=True, nullable=False)
    date = Date(nullable=False)
    module_id = UnsignedInteger32(fk="module.id", nullable=False)

    def __repr__(self):
        return "<Campaign(name='" + str(self.name) + "', date='" + str(
            self.date) + "')>"
예제 #12
0
class Charge(TableModel):
    __tablename__ = 'cc_charge'

    id = Integer64(primary_key=True)
    amount = Float(default=0)
    charged_status = Integer32(default=0)
    # Values: 1:charge DID setup, 2:Montly charge for DID use, 3:Subscription fee, 4:Extra Charge
    chargetype = Integer32(default=4)
    cover_from = Date
    cover_to = Date
    creationdate = Date(index=True, default_factory=date.today)
    description = Unicode
    id_cc_card = Card(db_column='id_cc_card')
    id_cc_card_subscription = Integer64
    # id_cc_did = Integer64
    cc_did = Did.store_as(table(left='id_cc_did'))
    iduser = Integer32(default=0)
    invoiced_status = Integer32(default=0)
예제 #13
0
class Did(TableModel):
    __tablename__ = 'cc_did'

    id = Integer64(primary_key=True)
    # id_cc_country = Integer32
    # id_cc_didgroup = Integer64
    id_cc_didgroup = Integer32(null=False)
    cc_country = Country.store_as(table(left='id_cc_country'))
    activated = Integer32(null=False)
    did = Unicode(1, unique=True)
    reserved = Integer32
    iduser = Integer64(null=False)
    creationdate = Date(default_factory=date.today)
    startingdate = Date
    expirationdate = Date
    aleg_carrier_connect_charge = Decimal
    aleg_carrier_connect_charge_offp = Decimal
    aleg_carrier_cost_min = Decimal
    aleg_carrier_cost_min_offp = Decimal
    aleg_carrier_increment = Integer32
    aleg_carrier_increment_offp = Integer32
    aleg_carrier_initblock = Integer32
    aleg_carrier_initblock_offp = Integer32
    aleg_retail_connect_charge = Decimal
    aleg_retail_connect_charge_offp = Decimal
    aleg_retail_cost_min = Decimal
    aleg_retail_cost_min_offp = Decimal
    aleg_retail_increment = Integer32
    aleg_retail_increment_offp = Integer32
    aleg_retail_initblock = Integer32
    aleg_retail_initblock_offp = Integer32
    aleg_timeinterval = Unicode
    billingtype = Integer32
    connection_charge = Decimal
    description = Unicode
    fixrate = Float
    max_concurrent = Integer32
    secondusedreal = Integer32
    selling_rate = Decimal
예제 #14
0
 def test_date_extreme_boundary(self):
     self.assertTrue(Date.validate_native(Date, datetime.date.min))
     self.assertTrue(Date.validate_native(Date, datetime.date.max))
예제 #15
0
class InteropPrimitive(ServiceBase):
    @srpc(AnyXml, _returns=AnyXml)
    def echo_any(xml):
        return xml

    @srpc(AnyDict, _returns=AnyDict)
    def echo_any_as_dict(xml_as_dict):
        return xml_as_dict

    @srpc(Integer, _returns=Integer)
    def echo_integer(i):
        return i

    @srpc(String, _returns=String)
    def echo_string(s):
        return s

    @srpc(DateTime, _returns=DateTime)
    def echo_datetime(dt):
        return dt

    @srpc(DateTime(format='ignored'), _returns=DateTime)
    def echo_datetime_with_invalid_format(dt):
        return dt

    @srpc(Date, _returns=Date)
    def echo_date(d):
        return d

    @srpc(Date(format='ignored'), _returns=Date)
    def echo_date_with_invalid_format(d):
        return d

    @srpc(Time, _returns=Time)
    def echo_time(t):
        return t

    @srpc(Time(format='ignored'), _returns=Time)
    def echo_time_with_invalid_format(t):
        return t

    @srpc(Float, _returns=Float)
    def echo_float(f):
        return f

    @srpc(Double, _returns=Double)
    def echo_double(f):
        return f

    @srpc(Boolean, _returns=Boolean)
    def echo_boolean(b):
        return b

    @srpc(DaysOfWeekEnum, _returns=DaysOfWeekEnum)
    def echo_enum(day):
        return day

    @srpc(Duration, _returns=Duration)
    def echo_duration(dur):
        return dur

    @srpc(ByteArray, _returns=ByteArray)
    def echo_bytearray(data):
        return data
예제 #16
0

@srpc(_returns=Iterable(OrganizationModel, member_name="Organization"),
      _out_variable_name="Organizations")
def GetOrganizations():
    orgs_qs = Organization.objects.exclude(parent__isnull=True).extra(
        select={
            'organization_id': 'id'
        }).values('organization_id', 'name')
    return map(lambda org_data: OrganizationModel(**org_data), orgs_qs)


@srpc(Unicode,
      Unicode,
      Unicode,
      Date(format=settings.DATE_FORMAT),
      Integer,
      _returns=Boolean)
def CreatePerson(name, surname, patronymic, birth_date, organization_id):
    try:
        org = Organization.objects.get(pk=organization_id)
    except Organization.DoesNotExist:
        pass
    else:
        new_person = Person.objects.create(name=name,
                                           surname=surname,
                                           patronymic=patronymic,
                                           birth_date=birth_date,
                                           organization=org)
        if new_person:
            return True
예제 #17
0
class Card(TableModel):
    __tablename__ = 'cc_card'

    id = Integer64(primary_key=True)
    # user = ForeignKeyField(User, related_name='tweets')
    creationdate = Date(default_factory=date.today)
    firstusedate = Unicode(1)
    expirationdate = Unicode(1)
    enableexpire = Unicode(1)
    expiredays = Unicode(1)
    username = Unicode(1, null=False)
    useralias = Unicode(1)
    uipass = Unicode(1)
    credit = Float(default=0.0)
    tariff = Unicode(1)
    id_didgroup = Unicode(1)
    activated = Unicode(1, choices=(('f', 'False'), ('t', 'True')))
    status = Integer32(default=1)
    lastname = Unicode(1, default='')
    firstname = Unicode(1, default='')
    address = Unicode(1, default='')
    city = Unicode(1, default='')
    state = Unicode(1, default='')
    country = Unicode(1, default='')
    zipcode = Unicode(1, default='')
    phone = Unicode(1, default='')
    email = Unicode(1, default='')
    fax = Unicode(1, default='')
    # inuse = Unicode(1)
    simultaccess = Integer32(default=0)
    currency = Unicode(3, default='USD')
    # lastuse = Unicode(1)
    # nbused = Unicode(1)
    typepaid = Integer32(default=0)
    creditlimit = Integer32(default=0)
    voipcall = Integer32(default=0)
    sip_buddy = Integer32(default=0)
    iax_buddy = Integer32(default=0)
    language = Unicode(2, default='en')
    redial = Unicode(1, default='')
    runservice = Unicode(1)
    # nbservice = Unicode(1)
    # id_campaign = Unicode(1)
    # num_trials_done = Unicode(1)
    vat = Float(null=False, default=0)
    # servicelastrun = Unicode(1)
    # Using Decimal produce an error
    initialbalance = Float(default=0.0)
    invoiceday = Integer32(default=1)
    autorefill = Integer32(default=0)
    loginkey = Unicode(1, default='')
    mac_addr = Unicode(17, default='00-00-00-00-00-00')
    id_timezone = Integer32(default=0)
    tag = Unicode(1, default='')
    voicemail_permitted = Integer32(default=0)
    voicemail_activated = Integer32(default=0)
    # last_notification = Unicode(1)
    email_notification = Unicode(1, default='')
    notify_email = Integer32(default=0)
    credit_notification = Integer32(default=-1)
    id_group = Integer32(default=1)
    company_name = Unicode(1, default='')
    company_website = Unicode(1, default='')
    vat_rn = Unicode(1)
    traffic = Integer64(default=0)
    traffic_target = Unicode(1, default='')
    # Using Decimal produce an error
    discount = Float(default=0.0)
    # restriction = Unicode(1)
    # id_seria = Unicode(1)
    # serial = Unicode(1)
    block = Integer32(default=0)
    lock_pin = Unicode(1)
    lock_date = Date
    max_concurrent = Integer32(default=10)
예제 #18
0
class CardArchive(TableModel):
    __tablename__ = 'cc_card_archive'

    vat_rn = Unicode(1, db_column='VAT_RN')
    activated = Unicode(1)
    activatedbyuser = Unicode(1)
    address = Unicode(1)
    autorefill = Integer32
    city = Unicode(1)
    company_name = Unicode(1)
    company_website = Unicode(1)
    country = Unicode(1)
    creationdate = Date(index=True)
    credit = Decimal
    credit_notification = Integer32
    creditlimit = Integer32
    currency = Unicode(1)
    discount = Decimal
    email = Unicode(1)
    email_notification = Unicode(1)
    enableexpire = Integer32
    expirationdate = Date
    expiredays = Integer32
    fax = Unicode(1)
    firstname = Unicode(1)
    firstusedate = Date
    iax_buddy = Integer32
    id = Integer64(primary_key=True)
    id_campaign = Integer32
    id_didgroup = Integer32
    id_group = Integer32
    id_timezone = Integer32
    initialbalance = Decimal
    inuse = Integer32
    invoiceday = Integer32
    language = Unicode(1)
    last_notification = Date
    lastname = Unicode(1)
    lastuse = Date
    loginkey = Unicode(1)
    mac_addr = Unicode(1)
    nbservice = Integer32
    nbused = Integer32
    notify_email = Integer32
    num_trials_done = Integer64
    phone = Unicode(1)
    redial = Unicode(1)
    restriction = Integer32
    runservice = Integer32
    servicelastrun = Date
    simultaccess = Integer32
    sip_buddy = Integer32
    state = Unicode(1)
    status = Integer32
    tag = Unicode(1)
    tariff = Integer32
    traffic = Integer64
    traffic_target = Unicode
    typepaid = Integer32
    uipass = Unicode(1)
    useralias = Unicode(1)
    username = Unicode(1, index=True)
    vat = Float
    voicemail_activated = Integer32
    voicemail_permitted = Integer32
    voipcall = Integer32
    zipcode = Unicode(1)