Beispiel #1
0
def main():
    application = webapp.WSGIApplication(
        [('/', IndexHandler), ('/go_to_foursquare', AuthHandler),
         ('/authenticated', AuthHandler), ('/tile/.*', TileHandler),
         ('/map/.*', StaticMapHandler), ('/public/.*', PublicPageHandler),
         ('/information', InformationWriter),
         ('/static_map_html', StaticMapHtmlWriter),
         ('/user_is_ready/.*', UserReadyEndpoint),
         ('/map_is_done/', MapDoneEndpoint)],
        debug=True)
    constants.provider = provider.DBProvider()
    run_wsgi_app(application)
Beispiel #2
0
 def __init__(self, user, lat_north, lng_west, range_lat, range_lng):
   userinfo = UserInfo.all().filter('user ='******'t do any more math if we don't have any venues
     cur_canvas = self.color_scheme.canvas
     self.tile_img = PNGCanvas(SIZE, SIZE, bgcolor=cur_canvas[len(cur_canvas) - 1][0]) #NOTE the last index should be safe here, but for users with negative level_max's, self.cache_levels was an empty list and thus this was erroring
import os
from os import environ
import constants
from google.appengine.ext import db
from google.appengine.api import users
from models import UserInfo, UserVenue, MapImage
from gheatae import provider

if __name__ == '__main__':
    raw = environ['PATH_INFO']
    assert raw.count('/') == 2, "%d /'s" % raw.count('/')
    foo, bar, rest, = raw.split('/')

    if not constants.provider:
        constants.provider = provider.DBProvider()

    # if rest == 'all': # This is dangerous, so I'm commenting it out :)
    #   while(MapImage.all().count() > 0):
    #     mapimages = MapImage.all().fetch(500)
    #     db.delete(mapimages)
    #   while(UserVenue.all().count() > 0):
    #     uservenues = UserVenue.all().fetch(500)
    #     db.delete(uservenues)
    #   while(AuthToken.all().count() > 0):
    #     authtokens = AuthToken.all().fetch(500)
    #     db.delete(authtokens)
    #   while(UserInfo.all().count() > 0):
    #     userinfos = UserInfo.all().fetch(500)
    #     db.delete(userinfos)

    elif rest == 'user':
Beispiel #4
0
from gheatae import color_scheme, dot, tile, cache, provider
from gheatae.tile import Tile
from gheatae import consts
from os import environ
import logging
import time
import handler

log = logging.getLogger('tile')

tile.cache = cache.Cache()
tile.provider = provider.DBProvider()


class GetTile(handler.Handler):
    def get(self):
        log.info("Running GetTile:GET...")
        st = time.clock()
        path = environ['PATH_INFO']

        log.debug("Path:" + path)
        if path.endswith('.png'):
            raw = path[:-4]  # strip extension
            try:
                assert raw.count('/') == 6, "%d /'s" % raw.count('/')
                foo, bar, layer, zoom, xy, category, metro = raw.split('/')
                assert xy.count(',') == 1, "%d /'s" % xy.count(',')
                x, y = xy.split(',')
                assert zoom.isdigit() and x.isdigit() and y.isdigit(
                ) and category.isdigit() and metro.isdigit(), "not digits"
                zoom = int(zoom)