model.py 1.1KB

1234567891011121314151617181920212223242526272829
  1. #coding: utf8
  2. from sqlalchemy import Column
  3. from sqlalchemy import ForeignKey
  4. from sqlalchemy.types import Unicode, UnicodeText, Float
  5. from wsgidav.compat import to_unicode
  6. class Lock(object):
  7. __tablename__ = 'my_locks'
  8. token = Column(UnicodeText, primary_key=True, unique=True, nullable=False)
  9. depth = Column(Unicode(32), unique=False, nullable=False, default=to_unicode('infinity'))
  10. root = Column(UnicodeText, unique=False, nullable=False)
  11. type = Column(Unicode(32), unique=False, nullable=False, default=to_unicode('write'))
  12. scope = Column(Unicode(32), unique=False, nullable=False, default=to_unicode('exclusive'))
  13. owner = Column(UnicodeText, unique=False, nullable=False)
  14. expire = Column(Float, unique=False, nullable=False)
  15. principal = Column(Unicode(255), ForeignKey('my_users.display_name', ondelete="CASCADE"))
  16. timeout = Column(Float, unique=False, nullable=False)
  17. class Url2Token(object):
  18. __tablename__ = 'my_url2token'
  19. token = Column(UnicodeText, primary_key=True, unique=True, nullable=False)
  20. path = Column(UnicodeText, primary_key=True, unique=False, nullable=False)