Exemplo n.º 1
0
def test_middleware():
    """Tests that the middleware requires cookie_key when it should."""
    logging.debug("cookie_key is required and needs to be reasonably long")
    assert_raises(ValueError, SessionMiddleware, None, None)
    assert_raises(ValueError, SessionMiddleware, None, cookie_key='blah')
    SessionMiddleware(None, cookie_only_threshold=10, cookie_key='blah' * 8)
    SessionMiddleware(None,
                      cookie_only_threshold=0,
                      cookie_key="still need a key" * 4)
Exemplo n.º 2
0
def webapp_add_wsgi_middleware(app):
    app = SessionMiddleware(
        app,
        cookie_key=
        "pydaycba_pydaycba2012_pydaycba_pydaycba2012_pydaycba_pydaycba2012",
        cookie_only_threshold=0)
    return app
Exemplo n.º 3
0
def webapp_add_wsgi_middleware(app):
	from google.appengine.ext.appstats import recording
	app = recording.appstats_wsgi_middleware(app)
    # To generate the cookie_key below, run the following:
    # ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits + "!@#$%^&*()-=+_[]}{;:'/.,<>?") for x in range(100))
	app = SessionMiddleware(app, cookie_key="!LHa-PU;Jtaitvd1#EXmKmDhP}Z43CXDNf3:qizp!O}Vzv['LU:P<f*UF]ro.wA10<qZ&1JIcW{Pgp&v{TPJ8eH.qI,0+P2?3=Tf")
	return app
Exemplo n.º 4
0
def webapp_add_wsgi_middleware(app):
    app = SessionMiddleware(
        app,
        cookie_key=
        "dsijfb3459whefwiuhr39wfpwor209u30ru3wifjwj3f08wfuw08ef0384r38whf")
    app = recording.appstats_wsgi_middleware(app)
    return app
def webapp_add_wsgi_middleware(app):
    app = SessionMiddleware(
        app,
        cookie_key=
        '\x82\xa8\x9d\xaf\x81,m\xc4y\xd4C\xfb\x14?a\xec\x85{\x1c\x9a\x8dU\x1e\x86\xf2;\xc3\xc2\xb0x\xf3\xe5\xedX\xc1\xfe\xadM.;\xce\r\xc9\x9a\xae\x13=(H\xe6\xcb\x10\x16Y\x1b\xf5\x05Ua]\x0e5Z\xc3'
    )
    return app
Exemplo n.º 6
0
def webapp_add_wsgi_middleware(app):
    app = SessionMiddleware(
        app,
        cookie_key=
        "ohoifjeifeieheihgeiheighfhfhffhfhfhgfhfhgfhgfhgfhgfhgfhgfhgfhgfhgfhgfhgfhgfhhhfhf"
    )
    return app
def webapp_add_wsgi_middleware(app):
    app = SessionMiddleware(
        app,
        cookie_key=
        "signinwithtwittertestapp_signinwithtwittertestapp_signinwithtwittertestapp_foobar",
        cookie_only_threshold=0)
    return app
Exemplo n.º 8
0
def webapp_add_wsgi_middleware(app):
    # apply session middleware
    key = "'\\x15\\xbb\\x04]\\x87z\\x19\\xe5\\xb6(\\x19\\xc8c:I\\x83t\\xfbw\\ti\\x1c^`\\xa4\\x05\\x16\\x7f\\xce\\xff\\x98\\xac-vDj{x~\\xa9V\\x07\\x1e\\xebG\\x82\\xc4\\xef\\x0f\\xdd\\xc6\\xb0O!\\r\\xcf\\xd4\\xbb\\xb3^\\x16\\n\\x1a@'"
    app = SessionMiddleware(app, cookie_key=key, cookie_only_threshold=0)
    # apply appstats middleware
    app = recording.appstats_wsgi_middleware(app)
    return app
Exemplo n.º 9
0
def webapp_add_wsgi_middleware(app):
    app = SessionMiddleware(app,
                            cookie_key=os.urandom(64),
                            cookie_only_threshold=0,
                            lifetime=datetime.timedelta(minutes=5),
                            no_datastore=True)
    return app
Exemplo n.º 10
0
def webapp_add_wsgi_middleware(app):
    app = SessionMiddleware(
        app,
        cookie_key=
        '\xaf\xa4\xd3!_\x86N4\xab\x85r\x03\x93\xde\xa3\xd8\xad<\xf7\xc5\x1d\x1b\xaeCZE\xefS \\\x93($\x12\x04_U\xa7\x14\xf5\xbac\xf2\xb9\xa3\x9an\xfb=|R\x8fF\xf1"Xd\xc6\x1c\xcf\xe0\xfcl\t'
    )
    return app
