First, the view file: the views are stored in a folder with the same name 
as controller, but the view file is named after the controller function.
So you may have controllers/sales.py with a function def index():  and 
another function def search_orders(): 
therefore your application would responsd to URLs http://.../sales/  (handled 
by the index() function) and http://.../sales/search_orders 
you would therefore have views 
views/sales/index.html  
views/sales/search_orders.html


Now, the modules. Your example is perfectly syntactically correct *if* you 
had the module called sales.py as a direct child of the module directory.
But you are suggesting putting it a folder within the module directory. You 
should read about python imports if you want to do this. If you don't know 
how to do it and don't want to learn, just leave your modules in the 
modules folder and web2py will find it when you import it. 


I would also be hesitant to give the module name the same name as your 
controller name. Python uses the name of files for namespacing and this is 
bound to get confusing for you and for python. 
Perhaps call your module file mod_sales.py



On Tuesday, November 4, 2014 11:15:47 AM UTC+11, visuallinux wrote:
>
> Dear All.
>
> I need to add new features to my application like a modules; something 
> like purchases module, sales module, etc. 
> The idea is that each new module installed enable the respective option 
> menu. 
>
> My idea is to create folders within the folder modules such as sales 
> folder; inside are the * .py script of module sales, I hope understand me:
>
> ~application/foo/modules/sales/
>
> Also I take it that if I install a module that enables a choice of menu, 
> this script should be within their respective controllers; then you should 
> be:
>
> ~application/foo/controlllers/sales.py
>
> sales.py
> from sales import *
>
> So in sales.py module is the bussines logic.
>
> and
>
> ~application/foo/views/sales/sales.html
>
> Any suggestions or how i can do it or if someone show me an example.
> Excuse my english
>  
> Regards.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to