Closed daredoes closed 7 years ago
fixes #61
+1
Whaaaat that's crazy. Good to know though.
On Fri, Nov 25, 2016, 13:25 Eli Courtwright notifications@github.com wrote:
@EliAndrewC commented on this pull request.
In hotel/site_sections/hotel_assignments.py https://github.com/magfest/hotel/pull/60:
@@ -46,7 +46,7 @@ def goto_staffer_requests(self, id): @ajax def create_room(self, session, **params): params['nights'] = list(filter(bool, [params.pop(night, None) for night in c.NIGHT_NAMES]))
- loops = int(params['count']) if params['count'] else 1
- loops = int(params['count']) if params.get("count") else 1
That might not be true in this specific case; from the way this was written originally I'm guessing that we might get a value like '' which is falsey, so there would be a difference, e.g.
d = {'x': ''} d.get('x') or 'Hello' # returns 'Hello' d.get('x', 'Hello') # returns ''
I'd need to look at the Javascript code on the frontend to see whether that applies here, but I'm guessing it does given how the function was originally written.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/magfest/hotel/pull/60, or mute the thread https://github.com/notifications/unsubscribe-auth/AG3WB_6KsAstaV0bSOgjVuzjOlWvIzYdks5rBygKgaJpZM4K70ly .
We've been using if param["key"], when in reality we should be using param.get("key")