2007年04月30日 星期一 23:03
源代码如下
#code=utf-8
from django import template
register = template.Library()
def sayhi(value):
"add ',hi' to all strnig"
return value+",hi"
register.filter('hi', sayhi)
class CalendarNode(template.Node):
def __init__(self,inputstring):
self.inputstring = inputstring
def render(self, context):
return self.inputstring
def do_calendar(parser, token):---只要给这个方法添加任何行都会提示下边的那个错误。
ddd = token ---如果把这行注销掉,就不会有错的样子。直接return CalendarNode(token)就不会有错误。
return CalendarNode(ddd)
register.tag('calendar', do_calendar)
IndentationError at /
unindent does not match any outer indentation level (MyCalendar.py,
line 21) Request
Method: GET Request URL: http://127.0.0.1:8000/ Exception Type:
IndentationError Exception Value: unindent does not match any outer
indentation level (MyCalendar.py, line 21) Exception Location:
c:\python25\Lib\site-packages\django\template\__init__.py
in get_library, line 904
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://python.cn/pipermail/python-chinese/attachments/20070430/874c2fc4/attachment.htm
2007年04月30日 星期一 23:22
´íÎó˵ÊÇËõ½ü´í¡£½¨Òé¶à¿´´íÎóÌáʾ¡£ -- I like python! UliPad <>: http://wiki.woodpecker.org.cn/moin/UliPad My Blog: http://www.donews.net/limodou -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20070430/085328f3/attachment.html
Zeuux © 2025
京ICP备05028076号