view examples/tutorial/geddit/model.py @ 623:9c89e22516b4

GenshiTutorial: Minor updates to Atom feed templates.
author cmlenz
date Thu, 30 Aug 2007 23:01:49 +0000
parents 71d3edd302ae
children dba522b4c31d
line wrap: on
line source
from datetime import datetime


class Link(object):

    def __init__(self, username, url, title):
        self.username = username
        self.url = url
        self.title = title
        self.time = datetime.utcnow()
        self.id = hex(hash(tuple([username, url, title, self.time])))[2:]
        self.comments = []

    def __repr__(self):
        return '<%s %r>' % (type(self).__name__, self.title)

    def add_comment(self, username, content):
        self.comments.append(Comment(username, content))


class Comment(object):

    def __init__(self, username, content):
        self.username = username
        self.content = content
        self.time = datetime.utcnow()

    def __repr__(self):
        return '<%s>' % (type(self).__name__)
Copyright (C) 2012-2017 Edgewall Software