예제 #1
0
def serialize_form_result(stream, fr):
    s_long(stream, 1)  # version
    if fr:
        s_unicode(stream, fr.type)
        WIDGET_RESULT_MAPPING[fr.type].model_serialize(stream, fr.result)
    else:
        s_unicode(stream, "")
예제 #2
0
def serialize_sign(stream, w):
    s_long(stream, 4)  # version
    s_unicode(stream, w.payload)
    s_unicode(stream, w.caption)
    s_unicode(stream, w.algorithm)
    s_unicode(stream, w.key_name)
    s_unicode(stream, w.index)
예제 #3
0
def _serialize_base_payment_method(stream, c):
    # type: (object, BasePaymentMethod) -> None
    s_long(stream, 2)  # version
    s_bool(stream, c is not None)
    if c:
        s_unicode(stream, c.currency)
        s_long(stream, c.amount)
        s_long(stream, c.precision)
예제 #4
0
def _serialize_shift(stream, s):
    s_unicode(stream, s.name)
    s_long(stream, s.start)
    s_long(stream, s.end)
    s_long(stream, s.leap_time)
    s_long(stream, s.capacity)
    s_long(stream, s.threshold)
    s_long(stream, s.max_group_size)
    s_long_list(stream, s.days)
def _serialize_member_status(stream, r):
    s_long(stream, r.status)
    s_long(stream, r.received_timestamp)
    s_long(stream, r.acked_timestamp)
    s_long(stream, r.index)
    s_bool(stream, r.dismissed)
    s_long(stream, r.button_index)
    s_unicode(stream, r.custom_reply)
    serialize_form_result(stream, r.form_result)
    s_unicode(stream, r.ack_device)
예제 #6
0
def _serialize_friend_detail(stream, fd):
    s_unicode(stream, fd.email)
    s_unicode(stream, fd.name)
    s_long(stream, fd.avatarId)
    s_bool(stream, fd.shareLocation)
    s_bool(stream, fd.sharesLocation)
    s_bool(stream, fd.sharesContacts)
    s_long(stream, fd.type)
    s_bool(stream, fd.hasUserData)
    s_long(stream, fd.relationVersion)
예제 #7
0
def serialize_date_select(stream, w):
    s_long(stream, 1)  # version
    s_bool(stream, w.has_date)
    s_bool(stream, w.has_max_date)
    s_bool(stream, w.has_min_date)
    s_long(stream, w.date)
    s_long(stream, w.max_date)
    s_long(stream, w.min_date)
    s_long(stream, w.minute_interval)
    s_unicode(stream, w.mode)
    s_unicode(stream, w.unit)
예제 #8
0
def serialize_solution_user(stream, u):
    s_long(stream, 3)  # version
    if u is None:
        s_bool(stream, False)
    else:
        s_bool(stream, True)
        s_unicode(stream, u.name)
        s_unicode(stream, u.email)
        s_unicode(stream, u.avatar_url)
        s_unicode(stream, u.language)
        s_unicode(stream, u.app_id)
def _serialize_button(stream, b):
    s_unicode(stream, b.id)
    s_long(stream, b.index)
    s_unicode(stream, b.caption)
    s_unicode(stream, b.action)
    s_long(stream, b.ui_flags)
    s_unicode(stream, b.color)
예제 #10
0
def _serialize_category(stream, c):
    s_unicode(stream, c.name)
    _serialize_item_list(stream, c.items)
    s_long(stream, c.index)
    s_unicode(stream, c.predescription)
    s_unicode(stream, c.postdescription)
    s_unicode(stream, c.id)
예제 #11
0
def _serialize_item(stream, item):
    s_unicode(stream, item.name)
    s_long(stream, item.price)
    s_unicode(stream, item.description)
    s_long(stream, item.visible_in)
    s_long(stream, item.unit)
    s_long(stream, item.step)
    s_long(stream, -1 if item.image_id in (None, MISSING) else item.image_id)
    s_unicode(stream, None if item.qr_url is MISSING else item.qr_url)
    s_bool(stream,
           item.price > 0 if item.has_price is MISSING else item.has_price)
    s_unicode(stream, item.id)
