Peewee: PasswordField & PickledField on 3?

Created on 30 Jan 2018  路  5Comments  路  Source: coleifer/peewee

http://docs.peewee-orm.com/en/latest/peewee/changes.html#fields

What are the alternatives for PasswordField and PickledField on 3.x ?.
What are you using if you need PasswordField and PickledField on 3.x ?.

The Documentation dont mention alternatives.
:thinking:

Most helpful comment

Thank you very much!.

Field now lives here, in case someone still need it, or to ease migration to 3.x:
https://github.com/juancarlospaco/peewee-extra-fields#pickledfield
:smiley:

All 5 comments

Hey, those are no longer supported. PasswordField had some legitimate security concerns raised about it, and I don't want to give the false sense of security as to what it claims to do. PickleField is quite easy to implement in your own code or in a library.

import sqlite
import pickle

class PickledField(BlobField):
    def python_value(self, value):
        if isinstance(value, (bytearray, sqlite3.Binary)):
            value = bytes(value)
        return pickle.loads(value)

    def db_value(self, value):
        return sqlite3.Binary(pickle.dumps(value, 2))

Thank you very much!.

Field now lives here, in case someone still need it, or to ease migration to 3.x:
https://github.com/juancarlospaco/peewee-extra-fields#pickledfield
:smiley:

Good stuff brotha, thanks

Just in case anyone was troubleshooting PickleField
http://docs.peewee-orm.com/en/latest/peewee/playhouse.html#PickleField

from playhouse.fields import PickleField
Was this page helpful?
0 / 5 - 0 ratings

Related issues

GitHubAre picture GitHubAre  路  5Comments

kalimalrazif picture kalimalrazif  路  3Comments

hanxifu picture hanxifu  路  4Comments

kadnan picture kadnan  路  3Comments

alexlatchford picture alexlatchford  路  4Comments