{"action":"opened","issue":{"url":"https://api.github.com/repos/genouest/biomaj/issues/31","labels_url":"https://api.github.com/repos/genouest/biomaj/issues/31/labels{/name}","comments_url":"https://api.github.com/repos/genouest/biomaj/issues/31/comments","events_url":"https://api.github.com/repos/genouest/biomaj/issues/31/events","html_url":"https://github.com/genouest/biomaj/issues/31","id":129488827,"number":31,"title":"Bug in method \"get_production\"","user":{"login":"horkko","id":9282917,"avatar_url":"https://avatars.githubusercontent.com/u/9282917?v=3","gravatar_id":"","url":"https://api.github.com/users/horkko","html_url":"https://github.com/horkko","followers_url":"https://api.github.com/users/horkko/followers","following_url":"https://api.github.com/users/horkko/following{/other_user}","gists_url":"https://api.github.com/users/horkko/gists{/gist_id}","starred_url":"https://api.github.com/users/horkko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/horkko/subscriptions","organizations_url":"https://api.github.com/users/horkko/orgs","repos_url":"https://api.github.com/users/horkko/repos","events_url":"https://api.github.com/users/horkko/events{/privacy}","received_events_url":"https://api.github.com/users/horkko/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-01-28T15:47:55Z","updated_at":"2016-01-28T15:47:55Z","closed_at":null,"body":"Hi,\r\n\r\nI've discovered a small bug in the method `get_production`, which actually fails when we pass a release as number or int. Here is an example : \r\nConsider this bank in MongoDB:\r\n```\r\n{                                                                                                                                                \r\n  \"production\": [\r\n    {\r\n      \"freeze\": false,\r\n      \"remoterelease\": \"82\",\r\n      \"session\": 1444600897,\r\n      \"data_dir\": \"/path/to/biomaj/biomaj3/banks\",\r\n      \"formats\": [\r\n        \"fasta\"\r\n      ],\r\n      \"release\": \"82\",\r\n      \"dir_version\": \"btaurus\",\r\n      \"prod_dir\": \"btaurus_82\",\r\n      \"types\": [\r\n        \"genome\"\r\n      ],\r\n      \"size\": \"0K\"\r\n    },\r\n```\r\nand the small code: \r\n```\r\nfrom biomaj.bank import Bank\r\nfrom biomaj.config import BiomajConfig\r\nimport os\r\n\r\nBiomajConfig.load_config(config_file=os.environ['BIOMAJ_CONF'])\r\nb = Bank('btaurus')\r\nb.get_production(80)\r\n```\r\nThis call to `get_production(80)` returns `None`. This is why the method `get_production` compare strings such as : \r\n```\r\n        production = None\r\n        for prod in self.bank['production']:\r\n            if prod['release'] == release or prod['prod_dir'] == release:\r\n                production = prod\r\n        return production\r\n```\r\n\r\nModifying this `if` statement like so : \r\n```\r\n...\r\nif prod['release'] == str(release) or prod['prod_dir'] == str(release):\r\n...\r\n```\r\nretruns the right `production` dict from MongoDB\r\n\r\n```\r\n  \"production\": [\r\n    {\r\n      \"freeze\": false,\r\n      \"remoterelease\": \"82\",\r\n      \"session\": 1444600897,\r\n      \"data_dir\": \"/path/to/biomaj/biomaj3/banks\",\r\n      \"formats\": [\r\n        \"fasta\"\r\n      ],\r\n      \"release\": \"82\",\r\n      \"dir_version\": \"btaurus\",\r\n      \"prod_dir\": \"btaurus_82\",\r\n      \"types\": [\r\n        \"genome\"\r\n      ],\r\n      \"size\": \"0K\"\r\n```\r\nAlso, this statement is not only found in this method but also in following methods:\r\n`freeze, unfreeze, get_session_from_release, remove`\r\nAfter this modification, I've run `nosetests`. It passed OK\r\n\r\nEmmanuel"}}