Exemplo n.º 11
0
def webapp_add_wsgi_middleware(app):
    app = SessionMiddleware(
        app,
        cookie_only_threshold=0,
        cookie_key=
        '82798247027024730817340831643805710851758016530185638407318043180536158013456310487438047304'
    )
    return app
Exemplo n.º 12
0
def webapp_add_wsgi_middleware(app):
    app = SessionMiddleware(
        app,
        cookie_key=
        '\x13p\xc5\x00\xb2\xccq\xffo\xf5\x99\xbd\x99\x19\xa9o\x8d+\xe2\xb9\x01\xbb\x9en\x0eP=\x01:\xcf\xae\xf3\x07\xd6h\x15\x1d\xe8wF\xeeZX\xb4`\x91\x92\x97s\x80.>|E\xd5\x8c\xd8\xde\xc1r&j\x1c\xff',
        lifetime=timedelta(100),
        no_datastore=True)
    return app
Exemplo n.º 13
0
def webapp_add_wsgi_middleware(app):
    app = SessionMiddleware(app, cookie_key=settings.COOKIE_KEY)

    if settings.DEBUG:
        # load profiling tool
        from google.appengine.ext.appstats import recording
        app = recording.appstats_wsgi_middleware(app)

    return app
def webapp_add_wsgi_middleware(app):
    os.environ['DJANGO_SETTINGS_MODULE'] = 'utils.settings'
    template.register_template_library('templatetags.formats')
    template.register_template_library('templatetags.dictionary')
    
    #from apptrace.middleware import apptrace_middleware
    #app = apptrace_middleware(app)
    app = SessionMiddleware(app, cookie_key=conf.COOKIE_KEY, lifetime=datetime.timedelta(1), no_datastore=True)
    return app
Exemplo n.º 15
0
def webapp_add_wsgi_middleware(app):
    from google.appengine.ext.appstats import recording
    app = recording.appstats_wsgi_middleware(app)

    from gaesessions import SessionMiddleware
    app = SessionMiddleware(
        app, cookie_key='ÉîVÀhruL¬^[J;âL\§ç&«­m¾uâÇÐE{¬_¬Ï)ªß?Ö')

    return app
Exemplo n.º 16
0
def webapp_add_wsgi_middleware(app):
    initialize_global_vars()
    gaesentry.add_sentry_to_logging()
    from google.appengine.ext.appstats import recording
    app = recording.appstats_wsgi_middleware(app)
    cookie_key = "6ghJ7fJ4StrQbrTYggCfn5gJv7FfgDefFgYhI8v6Dgce7SwDmYdLOjoPePi"
    cookie_key += "PhnSWfEbnTKCadXsoSbAt"
    app = SessionMiddleware(app, cookie_key=cookie_key)
    return app
Exemplo n.º 17
0
def make_application(**kwargs):
    app = webapp.WSGIApplication([
        ('/', RPCHandler),
        ('/flush_memcache', FlushMemcache),
        ('/cleanup', CleanupExpiredSessions),
        ('/get_by_sid', GetSession),
        ('/delete_all', DeleteAll),
    ],
                                 debug=True)
    return TestingMiddleware(SessionMiddleware(app, **kwargs))
Exemplo n.º 18
0
def webapp_add_wsgi_middleware(app):
    # Generate your own cookie_key!
    # You can do so by running this (in the terminal, not in your code here):
    #   from uuid import uuid4
    #   print str(uuid4().hex+uuid4().hex)
    app = SessionMiddleware(
        app,
        cookie_key=
        "c184345987404d23b8cc796b890cb3b7e2d527758ccd4f658c6162350fbb8473",
        cookie_only_threshold=0)
    return app
Exemplo n.º 19
0
def webapp_add_wsgi_middleware(app):
    from gaesessions import SessionMiddleware
    from credentials import SESSION_SALT
    newapp = SessionMiddleware(app, cookie_key=SESSION_SALT)

    # Appstats is temporarily removed to prevent the following message
    # "Full proto too large to save, cleared variables."
    #from google.appengine.ext.appstats import recording
    #newapp = recording.appstats_wsgi_middleware(newapp)

    return newapp