예제 #12
0
def serialize_mydigipass_widget_result(stream, result):
    s_long(stream, 2)  # version
    if result.eid_profile is None:
        s_bool(stream, False)
    else:
        s_bool(stream, True)
        serialize_mydigipass_eid_profile(stream, result.eid_profile)

    if result.eid_address is None:
        s_bool(stream, False)
    else:
        s_bool(stream, True)
        serialize_mydigipass_eid_address(stream, result.eid_address)

    s_unicode(stream, result.eid_photo)
    s_unicode(stream, result.email)
    s_unicode(stream, result.phone)

    if result.profile is None:
        s_bool(stream, False)
    else:
        s_bool(stream, True)
        serialize_mydigipass_profile(stream, result.profile)

    if result.address is None:
        s_bool(stream, False)
    else:
        s_bool(stream, True)
        serialize_mydigipass_address(stream, result.address)
예제 #13
0
def _serialize_attachment(stream, a):
    s_long(stream, a.index)
    s_unicode(stream, a.content_type)
    s_unicode(stream, a.download_url)
    s_long(stream, a.size)
    s_unicode(stream, a.name)
    _s_thumbnail_url(stream, a.thumbnail)
예제 #14
0
def _serialize_payment_method(stream, c):
    s_long(stream, 2)  # version
    s_unicode(stream, c.provider_id)
    s_unicode(stream, c.currency)
    s_long(stream, c.amount)
    s_long(stream, c.precision)
    s_bool(stream, c.calculate_amount)
    s_unicode(stream, c.target)
예제 #15
0
def serialize_pay(stream, w):
    s_long(stream, 2)
    _serialize_payment_method_list(stream, w.methods)
    s_unicode(stream, w.memo)
    s_unicode(stream, w.target)
    s_bool(stream, w.auto_submit)
    s_bool(stream, w.test_mode)
    s_unicode(stream, w.embedded_app_id)
예제 #16
0
def serialize_public_key(stream, pk):
    s_unicode(stream, pk.algorithm)
    s_unicode(stream, pk.name)
    s_unicode(stream, pk.index)
    s_unicode(stream, pk.public_key)
예제 #17
0
def _s_house_to(stream, to):
    s_long(stream, to.number)
    s_unicode(stream, to.bus)
예제 #18
0
def _s_street_to(stream, to):
    s_long(stream, to.number)
    s_unicode(stream, to.name)
예제 #19
0
def _s_activity_to(stream, to):
    s_long(stream, to.number)
    s_unicode(stream, to.name)
예제 #20
0
def _s_thumbnail_url(stream, thumbnail):
    s_bool(stream, thumbnail is not None)
    if thumbnail:
        s_unicode(stream, thumbnail.url)
        s_long(stream, thumbnail.height)
        s_long(stream, thumbnail.width)
예제 #21
0
def serialize_advanced_order(stream, w):
    s_long(stream, 1)  # version
    s_unicode(stream, w.currency)
    s_long(stream, w.leap_time)
    _serialize_advanced_order_category_list(stream, w.categories)
예제 #22
0
def _serialize_news_feed(stream, f):
    s_unicode(stream, f.app_id)
    s_unicode(stream, f.name)
예제 #23
0
def _serialize_news_statistic_per_app(stream, value):
    s_long(stream, 1)  # version
    s_long(stream, len(value))
    for app_id, stats in value.iteritems():
        s_unicode(stream, app_id)
        _serialize_news_item_statistics(stream, stats)
예제 #24
0
def _serialize_mobile_detail(stream, md):
    s_unicode(stream, md.account)
    s_long(stream, md.type_)
    s_unicode(stream, md.pushId)
    s_unicode(stream, md.app_id)
예제 #25
0
def serialize_oauth(stream, w):
    s_long(stream, 1)
    s_unicode(stream, w.url)
    s_unicode(stream, w.success_message)
    s_unicode(stream, w.caption)
예제 #26
0
def _serialize_advanced_order_category(stream, c):
    s_long(stream, 1)  # version
    s_unicode(stream, c.id)
    s_unicode(stream, c.name)
    _serialize_advanced_order_item_list(stream, c.items)
예제 #27
0
def serialize_form(stream, f):
    s_long(stream, 2)  # version
    s_unicode(stream, f.type)
    WIDGET_MAPPING[f.type].model_serialize(stream, f.widget)
    s_unicode(stream, f.javascript_validation)
예제 #28
0
def _serialize_payment_method(stream, c):
    s_long(stream, 1)  # version
    s_unicode(stream, c.provider_id)
    s_unicode(stream, c.currency)
    s_long(stream, c.amount)
    s_long(stream, c.precision)
