GithubHelp home page GithubHelp logo

Case insensitive search about pyxero HOT 8 CLOSED

freakboy3742 avatar freakboy3742 commented on August 15, 2024 1
Case insensitive search

from pyxero.

Comments (8)

jacobg avatar jacobg commented on August 15, 2024

I hacked around it by doing this:

def _search_contact_name(xero, name):

    def _filter(*args, **kwargs):
        uri, params, method, body, headers, singleobject = xero.contacts._filter(*args, **kwargs)
        params = {'where': 'Name.ToLower()=="%s"' % name.lower()}
        return uri, params, method, body, headers, singleobject

    return xero.contacts._get_data(_filter)()

Perhaps there could be a official solution which offers direct access to the where parameter.

from pyxero.

jacobg avatar jacobg commented on August 15, 2024

I just saw there's a long standing pull request on this waiting to be accepted by the "powers that be":

#54

from pyxero.

aidanlister avatar aidanlister commented on August 15, 2024

I support a .raw() method if you want to provide a patch

from pyxero.

jacobg avatar jacobg commented on August 15, 2024

Would it look like this?

    def _raw(self, params, headers=None):
        uri = '/'.join([self.base_url, self.name])
        return uri, params, 'get', None, headers, False

from pyxero.

aidanlister avatar aidanlister commented on August 15, 2024

I would expect the userland syntax to be .filter(raw='xxx') or .rawfilter() maybe

from pyxero.

jacobg avatar jacobg commented on August 15, 2024

You mean to enhance the existing filter? What about just allowing a 'where' argument to be added to filter to override generating inside the filter from the other kwargs?

from pyxero.

aidanlister avatar aidanlister commented on August 15, 2024

Yeah I was thinking it could be used to supplement, I think if we add it to the end at least the behaviour is consistent and can be documented.

from pyxero.

aidanlister avatar aidanlister commented on August 15, 2024

This is now implemented via filter(raw='Contact.Name.ToLower().Contains("abc")')

from pyxero.

Related Issues (20)

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.