librelist archives

« back to archive

Can I have two same name function in different module

Can I have two same name function in different module

From:
Simon Li
Date:
2010-07-16 @ 09:50
Hi Guys,

I have two moduel name admin.py and frontend.py ,and each module has the
function named index() and route are  @admin.route('/') and
@frontend.route('/')

and register them as below:
*app.register_module(admin,url_prefix='/admin')
app.register_module(frontend)

*but  when i access the url http://localhost:5000/ or
http://localhost:5000/admin/, it always to frontend index function, please
help, many thanks.*
*
-- 
Best Regards
-Simon
===========================
msn:simonli@live.com <msn%3Asimonli@live.com>
skype:simonli999

Re: [flask] Can I have two same name function in different module

From:
Stephane Wirtel
Date:
2010-07-16 @ 10:04
Yes, you can

Why ?
On 07/16/2010 11:50 AM, Simon Li wrote:
> Hi Guys,
> 
> I have two moduel name admin.py and frontend.py ,and each module has the
> function named index() and route are  @admin.route('/') and
> @frontend.route('/')
> 
> and register them as below:
> /app.register_module(admin,url_prefix='/admin')
> app.register_module(frontend)
> 
> /but  when i access the url http://localhost:5000/ or
> http://localhost:5000/admin/, it always to frontend index function,
> please help, many thanks./
> /
> -- 
> Best Regards
> -Simon
> ===========================
> msn:simonli@live.com <mailto:msn%3Asimonli@live.com>
> skype:simonli999

Re: [flask] Can I have two same name function in different module

From:
Dan Jacob
Date:
2010-07-16 @ 10:08
What happens when you do:

app.register_module(frontend, url_prefix="")


On 16 July 2010 11:04, Stephane Wirtel <stephane@wirtel.be> wrote:
> Yes, you can
>
> Why ?
> On 07/16/2010 11:50 AM, Simon Li wrote:
>> Hi Guys,
>>
>> I have two moduel name admin.py and frontend.py ,and each module has the
>> function named index() and route are  @admin.route('/') and
>> @frontend.route('/')
>>
>> and register them as below:
>> /app.register_module(admin,url_prefix='/admin')
>> app.register_module(frontend)
>>
>> /but  when i access the url http://localhost:5000/ or
>> http://localhost:5000/admin/, it always to frontend index function,
>> please help, many thanks./
>> /
>> --
>> Best Regards
>> -Simon
>> ===========================
>> msn:simonli@live.com <mailto:msn%3Asimonli@live.com>
>> skype:simonli999
>
>

Re: [flask] Can I have two same name function in different module

From:
Simon Li
Date:
2010-07-16 @ 16:01
Hi,

in http://flask.pocoo.org/docs/patterns/packages/
Modules and Resources section

how to register these two views?


On Fri, Jul 16, 2010 at 6:08 PM, Dan Jacob <danjac354@gmail.com> wrote:

> What happens when you do:
>
> app.register_module(frontend, url_prefix="")
>
>
> On 16 July 2010 11:04, Stephane Wirtel <stephane@wirtel.be> wrote:
> > Yes, you can
> >
> > Why ?
> > On 07/16/2010 11:50 AM, Simon Li wrote:
> >> Hi Guys,
> >>
> >> I have two moduel name admin.py and frontend.py ,and each module has the
> >> function named index() and route are  @admin.route('/') and
> >> @frontend.route('/')
> >>
> >> and register them as below:
> >> /app.register_module(admin,url_prefix='/admin')
> >> app.register_module(frontend)
> >>
> >> /but  when i access the url http://localhost:5000/ or
> >> http://localhost:5000/admin/, it always to frontend index function,
> >> please help, many thanks./
> >> /
> >> --
> >> Best Regards
> >> -Simon
> >> ===========================
> >> msn:simonli@live.com <msn%3Asimonli@live.com> <mailto:
> msn%3Asimonli@live.com <msn%253Asimonli@live.com>>
> >> skype:simonli999
> >
> >
>



-- 
Best Regards
-Simon
===========================
msn:simonli@live.com <msn%3Asimonli@live.com>
skype:simonli999

Re: [flask] Can I have two same name function in different module

From:
Thadeus Burgess
Date:
2010-07-27 @ 05:47
The modules and resources section also confuses me. It is not obvious
how to use this pattern.
--
Thadeus





On Fri, Jul 16, 2010 at 11:01 AM, Simon Li <simonli.lb@gmail.com> wrote:
> Hi,
>
> in http://flask.pocoo.org/docs/patterns/packages/
>
> Modules and Resources section
>
> how to register these two views?
>
>
> On Fri, Jul 16, 2010 at 6:08 PM, Dan Jacob <danjac354@gmail.com> wrote:
>>
>> What happens when you do:
>>
>> app.register_module(frontend, url_prefix="")
>>
>>
>> On 16 July 2010 11:04, Stephane Wirtel <stephane@wirtel.be> wrote:
>> > Yes, you can
>> >
>> > Why ?
>> > On 07/16/2010 11:50 AM, Simon Li wrote:
>> >> Hi Guys,
>> >>
>> >> I have two moduel name admin.py and frontend.py ,and each module has
>> >> the
>> >> function named index() and route are  @admin.route('/') and
>> >> @frontend.route('/')
>> >>
>> >> and register them as below:
>> >> /app.register_module(admin,url_prefix='/admin')
>> >> app.register_module(frontend)
>> >>
>> >> /but  when i access the url http://localhost:5000/ or
>> >> http://localhost:5000/admin/, it always to frontend index function,
>> >> please help, many thanks./
>> >> /
>> >> --
>> >> Best Regards
>> >> -Simon
>> >> ===========================
>> >> msn:simonli@live.com <mailto:msn%3Asimonli@live.com>
>> >> skype:simonli999
>> >
>> >
>
>
>
> --
> Best Regards
> -Simon
> ===========================
> msn:simonli@live.com
> skype:simonli999
>