Thanks all for help :-)
I believe
[quote]
Why don't you make a method in your controller, like:
def common_info(self, page, **kw):
user = sefl.user
info = dict(page=page,
username = user.user_name,
phoneinfo = self.phoneInfo,
phonelist = PhoneInfo.GetPhoneList(user),
codeleft = GetCodeLeft(user),
phonename = PhoneInfo.GetPhoneName(
user=useruser, imei=self.phoneInfo.IMEI))
info.update(kw)
return info
And then in your exposed controller method, you can write:
...
return self.common_info('rename')
or
...
return self.common_info('otherpage', moreinfo='etc')
[/quote]
is the most suitable way for me.
Thanks again for all your kindly help!
----------
Regards,
Lingfeng Xiong
“六岁至十二岁之学龄儿童,一律受基本教育,免纳学费。其贫苦者,由政府供给
书籍。已逾学龄未受基本教育之国民,一律受补习教育,免纳学费,其书籍亦由政
府供给。”
-- 《中华民国宪法》
On 100/11/3 上午 03:40, Christoph Zwerschke wrote:
Am 31.10.2011 09:43, schrieb Lingfeng Xiong:
In the example above, most of the parametered are common, such as
'username', 'codeleft' and 'phonelist'. Is there anyway for me to
shorten my return line? Thanks.
Why don't you make a method in your controller, like:
def common_info(self, page, **kw):
user = sefl.user
info = dict(page=page,
username = user.user_name,
phoneinfo = self.phoneInfo,
phonelist = PhoneInfo.GetPhoneList(user),
codeleft = GetCodeLeft(user),
phonename = PhoneInfo.GetPhoneName(
user=useruser, imei=self.phoneInfo.IMEI))
info.update(kw)
return info
And then in your exposed controller method, you can write:
...
return self.common_info('rename')
or
...
return self.common_info('otherpage', moreinfo='etc')
Also, you can use the add_global_tmpl_vars function in lib.helpers to
provide info that will be available in *all* templates globally.
-- Christoph
--
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en.