{"action":"created","issue":{"url":"https://api.github.com/repos/kvesteri/sqlalchemy-utils/issues/120","labels_url":"https://api.github.com/repos/kvesteri/sqlalchemy-utils/issues/120/labels{/name}","comments_url":"https://api.github.com/repos/kvesteri/sqlalchemy-utils/issues/120/comments","events_url":"https://api.github.com/repos/kvesteri/sqlalchemy-utils/issues/120/events","html_url":"https://github.com/kvesteri/sqlalchemy-utils/issues/120","id":54530868,"number":120,"title":"PasswordType doesn't work when used with plaintext","user":{"login":"mehcode","id":753919,"avatar_url":"https://avatars.githubusercontent.com/u/753919?v=3","gravatar_id":"","url":"https://api.github.com/users/mehcode","html_url":"https://github.com/mehcode","followers_url":"https://api.github.com/users/mehcode/followers","following_url":"https://api.github.com/users/mehcode/following{/other_user}","gists_url":"https://api.github.com/users/mehcode/gists{/gist_id}","starred_url":"https://api.github.com/users/mehcode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mehcode/subscriptions","organizations_url":"https://api.github.com/users/mehcode/orgs","repos_url":"https://api.github.com/users/mehcode/repos","events_url":"https://api.github.com/users/mehcode/events{/privacy}","received_events_url":"https://api.github.com/users/mehcode/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/kvesteri/sqlalchemy-utils/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-16T01:52:15Z","updated_at":"2015-04-08T19:12:06Z","closed_at":null,"body":"```python\r\nAttributeError: type object 'plaintext' has no attribute 'checksum_size'\r\n```"},"comment":{"url":"https://api.github.com/repos/kvesteri/sqlalchemy-utils/issues/comments/91007609","html_url":"https://github.com/kvesteri/sqlalchemy-utils/issues/120#issuecomment-91007609","issue_url":"https://api.github.com/repos/kvesteri/sqlalchemy-utils/issues/120","id":91007609,"user":{"login":"ginoledesma","id":879991,"avatar_url":"https://avatars.githubusercontent.com/u/879991?v=3","gravatar_id":"","url":"https://api.github.com/users/ginoledesma","html_url":"https://github.com/ginoledesma","followers_url":"https://api.github.com/users/ginoledesma/followers","following_url":"https://api.github.com/users/ginoledesma/following{/other_user}","gists_url":"https://api.github.com/users/ginoledesma/gists{/gist_id}","starred_url":"https://api.github.com/users/ginoledesma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ginoledesma/subscriptions","organizations_url":"https://api.github.com/users/ginoledesma/orgs","repos_url":"https://api.github.com/users/ginoledesma/repos","events_url":"https://api.github.com/users/ginoledesma/events{/privacy}","received_events_url":"https://api.github.com/users/ginoledesma/received_events","type":"User","site_admin":false},"created_at":"2015-04-08T19:12:06Z","updated_at":"2015-04-08T19:12:06Z","body":"The error is misleading, but this is a side-effect of declaring a column using PasswordType without specifying max_length. For example:\r\n\r\n```python\r\nfrom flask import Flask\r\nfrom flask.ext.sqlalchemy import SQLAlchemy\r\nfrom sqlalchemy_utils.types.password import PasswordType\r\n\r\napp = Flask(__name__)\r\ndb = SQLAlchemy(app)\r\n\r\nclass User(db.Model):\r\n    id = db.Column(db.Integer, primary_key=True)\r\n    username = db.Column(db.String(40), unique=True)\r\n    password = db.Column(PasswordType(\r\n        schemes=[\r\n            'bcrypt',\r\n            'plaintext',\r\n        ],\r\n        deprecated=['plaintext'],\r\n#        max_length=32,\r\n    )) \r\n```\r\n\r\nOutput:\r\n```\r\nTraceback (most recent call last):\r\n  File \"testit.py\", line 8, in <module>\r\n    class User(db.Model):\r\n  File \"testit.py\", line 16, in User\r\n    deprecated=['plaintext'],\r\n  File \"/Users/gledesma/Library/Python/2.7/lib/python/site-packages/sqlalchemy_utils/types/password.py\", line 135, in __init__\r\n    max_length = self.calculate_max_length()\r\n  File \"/Users/gledesma/Library/Python/2.7/lib/python/site-packages/sqlalchemy_utils/types/password.py\", line 153, in calculate_max_length\r\n    scheme.checksum_size\r\nAttributeError: type object 'plaintext' has no attribute 'checksum_size'\r\n```\r\n\r\nIf you specify `max_length` as a property of `db.column()`, your error goes away."}}