sarumont / py-trello

Python API wrapper around Trello's API
BSD 3-Clause "New" or "Revised" License
945 stars 330 forks source link

Can't get projects with ampersand in them #294

Closed mwilton closed 4 years ago

mwilton commented 5 years ago

The code below should create project "This & That" (it does) and then find that project (it does not. filtered_projects returns empty). I've confirmed that this is a problem with any project that has an ampersand in it...they can be created via py-trello, they show up in Tableau, but they cannot be fetched via "get". I've also removed filters, and the project still does not show up in the list of all projects.

projectName = "This & That" project_item = TSC.ProjectItem(name=projectName, content_permissions='LockedToProject') project_item = self.server.projects.create(project_item)

options = TSC.RequestOptions()

options.filter.add(TSC.Filter(TSC.RequestOptions.Field.Name, TSC.RequestOptions.Operator.Equals, projectName)) filteredprojects, = self.server.projects.get(req_options=options) if filtered_projects: project = filtered_projects.pop() project_name = project.name print('Found project: %s' % project_name) return project else: return None

TimoMorris commented 4 years ago

My first guess would be that this is an issue with the ampersand not being URL percent encoded (i.e. replaced with %26).

Sorry to not be able to be more helpful than that - it looks like you're using Trello through an integration with Tableau or something? It's not entirely clear to me which bit of py-trello you're using, especially as "project" isn't a Trello term as far as I know, though I'm guessing it corresponds to a Trello board? Or label maybe? 🤔

If you can add any extra clarifying details, I might be able to have a further dig for you and see if I can suss it out. 😊

(I realise this Issue is now ~4 months old, so even if it's not relevant to you any more, I'm sure there are other people out there who are suffering with this... or might suffer in the future, so if you've got a moment to help with extra info, that'd be great.)

mwilton commented 4 years ago

Well I'm an idiot. This is for Tableau, not Trello.

Sigh. I guess we can close this one. :)

TimoMorris commented 4 years ago

Ahh, well at least that's one mystery solved! 😅