-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathfdb.py
More file actions
executable file
·59 lines (52 loc) · 1.99 KB
/
fdb.py
File metadata and controls
executable file
·59 lines (52 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# -*- coding: utf-8 -*-
from google.appengine.ext import db
class UniqueConstraintViolation(Exception):
def __init__(self, scope, value):
super(UniqueConstraintViolation, self).__init__("Value '%s' is not unique within scope '%s'." % (value, scope, ))
class article(db.Model):
url = db.StringProperty()
title = db.TextProperty()
txt = db.TextProperty()
pubtime = db.IntegerProperty()
def put(self):
if item.get_by_key_name(self.url):
return None
self._key_name = self.url
return db.Model.put(self)
class item(db.Model):
tag = db.StringProperty()
src = db.StringProperty()
srcsite = db.StringProperty()
usr = db.StringProperty()
url = db.StringProperty()
tvote = db.IntegerProperty()
gvote = db.IntegerProperty()
fvote = db.IntegerProperty()
vote = db.IntegerProperty()
title = db.TextProperty()
txt = db.TextProperty()
time = db.IntegerProperty()
md5 = db.StringProperty()
def put(self):
if item.get_by_key_name(self.url):
#import logging
#logging.warning('put title %s' % self.title)
#raise UniqueConstraintViolation("title", self.title)
return None
self._key_name = self.url
return db.Model.put(self)
class comments(db.Model):
url = db.StringProperty()
md5 = db.StringProperty()
comment = db.TextProperty()
class trends(db.Model):
keyword = db.StringProperty()
time = db.StringProperty()
class linkitem(db.Model):
valid = db.IntegerProperty()
url = db.StringProperty(multiline=True)
def put(self):
if item.get_by_key_name(self.url):
return None
self._key_name = self.url
return db.Model.put(self)