Discussion:
[bottlepy] Structuring in an OO approach using Bottle, and not BottleCBV
Mono
2015-01-13 23:42:36 UTC
Permalink
Briefly, I am having this issue from structuring in an OO manner in Python3.

Here's the problem I am having in using Bottle or even Flask.

...
The problem somewhat comes from my approach in doing things with objects -
but there is a little reason behind it.

...
I can make a class as such and it works fine:

class NavigateService (BottleView, BaseObject):

@route('/todo')
def todo():
return ("Hello, ToDo")

def initiateServices(self):
run(host='0.0.0.0', port=5000)

...
While I can initiate NavigateService from another object so that I can pass
it BaseObject ...

I cannot seem to have self in the todo function - even though it is part of
the object.

The only reason I need that is when I initiate NavigateService with
BaseObject - I have several config params in BaseObject that I need to
access in the functions (todo, ... other routes).

...
The thing is it is not a classic webapp but a web browser for a set of
config files and DBMS. Thus the BaseObject has those that I needed to
access.


I know there is BottleCBV and also for Flask there is Flask-Classy - but I
needed to try and do this as simply as possible for now as I try a few
things out.

Just thought there must be some way to do that.

...
Thank you for your help.

Mono
--
--
You are member of the "bottlepy" group at google groups.
See http://groups.google.de/group/bottlepy for mailing list options.
See http://bottlepy.org/ for news and documentation.

---
You received this message because you are subscribed to the Google Groups "bottlepy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bottlepy+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...