class consignee(ComplexModel): __namespace__ = '' Name = String(max_len=255).customize(max_occurs=1, min_occurs=0) Code = String(max_len=10).customize(max_occurs=1, min_occurs=0) Identifier = String(max_len=36).customize(max_occurs=1, min_occurs=0) Place = String(max_len=512).customize(max_occurs=1, min_occurs=0) Address = String(max_len=512).customize(max_occurs=1, min_occurs=0) AddressCode = String(max_len=36).customize(max_occurs=1, min_occurs=0) Agent = String(max_len=255).customize(max_occurs=1, min_occurs=0) AgentCode = Integer.customize(max_occurs=1, min_occurs=0) Behalf = String(max_len=512).customize(max_occurs=1, min_occurs=0) # man = Man Type = Integer.customize(max_occurs=1, min_occurs=0) @staticmethod def generate(): return { 'Name': 'hello', 'Code': 0, 'Identifier': '0000000000', 'Place': 'hello', 'Address': 'hello', 'AddressCode': 'hi', 'Agent': 'hi', 'AgentCode': 0, 'Behalf': 'hi', 'Type': 0, }
def test_integer_values(self): v = 4 cls = Integer(type_name="tn", values=list(range(5))) assert not cls.get_type_name() is Unicode.Empty elt = _test_type(cls, v).xpath('div/select')[0] assert elt.tag == 'select' assert elt.xpath("option/@value") == ['']+[str(vvv) for vvv in range(5)] assert elt.xpath("option[@selected]/text()") == [str(v)]
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 Add_DNS_Record_Record(ComplexModel): __namespace__ = "http://subreg.cz/wsdl" _type_info = [ ('name', Unicode), ('type', Unicode), ('content', Unicode.customize(min_occurs=0)), ('prio', Integer.customize(min_occurs=0)), ('ttl', Integer.customize(min_occurs=0)), ]
def test_integer_values(self): v = 3 cls = Integer(type_name="tn", values=list(range(5))) assert not cls.get_type_name() is Unicode.Empty elt = _test_type(cls, v).xpath('div/select')[0] assert elt.tag == 'select' assert elt.xpath( "option/@value") == [''] + [str(vvv) for vvv in range(5)] assert elt.xpath("option[@selected]/text()") == [str(v)]
class Consignee(ComplexModel): __namespace__ = '' Name = String(max_len=255).customize(max_occurs=1, min_occurs=0) Code = String(max_len=10).customize(max_occurs=1, min_occurs=0) Identifier = String(max_len=36).customize(max_occurs=1, min_occurs=0) Place = String(max_len=512).customize(max_occurs=1, min_occurs=0) Address = String(max_len=512).customize(max_occurs=1, min_occurs=0) AddressCode = String(max_len=36).customize(max_occurs=1, min_occurs=0) Agent = String(max_len=255).customize(max_occurs=1, min_occurs=0) AgentCode = Integer.customize(max_occurs=1, min_occurs=0) Behalf = String(max_len=512).customize(max_occurs=1, min_occurs=0) man = Man Type = Integer.customize(max_occurs=1, min_occurs=0)
class DetectionService(ServiceBase): @rpc(Unicode, Unicode, Integer(values=(1, 2)), _returns=ApiResponse) def analysis(self, infrared_image, visible_image, task_type): job_id = uuid.uuid4().hex func = DETECTION_TASK_TYPE_MAPPING[task_type] job = scheduler.add_job( func=func, args=(infrared_image, visible_image), id=job_id, ) return ApiResponse( error=0, message='Succeed', data={'job_id': job.id}, ) @rpc(Unicode, _returns=ApiResponse) def query(self, job_id): db_session = Session() try: job_result = db_session.query(JobResult).filter( JobResult.job_id == job_id).one() except NoResultFound: return ApiResponse(error=1, message='No job found.') finally: Session.remove() return ApiResponse( error=0, message='Succeed', data={ 'job_id': job_result.job_id, 'status': job_result.status, 'result': json.loads(job_result.result) }, )
class DetectionService(ServiceBase): @rpc(ImageUri, Integer(values=(1, 2)), _returns=ApiResponse) def analysis(self, image_url, task_type): job_id = uuid.uuid4().hex func = DETECTION_TASK_TYPE_MAPPING[task_type] job: Job = task_queue.enqueue( func, args=(image_url, ), job_id=job_id, # Result will never expire, clean up result key manually result_ttl=-1, ) return ApiResponse( error=0, message='Succeed', data={ 'job_id': job.id, }, ) @rpc(Unicode, _returns=ApiResponse) def query(self, job_id): job: Job = task_queue.fetch_job(job_id) if not job: return ApiResponse(error=1, message='No job found.') return ApiResponse( error=0, message='Succeed', data={ 'job_id': job.id, 'status': job.get_status(), 'result': job.result, }, )
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)
def test_large_integer(self): i = 128375873458473 integer = Integer() element = etree.Element('test') XmlDocument().to_parent(None, Integer, i, element, ns_test) element = element[0] self.assertEquals(element.text, '128375873458473') value = XmlDocument().from_element(None, integer, element) self.assertEquals(value, i)
def test_integer(self): i = 12 integer = Integer() element = etree.Element('test') XmlDocument().to_parent(None, Integer, i, element, ns_test) element = element[0] self.assertEqual(element.text, '12') value = XmlDocument().from_element(None, integer, element) self.assertEqual(value, i)
class ProductDescription(ComplexModel): __namespace__ = '' NameRus = String(max_len=255).customize(max_occurs=1, min_occurs=0) NameEng = String(max_len=255).customize(max_occurs=1, min_occurs=0) NameBotanic = String(max_len=255).customize(max_occurs=1, min_occurs=0) Code = Integer.customize(max_occurs=1, min_occurs=0) HS = String(max_len=512).customize(max_occurs=1, min_occurs=0) # we have to find datatype of HSCode HSCode = String(max_len=100).customize(max_occurs=1, min_occurs=0) OriginPlace = String(max_len=512).customize(max_occurs=1, min_occurs=0) OriginCountry = String(max_len=100).customize(max_occurs=1, min_occurs=0) OriginCountryCode = String(max_len=2).customize(max_occurs=1, min_occurs=0) Manufacturer = String(max_len=255).customize(max_occurs=1, min_occurs=0) ManufacturerCode = Integer.customize(max_occurs=1, min_occurs=0) Quantity = Decimal(max_len=3).customize(max_occurs=1, min_occurs=0) QuantityUnit = String(max_len=100).customize(max_occurs=1, min_occurs=0) QuantityUnitCode = String(max_len=3).customize(max_occurs=1, min_occurs=0) QuantityGross = Decimal(max_len=3).customize(max_occurs=1, min_occurs=0) QuantityGrossUnit = String(max_len=100).customize(max_occurs=1, min_occurs=0) QuantityGrossUnitCode = String(max_len=3).customize(max_occurs=1, min_occurs=0) QuantitySpecial = Decimal(max_len=3).customize(max_occurs=1, min_occurs=0) QuantitySpecialUnit = String(max_len=100).customize(max_occurs=1, min_occurs=0) QuantitySpecialUnitCode = String(max_len=3).customize(max_occurs=1, min_occurs=0) Packages = Integer.customize(max_occurs=1, min_occurs=0) PackagesUnit = String(max_len=100).customize(max_occurs=1, min_occurs=0) PackagesUnitCode = String(max_len=3).customize(max_occurs=1, min_occurs=0) # we have to find datatypes of PackagesType and PackagesTypeCode PackagesType = String(max_len=100).customize(max_occurs=1, min_occurs=0) PackagesTypeCode = String(max_len=100).customize(max_occurs=1, min_occurs=0) PackagesDescription = String(max_len=512).customize(max_occurs=1, min_occurs=0) Volume = Decimal(max_len=3).customize(max_occurs=1, min_occurs=0) VolumeUnit = String(max_len=100).customize(max_occurs=1, min_occurs=0) VolumeUnitCode = String(max_len=3).customize(max_occurs=1, min_occurs=0) Marking = String(max_len=100).customize(max_occurs=1, min_occurs=0) AdditionalInfo = String(max_len=2000).customize(max_occurs=1, min_occurs=0)
class transport(ComplexModel): __namespace__ = '' DeclaredType = String(max_len=100).customize(max_occurs=1, min_occurs=0) DeclaredTypeCode = Integer.customize(max_occurs=1, min_occurs=0) Number = String.customize(max_occurs=1, min_occurs=0) @staticmethod def generate(): return { 'DeclaredType': 'hello', 'DeclaredTypeCode': 0, 'Number': 'hello', }
class Certificate(ComplexModel): __namespace__ = '' ID = Integer.customize(max_occurs=1, min_occurs=0) GUID = Unicode(128, pattern='[^@]+@[^@]+') SendDateTime = DateTime.customize(max_occurs=1, min_occurs=0) Number = String(max_len=100).customize(max_occurs=1, min_occurs=0) Date = DateTime.customize(max_occurs=1, min_occurs=0) Blanc = String(max_len=100).customize(max_occurs=1, min_occurs=0) DepartureCountry = String(max_len=100).customize(max_occurs=1, min_occurs=0) DepartureCountryCode = String(max_len=2).customize(max_occurs=1, min_occurs=0) DestinationCountry = String(max_len=100).customize(max_occurs=1, min_occurs=0) DestinationCountryCode = String(max_len=2).customize(max_occurs=1, min_occurs=0) EntryCheckpoint = String(max_len=255).customize(max_occurs=1, min_occurs=0) EntryCheckpointCode = Integer.customize(max_occurs=1, min_occurs=0) consignor = Consignor consignee = Consignee transport = Transport disinfection = Disinfection productdescription = ProductDescription GeneralMarking = String(max_len=512).customize(max_occurs=1, min_occurs=0) GeneralQuarantineCondition = String(max_len=512).customize(max_occurs=1, min_occurs=0) GeneralBaseDocument = String(max_len=512).customize(max_occurs=1, min_occurs=0) GeneralAdditionalDeclaration = String(max_len=512).customize(max_occurs=1, min_occurs=0) GeneralMandatoryActions = String(max_len=512).customize(max_occurs=1, min_occurs=0) AdditionalInfo = String(max_len=2000).customize(max_occurs=1, min_occurs=0) Inspector = String(max_len=255).customize(max_occurs=1, min_occurs=0) AnnexDoc = String(max_len=100000).customize(max_occurs=1, min_occurs=0) AnnexText = String(max_len=100000).customize(max_occurs=1, min_occurs=0) PDF = ByteArray.customize(max_occurs=1, min_occurs=0)
class Header(ComplexModel): __namespace__ = NAMESPACE _type_info = [ ('Message_Type', StringNonNillable), ('Company_ID', StringNonNillable), ('Version', StringNonNillable), ('Source', StringNonNillable), ('Destination', StringNonNillable), ('Action_Type', StringNonNillable(values=['read', 'write'])), ('Sequence_Number', Integer(nillable=False)), ('Batch_ID', StringNonNillable), ('Reference_ID', StringNonNillable), ('Msg_Locale', StringNonNillable), ('Msg_Time_Zone', StringNonNillable), ('Internal_Date_Time_Stamp', StringNonNillable(min_occurs=1)), ]
class request91(ComplexModel): __namespace__ = '' GUID = Unicode(128, pattern='[^@]+@[^@]+') SendDateTime = DateTime.customize(max_occurs=1, min_occurs=0) Certificate = certificate Status = String(max_len=100).customize(max_occurs=1, min_occurs=0) StatusCode = Integer.customize(max_occurs=1, min_occurs=0) Inspector = String(max_len=255).customize(max_occurs=1, min_occurs=0) @staticmethod def generate(): return { # 'GUID': 'SendDateTime': 'hello', 'certificate': Certificate, 'Status': 'Выдан', 'StatusCode': 'I dnt find', 'Inspector': 'hello', }
class SomeObject(ComplexModel): s = Array(Integer(min_occurs=1))
class NameOfMonthService(ServiceBase): @rpc(Integer(ge=1, le=12), _returns=Unicode) def get_name_of_month(ctx, month): return datetime(2000, month, 1).strftime("%B")
class CM(ComplexModel): _type_info = [('a', Integer), ('c', Integer(order=0))]
class MelwinService(ServiceBase): __in_header__ = Security @rpc(Unicode, Integer, _returns=Iterable(Unicode)) def say_hello(ctx, name, numbers): """ Say hello! <b>Hello hello</b> @param name the name to say hello to @param numbers the number of times @return the completed array """ print('HEADERS') a = [txt.strip() for txt in ctx.in_header_doc[0].itertext()] print(a) print('Auth result: %s' % authenticate(ctx)) print('/HEADERS') # root = etree.fromstring(ctx.in_header_doc) # etree.tostring(root) return u'Hello, %s' % name @srpc(Unicode, Unicode, Integer, _returns=Elefun) def elefun(vUserId, vPassword, vMemberNo): """ Valid members of Modellfly @param vUserId Username for login @param vPassword Password for Username @param vMemberNo MelwinId or PersonId (NIF) for member to validate @return """ try: if vUserId == api.ELEFUN_USERNAME and vPassword == api.ELEFUN_PASSWORD: member_resp = requests.get( '%s/members?where={"activities.PathName": "Luftsport/Modellfly", "$or": [{"MelwinId": %s}, {"Id": %s}]}&max_results=50000' % (get_api_url(), vMemberNo, vMemberNo), headers=get_api_headers()) if member_resp.status_code == 200: resp = member_resp.json() if '_items' in resp and len(resp['_items']) == 1: parents = [] for a in resp['_items'][0]['activities']: if a['PathName'] == "Luftsport/Modellfly": for club in a["ParentOrgIds"]: parents.append(club) parents = list(set(parents)) for p in resp['_items'][0]['clubs_payment']: if p['PaymentStatus'] == 1 and datetime.datetime.now( ).month not in [11, 12, 1]: continue if p['ClubId'] in parents and p[ 'PaymentStatus'] in [ 1, 4 ]: # 4 betalt, 1 til forfall return { 'vReturn': True, 'vName': resp['_items'][0]['FullName'] } except: pass return {'vReturn': False, 'vName': ''} @srpc(Unicode, Unicode, Integer, Array(Integer()), Integer, Boolean, _returns=Iterable(Person)) def get_members(ApiKey, ClubId, MelwinId=0, PaymentStatus=[], IsActive=0, MergedTo=False): """ Members by KL number and if MelwinId or not @param ApiKey secret API key String, mandatory @param ClubId the club KL number String, mandatory @param MelwinId get users with (1), without (-1) or all (0) MelwinId, defaults to 0 @param PaymentStatus array of integers to include, defaults to all @param IsActive integer 1=True, -1=False, 0=all @param MergedTo boolean if True include merged else do not include _merged_to entries @return """ if ApiKey == api.key_melwin: limit_date = True club_id = get_club_id(ClubId) melwin_query = '' if IsActive == 0 or IsActive is None: melwin_query = '"$or":[{"clubs_active": {"$in": [%s]}},{"clubs_inactive": {"$in": [%s]}}]' % ( club_id, club_id) elif IsActive < 0: melwin_query = '"clubs_inactive": {"$in": [%s]}' % (club_id) elif IsActive > 0: melwin_query = '"clubs_active": {"$in": [%s]}' % (club_id) if limit_date is True: melwin_query = '%s, "_updated": {"$gt": "%sZ"}' % ( melwin_query, (datetime.datetime.utcnow() - datetime.timedelta(hours=18)).isoformat()) if MelwinId is None: pass elif MelwinId < 0: melwin_query = '%s,"$or": [{"MelwinId": null}, {"MelwinId": {"$exists": false}}]' % melwin_query elif MelwinId > 0: melwin_query = '%s,"MelwinId":{"$ne":null}' % melwin_query else: pass if MergedTo is False: melwin_query = '%s,"_merged_to":{"$exists": false}' % melwin_query if PaymentStatus is not None and isinstance( PaymentStatus, list) and len(PaymentStatus) > 0: melwin_query = '%s,\ "clubs_payment": {"$elemMatch": {"ClubId": %s, "PaymentStatus": {"$in": [%s]} } } ' % ( melwin_query, club_id, ','.join( str(x) for x in PaymentStatus)) # "$and": [{"clubs_payment": {"$elemMatch": {"ClubId": %s}}}, {"clubs_payment": {"$elemMatch": {"PaymentStatus": {"$in": [%s]}}}}]' % (melwin_query, club_id, ','.join(str(x) for x in PaymentStatus)) # $and: [{"clubs_payment": {"$elemMatch": {"ClubId": %s}}}, {"clubs_payment": {"$elemMatch": {"PaymentStatus": {"$in": [%s]}}}}]' % (melwin_query, club_id, ','.join(str(x) for x in PaymentStatus)) # old melwin_query = '%s,"$and": [{"clubs_payment.ClubId": %s}, {"clubs_payment.PaymentStatus": {"$in": [%s]}}]' % \ # Corrected example: # {"$or": [{"clubs_active": {"$in": [22976]}}, {"clubs_inactive": {"$in": [22976]}}], # "$and": [{"clubs_payment.ClubId": 22976}, {"clubs_payment.PaymentStatus": {"$in": [0]}}]} if club_id > 0: member_resp = requests.get( '%s/members/?where={%s}&max_results=50000' % (get_api_url(), melwin_query), headers=get_api_headers()) if member_resp.status_code != 200: return [{}] else: # print(member_resp.json()['_items'][0]) m = member_resp.json()['_items'] for key, value in enumerate( m): # strptime(modified, '%Y-%m-%dT%H:%M:%S.000Z') try: m[key]['BirthDate'] = dateutil.parser.parse( m[key]['BirthDate']) except: m[key].pop('BirthDate', None) try: m[key]['Updated'] = dateutil.parser.parse( m[key]['_updated']) except: m[key].pop('Updated', None) try: m[key]['Created'] = dateutil.parser.parse( m[key]['_created']) except: m[key].pop('Created', None) m[key]['MongoId'] = m[key]['_id'] # Assign new virtual m[key]['ClubId'] = club_id m[key]['Gren'] = [] # Activities!!! if 'activities' in m[key]: for a in m[key]['activities']: # Only Grener OrgId == 14 if int(a['ClubId']) == int(club_id) and int( a['OrgTypeId']) == 14: m[key]['Gren'].append({ 'ClubId': a['ClubId'], 'ShortName': a['ShortName'], 'OrgId': a['OrgId'], 'OrgTypeId': a['OrgTypeId'], 'OrgTypeName': a['OrgTypeName'], 'IsPassive': a['IsPassive'], 'FunctionId': a['FunctionId'] }) # IsActive = Boolean # ClubId = Integer # PaymentStatus = Integer if club_id in m[key].get('clubs_active', []): m[key]['IsActive'] = True elif club_id in m[key].get('clubs_inactive', []): m[key]['IsActive'] = False if 'clubs_payment' in m[key]: for k, v in enumerate(m[key].get( 'clubs_payment', [])): if int(v['ClubId']) == int(club_id): m[key]['PaymentStatus'] = v[ 'PaymentStatus'] break # print(m[key]) # exit(0) return m else: return {'status': 'ERR', 'status_code': 404} else: return {'status': 'ERR', 'status_code': 403} @srpc(Unicode, Unicode, Integer, _returns=MelwinUpdated) def set_melwin_id(ApiKey, PersonId, MelwinId): """ Set MelwinId for Person @Param ApiKey @param PersonId @param MelwinId @return """ if ApiKey == api.key_melwin: user_resp = requests.get('%s/members/%s' % (get_api_url(), PersonId), headers=get_api_headers()) if user_resp.status_code == 200: user = user_resp.json() user_header = get_api_headers() user_header.update({'If-Match': user['_etag']}) update_resp = requests.patch('%s/members/%s' % (get_api_url(), user['_id']), json={'MelwinId': MelwinId}, headers=user_header) # print(update_resp.text) # print(update_resp.status_code) if update_resp.status_code == 200: return { 'status': 'OK', 'status_code': update_resp.status_code, 'PersonId': PersonId, 'MelwinId': MelwinId } else: return { 'status': 'ERR', 'status_code': user_resp.status_code, 'PersonId': PersonId, 'MelwinId': MelwinId } else: return { 'status': 'ERR', 'status_code': user_resp.status_code, 'PersonId': PersonId, 'MelwinId': MelwinId } else: return {'status': 'ERR', 'status_code': 403} @srpc(Unicode, Integer, Unicode, _returns=Iterable(Org)) def get_grener(ApiKey, ClubId, Direction='up'): """ Set MelwinId for Person @Param ApiKey Unicode mandatory @param ClubId Integer mandatory @param Direction up or down, default 'up', 'up'|'down' @return """ if ApiKey == api.key_melwin: if Direction in ['up', 'down']: if Direction == 'up': Direction = 'down' else: Direction = 'up' # , "OrgType": "Gruppe for særidrett" url = '%s/orgs?where={"_%s": {"$in": [%s]}}&max_results=50000' % ( get_api_url(), Direction, ClubId) resp = requests.get(url, headers=get_api_headers()) if resp.status_code == 200: ret = resp.json()['_items'] r = [] for k, v in enumerate(ret): if '_links' in v: del ret[k]['_links'] # from pprint import pprint # pprint(ret) return ret else: return { 'status': 'ERR', 'status_code': resp.status_code, 'Message': resp.text } else: return {'status': 'ERR', 'status_code': 422} else: return {'status': 'ERR', 'status_code': 403} @srpc(Unicode, Unicode, Unicode, Unicode, _returns=LoginResponse) def login_simple(ApiKey, Username, Password, Realm='mi.nif.no'): """ Login via NIF Buypass @Param ApiKey Unicode mandatory @param Username Integer mandatory @param Password @return """ person_id = None melwin_id = None pb = passbuy.passbuy(realm=Realm, username=Username, password=Password) try: fed_cookie = pb.login() except AttributeError: return { 'Message': 'Wrong password or user', 'Status': 'ERR', 'StatusCode': 401 } except Exception as e: return { 'Message': 'Wrong password or user', 'Status': 'ERR', 'StatusCode': 401 } if fed_cookie: if isinstance(fed_cookie, requests.cookies.RequestsCookieJar): person_id = pb.get_id_from_profile() melwin_id = get_melwin_id(person_id) return { 'Message': 'Success', 'Status': 'OK', 'StatusCode': 200, 'MelwinId': melwin_id, 'PersonId': person_id } else: return { 'Message': 'Success', 'Status': 'OK', 'StatusCode': 200, 'MelwinId': None, 'PersonId': None } @rpc(Unicode, Unicode, _returns=LoginResponse) def login(ctx, ApiKey, Realm='mi.nif.no'): """ Login via NIF Buypass WSSE header @Param ApiKey Unicode mandatory @return """ Username, Password = get_credentials(ctx) pb = passbuy.passbuy(realm=Realm, username=Username, password=Password) try: fed_cookie = pb.login() except AttributeError: return { 'Message': 'Wrong password or user', 'Status': 'ERR', 'StatusCode': 401 } except Exception as e: return { 'Message': 'Wrong password or user', 'Status': 'ERR', 'StatusCode': 401 } if fed_cookie: if isinstance(fed_cookie, requests.cookies.RequestsCookieJar): return { 'Message': 'Success', 'Status': 'OK', 'StatusCode': 200 }
class Category(ComplexModel): id = Integer(min_occurs=1, max_occurs=1, nillable=False) children = Array(SelfReference)
class Category(ComplexModel): id = XmlData(Integer(min_occurs=1, max_occurs=1, nillable=False)) children = Array(Unicode)
class SomeClass(ComplexModel): a = XmlAttribute(Integer(ge=4))
class Category(ComplexModel): id = Integer(min_occurs=1, max_occurs=1, nillable=False)
class X(ComplexModel): __namespace__ = 'tns' x = Integer(nillable=True, max_occurs='unbounded')
class EncExtractXs(ComplexModel): __min_occurs__ = 1 __max_occurs__ = 1 mbr_idn = Integer(nillable=False, min_occurs=1, max_occurs=1, max_len=18) enc_idn = Integer(nillable=False, min_occurs=1, max_occurs=1, max_len=18) hist_idn = Integer(nillable=False, min_occurs=1, max_occurs=1, max_len=18)
class C(ComplexModel): i = Integer(voa=True)
class Transport(ComplexModel): __namespace__ = '' DeclaredType = String(max_len=100).customize(max_occurs=1, min_occurs=0) DeclaredTypeCode = Integer.customize(max_occurs=1, min_occurs=0) Number = String.customize(max_occurs=1, min_occurs=0)
'voegBesluitToe', }) Gebruiker = Mandatory( Unicode.customize(__namespace__=STUF_XML_NS, type_name='Gebruiker', max_len=100)) IndicatorOvername = Mandatory( Unicode.customize(__namespace__=STUF_XML_NS, type_name='IndicatorOvername', values={'I', 'V'})) MaximumAantal = Integer.customize( __namespace__=STUF_XML_NS, type_name='MaximumAantal', default=settings.ZAAKMAGAZIJN_DEFAULT_MAX_NR_RESULTS, total_digits=8) Melding = Mandatory( Unicode.customize(__namespace__=STUF_XML_NS, type_name='Melding', max_len=250)) Mutatiesoort = Functie.customize( __namespace__=STUF_XML_NS, type_name='Mutatiesoort', values={'T', 'W', 'V', 'E', 'I', 'R', 'S', 'O'}) Omschrijving = Mandatory( Unicode.customize(__namespace__=STUF_XML_NS,
class productDescription(ComplexModel): __namespace__ = '' NameRus = String(max_len=255).customize(max_occurs=1, min_occurs=0) NameEng = String(max_len=255).customize(max_occurs=1, min_occurs=0) NameBotanic = String(max_len=255).customize(max_occurs=1, min_occurs=0) Code = Integer.customize(max_occurs=1, min_occurs=0) HS = String(max_len=512).customize(max_occurs=1, min_occurs=0) # we have to find datatype of HSCode HSCode = String(max_len=100).customize(max_occurs=1, min_occurs=0) OriginPlace = String(max_len=512).customize(max_occurs=1, min_occurs=0) OriginCountry = String(max_len=100).customize(max_occurs=1, min_occurs=0) OriginCountryCode = String(max_len=2).customize(max_occurs=1, min_occurs=0) Manufacturer = String(max_len=255).customize(max_occurs=1, min_occurs=0) ManufacturerCode = Integer.customize(max_occurs=1, min_occurs=0) Quantity = Decimal(max_len=3).customize(max_occurs=1, min_occurs=0) QuantityUnit = String(max_len=100).customize(max_occurs=1, min_occurs=0) QuantityUnitCode = String(max_len=3).customize(max_occurs=1, min_occurs=0) QuantityGross = Decimal(max_len=3).customize(max_occurs=1, min_occurs=0) QuantityGrossUnit = String(max_len=100).customize(max_occurs=1, min_occurs=0) QuantityGrossUnitCode = String(max_len=3).customize(max_occurs=1, min_occurs=0) QuantitySpecial = Decimal(max_len=3).customize(max_occurs=1, min_occurs=0) QuantitySpecialUnit = String(max_len=100).customize(max_occurs=1, min_occurs=0) QuantitySpecialUnitCode = String(max_len=3).customize(max_occurs=1, min_occurs=0) Packages = Integer.customize(max_occurs=1, min_occurs=0) PackagesUnit = String(max_len=100).customize(max_occurs=1, min_occurs=0) PackagesUnitCode = String(max_len=3).customize(max_occurs=1, min_occurs=0) # we have to find datatypes of PackagesType and PackagesTypeCode PackagesType = String(max_len=100).customize(max_occurs=1, min_occurs=0) PackagesTypeCode = String(max_len=100).customize(max_occurs=1, min_occurs=0) PackagesDescription = String(max_len=512).customize(max_occurs=1, min_occurs=0) Volume = Decimal(max_len=3).customize(max_occurs=1, min_occurs=0) VolumeUnit = String(max_len=100).customize(max_occurs=1, min_occurs=0) VolumeUnitCode = String(max_len=3).customize(max_occurs=1, min_occurs=0) Marking = String(max_len=100).customize(max_occurs=1, min_occurs=0) AdditionalInfo = String(max_len=2000).customize(max_occurs=1, min_occurs=0) @staticmethod def generate(): return { 'NameRus': 'hello', 'NameEng': 'hello', 'NameBotanic': 'hello', 'Code': 'hello', 'HS': 'hi', 'HSCode': 'hello', 'OriginPlace': 'Tashkent', 'OriginCountry': 'hello', 'OriginCountryCode': 'hello', 'Manufacturer': 'hi', 'ManufacturerCode': 0, 'Quantity': 'hello', 'QuantityUnit': 'hello', 'QuantityUnitCode': 90, 'QuantityGross': 'hello', 'PackagesUnit': 'hello', 'PackageUnitCode': 'hello', 'PackagesType': 'hi', 'PackagesTypeCode': 0, 'PackagesDescription': 'hi', 'Volume': 0, 'VolumeUnit': 'hi', 'VolumeUnitCode': 0, 'Marking': 'hi', 'AdditionalInfo': 'hi', }
class certificate(ComplexModel): __namespace__ = '' ID = Integer.customize(max_occurs=1, min_occurs=0) GUID = Unicode(128, pattern='[^@]+@[^@]+') SendDateTime = DateTime.customize(max_occurs=1, min_occurs=0) Number = String(max_len=100).customize(max_occurs=1, min_occurs=0) Date = DateTime.customize(max_occurs=1, min_occurs=0) Blanc = String(max_len=100).customize(max_occurs=1, min_occurs=0) DepartureCountry = String(max_len=100).customize(max_occurs=1, min_occurs=0) DepartureCountryCode = String(max_len=2).customize(max_occurs=1, min_occurs=0) DestinationCountry = String(max_len=100).customize(max_occurs=1, min_occurs=0) DestinationCountryCode = String(max_len=2).customize(max_occurs=1, min_occurs=0) EntryCheckpoint = String(max_len=255).customize(max_occurs=1, min_occurs=0) EntryCheckpointCode = Integer.customize(max_occurs=1, min_occurs=0) Consignor = consignor Consignee = consignee Transport = transport Disinfection = disinfection Productdescription = productDescription GeneralMarking = String(max_len=512).customize(max_occurs=1, min_occurs=0) GeneralQuarantineCondition = String(max_len=512).customize(max_occurs=1, min_occurs=0) GeneralBaseDocument = String(max_len=512).customize(max_occurs=1, min_occurs=0) GeneralAdditionalDeclaration = String(max_len=512).customize(max_occurs=1, min_occurs=0) GeneralMandatoryActions = String(max_len=512).customize(max_occurs=1, min_occurs=0) AdditionalInfo = String(max_len=2000).customize(max_occurs=1, min_occurs=0) Inspector = String(max_len=255).customize(max_occurs=1, min_occurs=0) AnnexDoc = String(max_len=100000).customize(max_occurs=1, min_occurs=0) AnnexText = String(max_len=100000).customize(max_occurs=1, min_occurs=0) # PDF = ByteArray.customize(max_occurs=1, min_occurs=0) # 'Blanc'omize(max_occurs=1, min_occurs=0) # PDF = ByteArray.customize(max_occurs=1, min_occurs=0) @staticmethod def generate(): return { 'ID': 'hello', # Guid 'SendDateTime': 'hello', 'Number': 'hello', 'Date': 'hello', 'Blanc': 'hi', 'DepartureCountry': 'hello', 'DepartureCountryCode': 'hello', 'DestinationCountry': 'hello', 'DestinationCountryCode': 'hello', 'consignor': Consignor, 'consignee': Consignee, 'transport': Transport, 'disinfection': Disinfection, 'productDescription': ProductDescription, 'GeneralMarking': 'hello', 'GeneralQuarantineCondition': 'Карантинных объектов не обнаружено', 'GeneralBaseDocument': 'hi', 'GeneralAdditionalDeclaration': 'hello', 'GeneralMandatoryActions': 'hello', 'AdditionalInfo': 'hello', 'Inspector': 'hello', }