Exemplo n.º 20
0
def webapp_add_wsgi_middleware(app):
    from google.appengine.ext.appstats import recording
    app = SessionMiddleware(app, cookie_key=";lkjascvpoiuzxclvkjswd:LKJHLKJHPoiu;lkj32453456lkjhkjwdhfgsdfggfdse",lifetime=datetime.timedelta(365))

    from google.appengine.ext.appstats import recording
    app = recording.appstats_wsgi_middleware(app)

    # Add the following
    from gae_bingo.middleware import GAEBingoWSGIMiddleware
    app = GAEBingoWSGIMiddleware(app)

    return app
Exemplo n.º 21
0
def webapp_add_wsgi_middleware(app):
    from google.appengine.ext.appstats import recording
    app = SessionMiddleware(app, cookie_key=COOKIE_KEY)
    app = recording.appstats_wsgi_middleware(app)
    return app
Exemplo n.º 22
0
def webapp_add_wsgi_middleware(app):
    app = SessionMiddleware(app,
                            cookie_key="0miyg9r4n3achza5s9jkdwa9t3khwu97",
                            lifetime=datetime.timedelta(days=31))
    return app
Exemplo n.º 23
0
def webapp_add_wsgi_middleware(app):
    app = SessionMiddleware(app, cookie_key="646f77686974206279207072696d6569676874")
    return app
Exemplo n.º 24
0
def webapp_add_wsgi_middleware(app):
    app = SessionMiddleware(app,
                            cookie_key="\x77\xcb\xef~\x83\x12\xbev\xfeZ\x1aG\xb9^\x89:\xf8\x7f+Y+\x15\x91\xe8\x985\xd9aHY\xf1x\x99]'\xd3\xb2\x13\xa4\xc3\x92\xa50\xae\xb8\x90\xbb(\xba\x95\x1f\x07\xd2\xa0\xc0B*q\xe7\xc4e.\xae9")
    return app
Exemplo n.º 25
0
def webapp_add_wsgi_middleware(app):
    app = SessionMiddleware(app,
                            no_datastore=True,
                            cookie_key=endpoints.COOKIE_KEY)
    return app
Exemplo n.º 26
0
def webapp_add_wsgi_middleware(app):
    app = SessionMiddleware(app,
                            cookie_key="e88de590-f86e-11e1-a21f-0800200c9a66",
                            no_datastore=True)
    return app
Exemplo n.º 27
0
def webapp_add_wsgi_middleware(app):
    app = SessionMiddleware(
        app,
        cookie_key="tZ0l_HB64ShicoHi-JIYz8iXufIiSpP2pCwj_XqqNPokioUKt5FyI6")
    return app
Exemplo n.º 28
0
        #self.response.write(json.dumps(templates))
        get_template = JINJA_ENVIRONMENT.get_template(
            'templates/quiz_summary.html')
        self.response.write(get_template.render(templates))


app = webapp2.WSGIApplication(
    [('/Test', Test), ('/', Main), ('/Create', CreateQuiz),
     ('/CreateQuizHandler', CreateQuizHandler), ('/ModifyQuiz', ModifyQuiz),
     ('/ModifyQuizHandler', ModifyQuizHandler),
     ('/ManageQuestionHandler', ManageQuestionHandler), ('/Quiz', Quiz),
     ('/AnsQuiz', AnsQuiz), ('/QuizSummary', QuizSummary),
     ('/QuizResult', QuizResult),
     (decorator.callback_path, decorator.callback_handler())],
    debug=True)
app = SessionMiddleware(app, cookie_key=str(os.urandom(64)))


def insert_file(service, title, description, parent_id, mime_type, filename):
    #media_body = MediaFileUpload(filename, mimetype=mime_type, resumable=True)
    body = {'title': title, 'description': description, 'mimeType': mime_type}
    # Set the parent folder.
    if parent_id:
        body['parents'] = [{'id': parent_id}]

    try:
        file = service.files().insert(body=body).execute(http=decorator.http())

        return file
    except errors.HttpError, error:
        self.response.write("An error occured: " + str(error) + ", " +
Exemplo n.º 29
0
def webapp_add_wsgi_middleware(app):
    app = SessionMiddleware(app, cookie_key=COOKIE_KEY)
    return app
Exemplo n.º 30
0
def webapp_add_wsgi_middleware(app):
    app = SessionMiddleware(
        app, cookie_key="this is a random string for gf2 project")
    return app