SigningTS/server3020/main.py
author John Kern <johnk@symbian.org>
Wed, 12 May 2010 09:44:30 -0700
changeset 17 cad8819de653
permissions -rw-r--r--
adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
17
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
     1
#!/usr/bin/env python
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
     2
#
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
     3
# Copyright 2007 Google Inc.
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
     4
#
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
     7
# You may obtain a copy of the License at
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
     8
#
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
     9
#     http://www.apache.org/licenses/LICENSE-2.0
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    10
#
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    15
# limitations under the License.
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    16
#
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    17
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    18
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    19
from google.appengine.ext import webapp
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    20
from google.appengine.ext.webapp import util
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    21
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    22
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    23
class MainHandler(webapp.RequestHandler):
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    24
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    25
  def __init__(self):
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    26
    self.key="853b128a-0c18-42f2-835f-db9f5b6f7fb9"
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    27
    # version
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    28
    self.apiVersion=1
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    29
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    30
  def get(self):
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    31
    self.response.headers['Content-Type'] = 'text/xml'
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    32
    self.response.out.write('<SymbianSigned>')
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    33
    self.response.out.write('<UID3>')
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    34
    self.response.out.write('0xDEADBEEF')
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    35
    self.response.out.write('</UID3>')
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    36
    self.response.out.write('<description>')
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    37
    self.response.out.write('leviation application. Pretty cool, ahe?')
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    38
    self.response.out.write('</description>')
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    39
    self.response.out.write('</SymbianSigned>')
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    40
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    41
  def post(self): 
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    42
  	self.response.headers['Content-Type'] = 'text/xml'
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    43
  	self.response.out.write('<args>')
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    44
	self.response.out.write(self.request.query_string)
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    45
  	self.response.out.write('</args>')
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    46
  	self.response.out.write('<body>')
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    47
  	self.response.out.write(self.request.body)
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    48
  	self.response.out.write('</body>')
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    49
 
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    50
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    51
def main():
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    52
  application = webapp.WSGIApplication([('/', MainHandler)],
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    53
                                       debug=True)
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    54
  util.run_wsgi_app(application)
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    55
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    56
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    57
if __name__ == '__main__':
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    58
  main()