예제 #29
0
def _serialize_news_sender(stream, sender):
    s_long(stream, 1)  # version
    s_unicode(stream, sender.email)
    s_unicode(stream, sender.name)
    s_long(stream, sender.avatar_id)
예제 #30
0
def _serialize_news_item(stream, news_item):
    version = 7
    s_long(stream, version)
    s_bool(stream, news_item.sticky)
    s_long(stream, news_item.sticky_until)
    _serialize_news_sender(stream, news_item.sender)
    s_unicode_list(stream, news_item.app_ids)
    s_long(stream, news_item.timestamp)
    s_unicode(stream, news_item.title)
    s_unicode(stream, news_item.message)
    s_unicode(stream, news_item.image_url)
    s_long(stream, news_item.type)
    s_unicode(stream, news_item.broadcast_type)
    s_long(stream, news_item.reach)
    s_bool(stream, news_item.rogered)
    s_unicode_list(stream, news_item.users_that_rogered)
    _serialize_news_buttons(stream, news_item.buttons)
    s_long(stream, news_item.id)
    s_unicode(stream, news_item.qr_code_content)
    s_unicode(stream, news_item.qr_code_caption)
    s_long(stream, news_item.version)  # this is different from the version above
    s_long(stream, news_item.flags)
    s_long(stream, news_item.scheduled_at)
    s_bool(stream, news_item.published)
    s_long(stream, news_item.action_count)
    s_long(stream, news_item.follow_count)
    _serialize_news_target_audience(stream, news_item.target_audience, version)
    s_long_list(stream, news_item.role_ids)
    s_unicode_list(stream, news_item.tags)
예제 #31
0
def _serialize_news_button(stream, b):
    s_unicode(stream, b.id)
    s_unicode(stream, b.caption)
    s_unicode(stream, b.action)
    s_unicode(stream, b.flow_params)
    s_long(stream, b.index)
예제 #32
0
def _serialize_message_embedded_app(stream, obj):
    # type: (StringIO.StringIO, MessageEmbeddedApp) -> None
    s_long(stream, 1)  # version
    s_unicode(stream, obj.context)
    s_unicode(stream, obj.description)
    s_unicode(stream, obj.id)
    s_unicode(stream, obj.image_url)
    s_unicode(stream, obj.result)
    s_unicode(stream, obj.title)
예제 #33
0
def serialize_unicode_widget_result(stream, result):
    s_long(stream, 1)  # version
    s_unicode(stream, result.value)
예제 #34
0
def serialize_advanced_order_widget_result(stream, result):
    s_long(stream, 1)  # version
    s_unicode(stream, result.currency)
    _serialize_advanced_order_category_list(stream, result.categories)
def _serialize_js_flow_definition(stream, jfd):
    s_unicode(stream, jfd.language)
    s_unicode(stream, jfd.hash_)
    s_unicode(stream, jfd.definition)
    s_unicode_list(stream, jfd.brandings)
    s_unicode_list(stream, jfd.attachments)
예제 #36
0
def serialize_mydigipass_eid_profile(stream, eid_profile):
    s_unicode(stream, eid_profile.first_name)
    s_unicode(stream, eid_profile.first_name_3)
    s_unicode(stream, eid_profile.last_name)
    s_unicode(stream, eid_profile.gender)
    s_unicode(stream, eid_profile.nationality)
    s_unicode(stream, eid_profile.date_of_birth)
    s_unicode(stream, eid_profile.location_of_birth)
    s_unicode(stream, eid_profile.noble_condition)
    s_unicode(stream, eid_profile.issuing_municipality)
    s_unicode(stream, eid_profile.card_number)
    s_unicode(stream, eid_profile.chip_number)
    s_unicode(stream, eid_profile.validity_begins_at)
    s_unicode(stream, eid_profile.validity_ends_at)
    s_unicode(stream, eid_profile.created_at)
예제 #37
0
def _serialize_auto_connected_service(stream, acs):
    s_unicode(stream, acs.service_identity_email)
    s_bool(stream, acs.removable)
    s_unicode_list(stream, acs.local)
    s_long_list(stream, acs.service_roles)
예제 #38
0
def _serialize_prospect_comment(stream, comment):
    s_long(stream, comment.index)
    s_unicode(stream, comment.text)
    s_unicode(stream, comment.creator)
    s_long(stream, comment.timestamp)