New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bottle support? #141
Comments
Just for the record, this is mostly working for me right now (and I say mostly solely because I'm not too happy with the decorator - the adapter itself seems to be finished): from authomatic.adapters import BaseAdapter
from authomatic import Authomatic
from functools import wraps
from config import OAUTH2_CONFIG, OAUTH2_SIGNATURE
from bottle import request, response, redirect
from urlparse import urlunparse
authomatic = Authomatic(OAUTH2_CONFIG, OAUTH2_SIGNATURE)
def login(provider_name):
def decorator(func):
def wrapper(*args, **kwargs):
# we're using beaker sessions here
if 'user' not in request.session:
result = authomatic.login(BottleAdapter(request, response), provider_name)
if result:
if result.user:
result.user.update()
request.session['user'] = result.user.email
request.session.save()
return func(*args, **kwargs)
return wrapper
return decorator
class BottleAdapter(BaseAdapter):
"""Adapter for the |bottle|_ framework."""
def __init__(self, request, response):
"""
:param request:
A |bottle|_ :class:`Request` instance.
:param response:
A |bottle|_ :class:`Response` instance.
"""
self.request = request
self.response = response
#===========================================================================
# Request
#===========================================================================
@property
def url(self):
return urlunparse(self.request.urlparts[0:3] + (None, None, None))
@property
def params(self):
return dict(self.request.params)
@property
def cookies(self):
return dict(self.request.cookies)
#===========================================================================
# Response
#===========================================================================
def write(self, value):
self.response.write(value)
def set_header(self, key, value):
self.response.headers[key] = str(value)
def set_status(self, status):
self.response.status = status |
After several years of inactivity, We are now reviewing all issues and PRs and hoping to begin work to solve as many of these as possible. We are keen to find out which issues still apply, and which PRs are still required/are likely to merge cleanly into the current code. We are aiming to review them all, but any help with prioritisation would be very useful! If you are still interested in having this issue/PR resolved, or are able to help us work on it, please reply to this message. That way we know which issues are most important to the community. |
I'd love to see this folded into core, since I use either Sanic or Bottle as the core of most of my Python web apps and |
@rcarmo Are you able to provide a pull request and check then if it works? We are a volunteer driven project. If merged we can release a 1.1.0 with the new feature soon. |
I can give it a try, sure. I just need to figure out conventions and testing.
… On 28 Nov 2019, at 14:22, Jens W. Klein ***@***.***> wrote:
@rcarmo Are you able to provide a pull request and check then if it works? We are a volunteer drive project. If merged we can release a 1.1.0 with the new feature soon.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Hi - thanks for getting back in touch! I'll explain a bit about how the testing currently works, since it's pretty complicated (and a bit fragile), and you can decide whether to run screaming or not :) Each framework (Django, Flask etc) has a test app contained in Frameworks are controlled via the liveandletdie module (also an The list of frameworks to run is held in For each listed framework, the test suite starts it (via So the steps to developing tests for a new framework are:
Step 1 should be relatively easy if you are already familiar with Step 2 we can help with - I've done some work on Step 3 is easy - and only applies once the code is close to merging (since we need a branch on |
Hi there,
I'm trying to get this to work with Bottle, but would like to know if there are plans for supporting it officially.
Cheers!
The text was updated successfully, but these errors were encountered: