From b1b484a0b93a5651da7d1ca20e77f70089b215bb Mon Sep 17 00:00:00 2001 From: Simeon Simeonov Date: Mon, 12 Nov 2012 15:09:47 +0100 Subject: bpynotify - started --- bpynotify_orm.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 bpynotify_orm.py (limited to 'bpynotify_orm.py') diff --git a/bpynotify_orm.py b/bpynotify_orm.py new file mode 100644 index 0000000..0540d0a --- /dev/null +++ b/bpynotify_orm.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- + +import datetime + +from sqlalchemy import schema, types +from sqlalchemy.orm import mapper + +metadata = schema.MetaData() + +notification_entry_table = schema.Table('notification_entries', metadata, + schema.Column('id', types.Integer, primary_key=True), + schema.Column('timestamp', types.DateTime), + schema.Column('message', types.Unicode(), default = u'Empty message'), + schema.Column('viewed', types.Boolean, default=False) + ) + + + +class NotificationEntry(object): + + def __init__(self, message): + + self.timestamp = datetime.datetime.now() + self.message = message + + + def __repr__(self): + + return message + + +mapper(NotificationEntry, notification_entry_table) -- cgit v1.3