Coder Social home page Coder Social logo

An issue in pdu_encoding about smpp.pdu HOT 4 CLOSED

mozes avatar mozes commented on May 17, 2024
An issue in pdu_encoding

from smpp.pdu.

Comments (4)

theduderog avatar theduderog commented on May 17, 2024

Sorry if this is short. I'm on mobile right now. The type for dataCoding.scheme is intended to be an enum, not a string so the "if" test is checking enum equality using the enum module.

I hope this makes sense. If not, can u give sample code or test where it fails?

Sent from my iPhone

On Aug 28, 2012, at 12:19 PM, Fourat Zouari [email protected] wrote:

at line 427:

def _encodeSchemeDataAsInt(self, dataCoding):
    if dataCoding.scheme == pdu_types.DataCodingScheme.GSM_MESSAGE_CLASS:
        return self._encodeGsmMsgSchemeDataAsInt(dataCoding)
    raise ValueError("Unknown data coding scheme %s" % scheme)

first, scheme is not defined so this code would lead to an error; second the test at line 425:

    if dataCoding.scheme == pdu_types.DataCodingScheme.GSM_MESSAGE_CLASS:

should be fixed with casting values with str() to get the test working.

I didnt push a request with this correction because i didnt understand the difference between _encodeSchemeDataAsInt() method and this one (just on top of it):

def _encodeSchemeNameAsInt(self, dataCoding):
    schemeName = str(dataCoding.scheme)
    if schemeName not in constants.data_coding_scheme_name_map:
        raise ValueError("Unknown data_coding scheme name %s" % schemeName)
    return constants.data_coding_scheme_name_map[schemeName]

schemeName is casted before the "if" test the right way, so is there any reason why its implemented in a different way in _encodeSchemeDataAsInt()


Reply to this email directly or view it on GitHub.

from smpp.pdu.

farirat avatar farirat commented on May 17, 2024

Thank you, that make sense now.

What about the scheme variable at line 427 ?

from smpp.pdu.

theduderog avatar theduderog commented on May 17, 2024

That looks like a bug. Thanks.

from smpp.pdu.

theduderog avatar theduderog commented on May 17, 2024

Fixed. Thx.

from smpp.pdu.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.