(request, backend_id=None)
return log
From an inbound request (representing an incoming message),
    create a message (log) object with the right fields populated.
From an inbound request (representing an incoming message),
    create a message (log) object with the right fields populated.
From an inbound request ( representing an incoming message ) create a message ( log ) object with the right fields populated .
def create_from_request(request, backend_id=None):
    """
    From an inbound request (representing an incoming message),
    create a message (log) object with the right fields populated.
    """
    sender = request.GET[InboundParams.SENDER]
    message = request.GET[InboundParams.MESSAGE]

    if len(sender) == 10:
        # add india country code
        sender = '91' + sender

    is_unicode = request.GET.get(InboundParams.DCS, "") == "8"
    if is_unicode:
        message = codecs.decode(codecs.decode(message, 'hex'), 'utf_16_be')

    backend_message_id = request.GET.get(InboundParams.MID, None)

    log = incoming(sender, message, SQLUnicelBackend.get_api_id(), backend_message_id=backend_message_id,
        backend_id=backend_id)

    return log
def create_from_request ( request , backend_id = None ) : sender = request . GET [ InboundParams . SENDER ] message = request . GET [ InboundParams . MESSAGE ] if len ( sender ) == 10 : # add india country code sender = '91' + sender is_unicode = request . GET . get ( InboundParams . DCS , "" ) == "8" if is_unicode : message = codecs . decode ( codecs . decode ( message , 'hex' ) , 'utf_16_be' ) backend_message_id = request . GET . get ( InboundParams . MID , None ) log = incoming ( sender , message , SQLUnicelBackend . get_api_id ( ) , backend_message_id = backend_message_id , backend_id = backend_id ) return log