2006年12月14日 星期四 14:58
看到这样一个Django 代码片段 from django.views.generic.create_update import create_object @login_required def create_vendor(request): return create_object(request, model = Vendor, post_save_redirect = '/vendor/list/' ) 其中@的用法是 django 特有的,还是python 的用法?
2006年12月14日 星期四 15:02
On 12/14/06, Ben Luo <benluo在gmail.com> wrote: > 看到这样一个Django 代码片段 > > from django.views.generic.create_update import create_object > > @login_required > def create_vendor(request): > return create_object(request, > model = Vendor, > post_save_redirect = '/vendor/list/' > ) > > 其中@的用法是 django 特有的,还是python 的用法? 是python 2.4新增的一个特性,叫decorator,网上有相关的资料,我的blog中也有描述可以查一查。 -- I like python! UliPad <>: http://wiki.woodpecker.org.cn/moin/UliPad My Blog: http://www.donews.net/limodou
2006年12月14日 星期四 15:06
On 12/14/06, Ben Luo <benluo在gmail.com> wrote: > 看到这样一个Django 代码片段 > > from django.views.generic.create_update import create_object > > @login_required > def create_vendor(request): > return create_object(request, > model = Vendor, > post_save_redirect = '/vendor/list/' > ) > > 其中@的用法是 django 特有的,还是python 的用法? http://www.python.org/dev/peps/pep-0318/ 读书笔记之 python2.4的新东西(1)函数和方法修饰符 http://python.cn/pipermail/python-chinese/2006-January/021109.html PEP 318函数和方法的修饰符 http://wiki.woodpecker.org.cn/moin/WeiZhong/DecoratorsInPython24 > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese -- '''Time is unimportant, only life important! blog@ http://blog.zoomquiet.org/pyblosxom/ wiki@ http://wiki.woodpecker.org.cn/moin/ZoomQuiet douban@ http://www.douban.com/people/zoomq/ ____________________________________ Please use OpenOffice.org to replace M$ office. http://zh.openoffice.org Please use 7-zip to replace WinRAR/WinZip. http://7-zip.org/zh-cn/ You can get the truely Freedom from software. '''
2006年12月14日 星期四 15:08
PythonÓï·¨£¬ÓÃÓÚÖض¨Ò庯ÊýÐÐΪ¡£¿ÉÒÔÔÚPython helpÀï²éѯ"Function definitions "¡£ 2006/12/14, Ben Luo <benluo在gmail.com>: > > ¿´µ½ÕâÑùÒ»¸öDjango ´úÂëƬ¶Î > > from django.views.generic.create_update import create_object > > @login_required > def create_vendor(request): > return create_object(request, > model = Vendor, > post_save_redirect = '/vendor/list/' > ) > > ÆäÖÐ@µÄÓ÷¨ÊÇ django ÌØÓеģ¬»¹ÊÇpython µÄÓ÷¨£¿ > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese -- »¶Ó·ÃÎÊ£º http://blog.csdn.net/ccat ÁõöÎ March.Liu -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20061214/915da7d3/attachment.htm
2006年12月14日 星期四 15:14
非常感谢! On 12/14/06, Zoom. Quiet <zoom.quiet在gmail.com> wrote: > On 12/14/06, Ben Luo <benluo在gmail.com> wrote: > > 看到这样一个Django 代码片段 > > > > from django.views.generic.create_update import create_object > > > > @login_required > > def create_vendor(request): > > return create_object(request, > > model = Vendor, > > post_save_redirect = '/vendor/list/' > > ) > > > > 其中@的用法是 django 特有的,还是python 的用法? > > http://www.python.org/dev/peps/pep-0318/ > 读书笔记之 python2.4的新东西(1)函数和方法修饰符 > http://python.cn/pipermail/python-chinese/2006-January/021109.html > PEP 318函数和方法的修饰符 > http://wiki.woodpecker.org.cn/moin/WeiZhong/DecoratorsInPython24 > > > _______________________________________________ > > python-chinese > > Post: send python-chinese在lists.python.cn > > Subscribe: send subscribe to python-chinese-request在lists.python.cn > > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > -- > '''Time is unimportant, only life important! > blog@ http://blog.zoomquiet.org/pyblosxom/ > wiki@ http://wiki.woodpecker.org.cn/moin/ZoomQuiet > douban@ http://www.douban.com/people/zoomq/ > ____________________________________ > Please use OpenOffice.org to replace M$ office. > http://zh.openoffice.org > Please use 7-zip to replace WinRAR/WinZip. > http://7-zip.org/zh-cn/ > You can get the truely Freedom from software. > ''' > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese
2006年12月14日 星期四 15:38
> > 看到这样一个Django 代码片段 > > from django.views.generic.create_update import create_object > > @login_required > def create_vendor(request): > return create_object(request, > model = Vendor, > post_save_redirect = '/vendor/list/' > ) > > 其中@的用法是 django 特有的,还是python 的用法? > 哎,其实一句话就可以说清楚了,呵呵: @decorater def func(...): pass 等价于: def func(...): pass func = decorater(func) -- http://codeplayer.blogspot.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://python.cn/pipermail/python-chinese/attachments/20061214/1989a78f/attachment.html
Zeuux © 2025
京ICP备05028076号