- if argc == 1:
- template = None
- elif argc == 3 and argv[1] == 'using':
- template = unescape_string_literal(argv[2])
- else:
- raise TemplateSyntaxError(
- "Invalid syntax. Proper usage of this tag is: "
- "{% paginate [using \"TEMPLATE\"] %}")
- return PaginateNode(template)
+ template = None
+ window=DEFAULT_WINDOW
+ margin=DEFAULT_MARGIN
+ i = 1
+ while i < argc:
+ if argv[i] == 'using':
+ template = unescape_string_literal(argv[i + 1])
+ i += 2
+ elif argv[i] == 'window':
+ window = argv[i + 1]
+ i += 2
+ elif argv[i] == 'margin':
+ margin = argv[i + 1]
+ i += 2
+ else:
+ raise TemplateSyntaxError(
+ "Invalid syntax. Proper usage of this tag is: "
+ "{% paginate [using \"TEMPLATE\"] %}")
+ return PaginateNode(template, window, margin)