/
EdenWishes.py
56 lines (44 loc) · 1.25 KB
/
EdenWishes.py
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
import webapp2
import json
#import EdenDataOfficer as edo
#from models import *
from google.appengine.api import users
from google.appengine.ext import ndb
from google.appengine.api import channel
from EdenModels import *
xID = users.get_current_user().user_id() #might have to move this into private scopes? may have sesh persist problems
class Actualize():
@classmethod
def Pixel(self):
source = ndb.Key('Crystal','1').get()
if source:
source.uCount += 1
source.put()
newID = str(source.uCount)
pixel = Pixel(id=newID,xID = xID)
pixel.kid = 'Pixel'+newID
pixel.name = pixel.kid
pixel.put()
return pixel
else:
return source
class Msg():
name = 'stuff'
info = 'heh'
def aChan():
token = channel.create_channel(xID,1440)
msg = Msg()
msg.info = 'ho'
tomsg = json.dumps(msg.__dict__)
channel.send_message(xID, tomsg)
return token
def myPixel():
myPixel = Pixel.query(Pixel.xID == xID).get()
if myPixel:
return myPixel
else:
return Actualize.Pixel()
class aSession():
def __init__(self):
self.Chan = aChan()
self.cPixel = myPixel().to_dict()