aboutsummaryrefslogtreecommitdiffstats
path: root/access/insert.py
blob: 2f4184a170df0f1a6366054ca3c5e45c59cf9c49 (plain) (blame)
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
#!/usr/bin/env python
# -*- coding: UTF-8 -*-

import cgi
import datetime
import webapp2

from google.appengine.api import users
from google.appengine.ext import db

from access import CalEvent

class InsertEvent(webapp2.RequestHandler):
    def get(self):
        return
    def post(self):
        guserid = users.get_current_user()
        if not guserid:
            return
        thisicon = int(self.request.get('icon'))
        thistitle = self.request.get('title')
        thiscontent = self.request.get('content')
        thisbeginyear = int(self.request.get('year'))
        thisbeginmonth = int(self.request.get('month'))
        thisbegindate = int(self.request.get('date'))
        thisbeginhour = int(self.request.get('hour'))
        thisbeginminute = int(self.request.get('minute'))
        thisbegin = datetime.datetime (
        year = thisbeginyear,
        month = thisbeginmonth,
        day = thisbegindate,
        hour = thisbeginhour,
        minute = thisbeginminute
        );
        thisdatafrom = self.request.get('datafrom')
        thisremind = int(self.request.get('remind'))

        newcalevent = CalEvent(
        db.Key.from_path('user', guserid.email()),
        content = thiscontent,
        begin = thisbegin,
        datafrom = thisdatafrom
        )

        newcalevent.title = thistitle
        newcalevent.icon = thisicon
        newcalevent.remind = thisremind

        newcalevent.put()

app = webapp2.WSGIApplication([('/access/insert', InsertEvent)])