aboutsummaryrefslogtreecommitdiffstats
path: root/access/insert.py
blob: 5e787988f4115e373d8048f5e7ea7da1b9470a64 (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
#!/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('beginyear'))
        thisbeginmonth = int(self.request.get('beginmonth'))
        thisbegindate = int(self.request.get('begindate'))
        thisbegin = datetime.datetime (
        year = thisbeginyear,
        month = thisbeginmonth,
        day = thisbegindate
        );
        thisdatafrom = self.request.get('datafrom')
        thisremind = 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)])