techchunks / bottlecbv Goto Github PK
View Code? Open in Web Editor NEWClass Based View for Bottle App
License: BSD 2-Clause "Simplified" License
Class Based View for Bottle App
License: BSD 2-Clause "Simplified" License
Custom Rule with a route decorator does not appear to work.
When i try :
@route("/endpoint/", method=["POST", "PUT"])
def mymethod_route_post(self):
from bottle import request
return "Custom Route %s" % request.method.upper()
It gets registered as :
GET : /music/mymethod-route-post/, Endpoint: Music:mymethod_route_post
And this gets 404 not found
/music/endpoint/
Hi,
Just wondering if you are still working on BottleCBV? If so, I will be sending over a few pull requests, if not, I would really like to take over development.
I've rewritten the route decorator to accept @route.get, @route.post etc - keeping backward compatibility with the existing decorator, and am in-process of moving the route discovery print statement to use a logging facility and introduce log levels, debug mode, etc.
I see a ton of potential with this project beyond using class based routing, ie optional OpenAPI support akin to Flask RestPlus, and unit tests.
In any capacity I think I can add quite a bit to this project.
I will submit a pull request or two once I've fully tested the code.
Let me know your thoughts!
If decorating an endpoint function with arguments, the arguments to the endpoint end up getting ignored.
This can be reproduced by decorating the "get" method in SingleDecoratorView in the test class:
@mydecorator
def get(self, val):
return "get:%s" % val
This will cause the test to fail since the endpoint gets registered as /singledecorator/ instead for /singledecorator//
As far as I can tell, this is because the introspection used in _get_interesting_members() returns the decorator function instead of the decorated function and in this case the decorator doesn't take any arguments.
I'm not sure if there's any way to fix this as I would assume there's no way to distinguish a decorated function from any other function, but I'm not skilled enough in Python to say that for sure.
If there isn't any work around this, I think it would be nice to document it, but it would be really nice if this could work since I really like the idea of class based views with bottle.py
Thanks a lot.
Getting an error using python3:
TypeError: unsupported operand type(s) for +: 'map' and 'list'
Suggested fix below: - not sure why adding [""]
def join_paths(*path_pieces):
"""Join parts of a url path"""
# Remove blank strings, and make sure everything is a string
cleaned_parts = map(str, filter(None, path_pieces))
# return "/".join(cleaned_parts + [""])
return "/".join(cleaned_parts)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.