Code Monkey home page Code Monkey logo

bottlecbv's People

Contributors

adeelyounas avatar daniellbastos avatar freevryheid avatar homecoder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

bottlecbv's Issues

Custom Rule can add by using `route` decorator e.g, ( Does not appear to work)

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/

Still working on BottleCBV?

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!

Unable to decorate a function with arguments

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.

error running example on front page

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.