diff options
-rw-r--r-- | db.py | 4 | ||||
-rw-r--r-- | pastepy.py | 2 |
2 files changed, 4 insertions, 2 deletions
@@ -19,14 +19,16 @@ class Paste(Base): syntax = Column(String) title = Column(String) text = Column(Text, nullable = False) + ip = Column(String) - def __init__(self, hash, nick, date, syntax, title, text): + def __init__(self, hash, nick, date, syntax, title, text, ip=None): self.nick = nick self.hash = hash self.date = date self.syntax = syntax self.title = title self.text = text + self.ip = ip def __repr__(self): return '<Paste(%d, "%s", "%s", "%s", "%s")>' % (self.id, self.hash, self.nick, self.date.ctime(), self.title) @@ -114,7 +114,7 @@ class Paste(object): try: session = db.Session() - paste = db.Paste(hash, nick, datetime.datetime.utcnow(), syntax, title, text) + paste = db.Paste(hash, nick, datetime.datetime.utcnow(), syntax, title, text, self.environ['REMOTE_ADDR']) session.add(paste) session.commit() finally: |