Changeset 35

Show
Ignore:
Timestamp:
02/09/08 19:41:07 (1 year ago)
Author:
nobu
Message:

fixed #12 object, object_listをobj, obj_listに変更。

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/blog/receivers.py

    r29 r35  
    155155        return 
    156156    c = Context({ 
    157         'object': instance, 
     157        'obj': instance, 
    158158        'site': Site.objects.get_current(), 
    159159    }) 
     
    169169        return 
    170170    c = Context({ 
    171         'object': instance, 
     171        'obj': instance, 
    172172        'site': Site.objects.get_current(), 
    173173    }) 
  • trunk/blog/templates/blog/_links.html

    r11 r35  
    33{% spaceless %} 
    44<ul class="link-list" id="{{ id }}"> 
    5     {% if object_list %} 
    6     {% for object in object_list %} 
     5    {% if obj_list %} 
     6    {% for obj in obj_list %} 
    77    <li> 
    88        <a 
    9             href="{{ object.get_absolute_url }}" 
    10             title="{{ object.count }} entries." 
    11         >{{ object }}</a> 
     9            href="{{ obj.get_absolute_url }}" 
     10            title="{{ obj.count }} entries." 
     11        >{{ obj }}</a> 
    1212    </li> 
    1313    {% endfor %} 
  • trunk/blog/templates/blog/_rdf.html

    r22 r35  
    44     xmlns:dc="http://purl.org/dc/elements/1.1/"> 
    55<rdf:Description 
    6     rdf:about="http://{{ SITE_DOMAIN }}{{ object.get_absolute_url }}" 
    7     trackback:ping="http://{{ SITE_DOMAIN }}{{ object.get_trackback_url }}" 
    8     dc:title="{{ object.title }}" 
    9     dc:identifier="http://{{ SITE_DOMAIN }}{{ object.get_absolute_url }}" 
    10     dc:date="{{ object.published_at|date:"Y-m-d\TH:i:s" }}+0900" /> 
     6    rdf:about="http://{{ SITE_DOMAIN }}{{ obj.get_absolute_url }}" 
     7    trackback:ping="http://{{ SITE_DOMAIN }}{{ obj.get_trackback_url }}" 
     8    dc:title="{{ obj.title }}" 
     9    dc:identifier="http://{{ SITE_DOMAIN }}{{ obj.get_absolute_url }}" 
     10    dc:date="{{ ob.published_at|date:"Y-m-d\TH:i:s" }}+0900" /> 
    1111</rdf:RDF> 
    1212--> 
  • trunk/blog/templates/blog/_tag_cloud.html

    r11 r35  
    22<h2>{{ title }}</h2> 
    33<ul class="cloud-list" id="{{ id }}"><!-- 
    4     {% if object_list %} 
    5     {% for object in object_list %} 
     4    {% if obj_list %} 
     5    {% for obj in obj_list %} 
    66    --><li> 
    77        <a 
    8             href="{{ object.get_absolute_url }}" 
    9             class="rank{{ object.rank }}{% if object.current %} current{% endif %}" 
    10             title="{{ object.count }} posts." 
    11         >{{ object }}</a> 
     8            href="{{ obj.get_absolute_url }}" 
     9            class="rank{{ obj.rank }}{% if obj.current %} current{% endif %}" 
     10            title="{{ obj.count }} posts." 
     11        >{{ obj }}</a> 
    1212    </li><!-- 
    1313    {% endfor %} 
  • trunk/blog/templates/blog/add_comment_mail.txt

    r28 r35  
    22{% trans "new comment has been added." %} 
    33 
    4 {% trans "ntry" %}: {{ object.entry }} 
    5 {% trans "name" %}: {{ object.name }} 
    6 {% trans "mail address" %}: {{ object.email }} 
    7 {% trans "URL" %}: {{ object.url }} 
    8 {% trans "created at" %}: {{ object.created_at|date:"Y/m/d H:i:s" }} 
     4{% trans "entry" %}: {{ obj.entry }} 
     5{% trans "name" %}: {{ obj.name }} 
     6{% trans "mail address" %}: {{ obj.email }} 
     7{% trans "URL" %}: {{ obj.url }} 
     8{% trans "created at" %}: {{ obj.created_at|date:"Y/m/d H:i:s" }} 
    99 
    10 http://{{ site.domain }}{{ object.get_absolute_url }} 
     10http://{{ site.domain }}{{ obj.get_absolute_url }} 
  • trunk/blog/templates/blog/add_trackback_mail.txt

    r28 r35  
    22{% trans "new track back has been added." %} 
    33 
    4 {% trans "entry" %}: {{ object.entry }} 
    5 {% trans "blog name" %}: {{ object.name }} 
    6 {% trans "title" %}: {{ object.email }} 
    7 {% trans "excerpt" %}: {{ object.url }} 
    8 {% trans "created at" %}: {{ object.created_at|date:"Y/m/d H:i:s" }} 
     4{% trans "entry" %}: {{ obj.entry }} 
     5{% trans "blog name" %}: {{ obj.name }} 
     6{% trans "title" %}: {{ obj.email }} 
     7{% trans "excerpt" %}: {{ obj.url }} 
     8{% trans "created at" %}: {{ obj.created_at|date:"Y/m/d H:i:s" }} 
    99 
    10 http://{{ site.domain }}{{ object.get_absolute_url }} 
     10http://{{ site.domain }}{{ obj.get_absolute_url }} 
  • trunk/blog/templates/blog/entry_detail.html

    r32 r35  
    33 
    44 
    5 {% block title %}{{ object.title }}{% endblock %} 
     5{% block title %}{{ obj.title }}{% endblock %} 
    66 
    77 
    88{% block mainContent %} 
    9 {% if object.is_published %}{% include "blog/_rdf.html" %}{% endif %} 
    10 <h2>{{ object.title }}</h2> 
     9{% if obj.is_published %}{% include "blog/_rdf.html" %}{% endif %} 
     10<h2>{{ obj.title }}</h2> 
    1111<div class="content-box"> 
    12     {{ object.description|restructuredtext:"3" }} 
     12    {{ obj.description|restructuredtext:"3" }} 
    1313    <div class="info"> 
    1414        <dl> 
    1515            <dt>{% trans "Posted at" %}:&nbsp;</dt> 
    16             {% if object.is_published %} 
    17             <dd>{{ object.published_at|date:"Y/m/d H:i:s" }}</dd> 
     16            {% if obj.is_published %} 
     17            <dd>{{ obj.published_at|date:"Y/m/d H:i:s" }}</dd> 
    1818            {% else %} 
    1919            <dd>{% trans "not published." %}</dd> 
     
    2222        <dl> 
    2323            <dt>{% trans "Tags" %}:&nbsp;</dt> 
    24             {% spaceless %}{% for tag in object.tags.all %} 
     24            {% spaceless %}{% for tag in obj.tags.all %} 
    2525            <dd><a href="{{ tag.get_absolute_url }}">{{ tag }}</a></dd> 
    2626            {% endfor %}{% endspaceless %} 
     
    2828        <dl> 
    2929            <dt>{% trans "Trackback" %}:&nbsp;</dt> 
    30             {% if object.is_published %} 
    31             <dd>http://{{ SITE_DOMAIN }}{{ object.get_trackback_url }}</dd> 
     30            {% if obj.is_published %} 
     31            <dd>http://{{ SITE_DOMAIN }}{{ obj.get_trackback_url }}</dd> 
    3232            {% else %} 
    3333            <dd>{% trans "not published." %}</dd> 
     
    3939<div id="trackbacks" class="content-box"> 
    4040    <h3>{% trans "TrackBack" %}</h3> 
    41     {% if object.trackbacks.count %} 
    42     {% for trackback in object.trackbacks %} 
     41    {% if obj.trackbacks %} 
     42    {% for trackback in obj.trackbacks %} 
    4343    <div class="response"> 
    4444        <h4> 
     
    6666<div id="comments" class="content-box"> 
    6767    <h3>{% trans "Comments" %}</h3> 
    68     {% if object.comments.count %} 
    69     {% for comment in object.comments %} 
     68    {% if obj.comments %} 
     69    {% for comment in obj.comments %} 
    7070    <div class="response"> 
    7171        {% if comment.url %} 
     
    9898<div id="comment-form" class="content-box"> 
    9999    <h3>{% trans "Add Comment" %}</h3> 
    100     <form action="{{ object.get_absolute_url }}#comment-form" method="post" accept-charset="utf-8"> 
     100    <form action="{{ obj.get_absolute_url }}#comment-form" method="post" accept-charset="utf-8"> 
    101101        <fieldset> 
    102102            <legend>{% trans "Add Comment" %}</legend> 
     
    166166 
    167167{% block subContent %} 
    168 {% tag_links object.tags.all %} 
     168{% tag_links obj.tags.all %} 
    169169{% endblock %} 
  • trunk/blog/templates/blog/entry_list.html

    r22 r35  
    77{% block mainContent %} 
    88<h2>{{ title }}</h2> 
    9 {% if object_list %} 
     9{% if obj_list %} 
    1010{% pagination paginator page PATH_INFO %} 
    11 {% for object in object_list %} 
     11{% for obj in obj_list %} 
    1212<div class="content-box"> 
    13 {% if object.is_published %}{% include "blog/_rdf.html" %}{% endif %} 
    14     <h3><a href="{{ object.get_absolute_url }}" title="{{ object.title }}">{{ object.title }}</a></h3> 
    15     {{ object.description|restructuredtext:"4" }} 
     13{% if obj.is_published %}{% include "blog/_rdf.html" %}{% endif %} 
     14    <h3><a href="{{ obj.get_absolute_url }}" title="{{ obj.title }}">{{ obj.title }}</a></h3> 
     15    {{ obj.description|restructuredtext:"4" }} 
    1616    <div class="info"> 
    1717        <dl> 
    1818            <dt>{% trans "Posted at" %}:&nbsp;</dt> 
    19             {% if object.is_published %} 
    20             <dd>{{ object.published_at|date:"Y/m/d H:i:s" }}</dd> 
     19            {% if obj.is_published %} 
     20            <dd>{{ obj.published_at|date:"Y/m/d H:i:s" }}</dd> 
    2121            {% else %} 
    2222            <dd>{% trans "not published." %}</dd> 
     
    2525        <dl> 
    2626            <dt>{% trans "Tags" %}:&nbsp;</dt> 
    27             {% spaceless %}{% for tag in object.tags.all %} 
     27            {% spaceless %}{% for tag in obj.tags.all %} 
    2828            <dd><a href="{{ tag.get_absolute_url }}">{{ tag }}</a></dd> 
    2929            {% endfor %}{% endspaceless %} 
     
    3131        <dl> 
    3232            <dt>{% trans "Trackback" %}:&nbsp;</dt> 
    33             {% if object.is_published %} 
    34             <dd>http://{{ SITE_DOMAIN }}{{ object.get_trackback_url }}</dd> 
     33            {% if obj.is_published %} 
     34            <dd>http://{{ SITE_DOMAIN }}{{ obj.get_trackback_url }}</dd> 
    3535            {% else %} 
    3636            <dd>{% trans "not published." %}</dd> 
  • trunk/blog/templatetags/blogutils.py

    r17 r35  
    106106    cursor = connection.cursor() 
    107107    cursor.execute(sql) 
    108     object_list = [] 
     108    obj_list = [] 
    109109    for count, year, month in cursor.fetchall(): 
    110         object_list.append(ArchiveLink(date=datetime.date(year, month, 1), 
    111                                        count=count)) 
     110        obj_list.append(ArchiveLink(date=datetime.date(year, month, 1), 
     111                                    count=count)) 
    112112    return { 
    113113        'title'         : u'Archives', 
    114114        'id'            : u'archive-list', 
    115         'object_list'   : object_list, 
     115        'obj_list'   : obj_list, 
    116116    } 
    117117 
     
    147147        currents = [] 
    148148    counts = [] 
    149     object_list = TagCloud() 
     149    obj_list = TagCloud() 
    150150    for label, cnt in cursor.fetchall(): 
    151151        counts.append(cnt) 
    152152        current = label in currents 
    153         object_list.append(TagLink(label=label, count=cnt, current=current)) 
     153        obj_list.append(TagLink(label=label, count=cnt, current=current)) 
    154154    counts.sort() 
    155155    try: 
    156         object_list.set_range(counts[0], counts[-1]) 
     156        obj_list.set_range(counts[0], counts[-1]) 
    157157    except IndexError: 
    158         object_list = [] 
     158        obj_list = [] 
    159159    return { 
    160         'title'         : u'Categories', 
    161         'id'            : u'tag-list', 
    162         'object_list'   : object_list, 
     160        'title'     : u'Categories', 
     161        'id'        : u'tag-list', 
     162        'obj_list'  : obj_list, 
    163163    } 
    164164 
  • trunk/blog/tests.py

    r34 r35  
    4949            context = response.context[0] 
    5050            #   check object_list. 
     51            self.assertTrue(context.has_key('obj_list')) 
     52            obj_list = context['obj_list'] 
    5153            if page is None: 
    5254                page = 1 
     
    5557            checked_list = Entry.objects.filter(is_published__exact=True)\ 
    5658                                        .filter(is_active__exact=True)[startswith:endswith] 
    57             object_list = context['object_list'] 
    58             self.assertEqual([o.id for o in object_list], [c.id for c in checked_list]) 
     59            self.assertEqual([o.id for o in obj_list], [c.id for c in checked_list]) 
    5960 
    6061 
     
    9394            context = response.context[0] 
    9495            #   check object_list. 
     96            self.assertTrue(context.has_key('obj_list')) 
     97            obj_list = context['obj_list'] 
    9598            if page is None: 
    9699                page = 1 
    97100            endswith = page * DEFAULT_PAGINATION_PER_PAGE 
    98101            startswith = endswith - DEFAULT_PAGINATION_PER_PAGE 
    99             object = Tag.objects.get(label__exact=tag) 
    100             checked_list = object.entry_set.filter(is_published__exact=True)\ 
    101                                            .filter(is_active__exact=True)[startswith:endswith] 
    102             object_list = context['object_list'] 
    103             self.assertEqual([o.id for o in object_list], [c.id for c in checked_list]) 
     102            obj = Tag.objects.get(label__exact=tag) 
     103            checked_list = obj.entry_set.filter(is_published__exact=True)\ 
     104                                        .filter(is_active__exact=True)[startswith:endswith] 
     105            self.assertEqual([o.id for o in obj_list], [c.id for c in checked_list]) 
    104106 
    105107 
     
    145147            context = response.context[0] 
    146148            #   check object_list 
    147             self.assertTrue(context.has_key('object_list')) 
     149            self.assertTrue(context.has_key('obj_list')) 
     150            obj_list = context['obj_list'] 
    148151            if page is None: 
    149152                page = 1 
     
    153156                                        .filter(is_published__exact=True)\ 
    154157                                        .filter(is_active__exact=True)[startswith:endswith] 
    155             object_list = context['object_list'] 
    156             self.assertEqual([o.id for o in object_list], [c.id for c in checked_list]) 
     158            self.assertEqual([o.id for o in obj_list], [c.id for c in checked_list]) 
    157159 
    158160 
     
    192194        context = response.context[0] 
    193195        #   check object. 
    194         self.assertTrue(context.has_key('object')) 
     196        self.assertTrue(context.has_key('obj')) 
    195197        ps = url[1:-1].split('/') 
    196198        checked = Entry.objects.get(published_at__year=ps[0], 
     
    200202                                    is_published__exact=True, 
    201203                                    is_active__exact=True) 
    202         self.assertEqual(context['object'], checked) 
     204        self.assertEqual(context['obj'], checked) 
    203205 
    204206 
     
    326328        context = response.context[0] 
    327329        #   ckeck object. 
    328         self.assertTrue(context.has_key('object')) 
     330        self.assertTrue(context.has_key('obj')) 
     331        obj = context['obj'] 
    329332        checked = Entry.objects.get(pk=1) 
    330         object = context['object'] 
    331         self.assertEqual(object, checked) 
     333        self.assertEqual(obj, checked) 
    332334 
    333335 
     
    388390            context = response.context[0] 
    389391            #   check object_list 
    390             self.assertTrue(context.has_key('object_list')) 
     392            self.assertTrue(context.has_key('obj_list')) 
     393            obj_list = context['obj_list'] 
    391394            if page is None: 
    392395                page = 1 
     
    399402                                                is_published__exact=True, 
    400403                                                is_active__exact=True)[startswith:endswith] 
    401             object_list = context['object_list'] 
    402             self.assertEqual([o.id for o in object_list], [c.id for c in checked_list]) 
     404            self.assertEqual([o.id for o in obj_list], [c.id for c in checked_list]) 
    403405 
    404406 
     
    433435            context = response.context[0] 
    434436            #   check object_list 
    435             self.assertTrue(context.has_key('object_list')) 
     437            self.assertTrue(context.has_key('obj_list')) 
     438            obj_list = context['obj_list'] 
    436439            if page is None: 
    437440                page = 1 
     
    443446                                                is_published__exact=True, 
    444447                                                is_active__exact=True)[startswith:endswith] 
    445             object_list = context['object_list'] 
    446             self.assertEqual([o.id for o in object_list], [c.id for c in checked_list]) 
     448            self.assertEqual([o.id for o in obj_list], [c.id for c in checked_list]) 
    447449 
    448450 
     
    477479            context = response.context[0] 
    478480            #   check object_list 
    479             self.assertTrue(context.has_key('object_list')) 
     481            self.assertTrue(context.has_key('obj_list')) 
     482            obj_list = context['obj_list'] 
    480483            if page is None: 
    481484                page = 1 
     
    486489                                                is_published__exact=True, 
    487490                                                is_active__exact=True)[startswith:endswith] 
    488             object_list = context['object_list'] 
    489             self.assertEqual([o.id for o in object_list], [c.id for c in checked_list]) 
     491            self.assertEqual([o.id for o in obj_list], [c.id for c in checked_list]) 
    490492             
    491493 
  • trunk/blog/urls.py

    r21 r35  
    2222        name='blog_archive_month'), 
    2323    url(r'^(?P<year>\d{4})/$', 'archive_year', name='blog_archive_year'), 
    24     url(r'^detail/(?P<object_id>\d+)/$', 'entry_from_id', name='blog_entry_from_id'), 
     24    url(r'^detail/(?P<obj_id>\d+)/$', 'entry_from_id', name='blog_entry_from_id'), 
    2525    url(r'^search/(?P<query>.+)/$', 'entry_search', name='blog_entry_search_keyword'), 
    2626    url(r'^search/$', 'entry_search', name='blog_entry_search_query'), 
  • trunk/blog/views.py

    r34 r35  
    2121    Show entry list. 
    2222    """ 
    23     object_list = Entry.objects.filter(is_published__exact=True)\ 
     23    obj_list = Entry.objects.filter(is_published__exact=True)\ 
    2424                               .filter(is_active__exact=True) 
    25     paginator = ObjectPaginator(object_list, DEFAULT_PAGINATION_PER_PAGE) 
    26     try: 
    27         page = int(request.GET.get('page', 1)) 
    28         object_list = paginator.get_page(page - 1) 
     25    paginator = ObjectPaginator(obj_list, DEFAULT_PAGINATION_PER_PAGE) 
     26    try: 
     27        page = int(request.GET.get('page', 1)) 
     28        obj_list = paginator.get_page(page - 1) 
    2929    except (InvalidPage, ValueError, IndexError): 
    3030        page = 1 
    31         object_list = [] 
     31        obj_list = [] 
    3232    c = Context(request, { 
    3333        'title'         : _(u'Latest entries'), 
    34         'object_list'   : object_list, 
     34        'obj_list'      : obj_list, 
    3535        'page'          : page, 
    3636        'paginator'     : paginator, 
     
    4444    """ 
    4545    try: 
    46         object = Tag.objects.get(label__iexact=label) 
     46        obj = Tag.objects.get(label__iexact=label) 
    4747    except Tag.DoesNotExist: 
    4848        raise Http404 
    49     object_list = object.entry_set.filter(is_published__exact=True)\ 
    50                                   .filter(is_active__exact=True) 
    51     paginator = ObjectPaginator(object_list, DEFAULT_PAGINATION_PER_PAGE) 
    52     try: 
    53         page = int(request.GET.get('page', 1)) 
    54         object_list = paginator.get_page(page - 1) 
    55     except (InvalidPage, ValueError): 
    56         page = 1 
    57         object_list = [] 
    58     c = Context(request, { 
    59         'title'         : _(u'Tag/%s') % object.label, 
    60         'current_tag'   : object
    61         'object_list'   : object_list, 
     49    obj_list = obj.entry_set.filter(is_published__exact=True)\ 
     50                            .filter(is_active__exact=True) 
     51    paginator = ObjectPaginator(obj_list, DEFAULT_PAGINATION_PER_PAGE) 
     52    try: 
     53        page = int(request.GET.get('page', 1)) 
     54        obj_list = paginator.get_page(page - 1) 
     55    except (InvalidPage, ValueError): 
     56        page = 1 
     57        obj_list = [] 
     58    c = Context(request, { 
     59        'title'         : _(u'Tag/%s') % obj.label, 
     60        'current_tag'   : obj
     61        'obj_list'      : obj_list, 
    6262        'page'          : page, 
    6363        'paginator'     : paginator, 
     
    7676            query = quote(query.encode('utf-8')) 
    7777            return HttpResponseRedirect(reverse('blog_entry_search_keyword', args=[query])) 
    78     object_list = [] 
     78    obj_list = [] 
    7979    encoded = unquote(query.encode('utf-8')) 
    8080    query = unicode(encoded, 'utf-8') 
    8181    if len(query): 
    82         object_list = Entry.objects.filter(description__search=u'*D+ %s' % query)\ 
    83                                    .filter(is_published__exact=True)\ 
    84                                    .filter(is_active__exact=True) 
    85     paginator = ObjectPaginator(object_list, DEFAULT_PAGINATION_PER_PAGE) 
    86     try: 
    87         page = int(request.GET.get('page', 1)) 
    88         object_list = paginator.get_page(page - 1) 
    89     except (InvalidPage, ValueError): 
    90         page = 1 
    91         object_list = [] 
     82        obj_list = Entry.objects.filter(description__search=u'*D+ %s' % query)\ 
     83                                .filter(is_published__exact=True)\ 
     84                                .filter(is_active__exact=True) 
     85    paginator = ObjectPaginator(obj_list, DEFAULT_PAGINATION_PER_PAGE) 
     86    try: 
     87        page = int(request.GET.get('page', 1)) 
     88        obj_list = paginator.get_page(page - 1) 
     89    except (InvalidPage, ValueError): 
     90        page = 1 
     91        obj_list = [] 
    9292    c = Context(request, { 
    9393        'title'         : _(u'Search/%s') % query, 
    94         'object_list'   : object_list, 
     94        'obj_list'      : obj_list, 
    9595        'query'         : query, 
    9696        'page'          : page, 
     
    101101 
    102102 
    103 def entry_from_id(request, object_id): 
     103def entry_from_id(request, obj_id): 
    104104    """ 
    105105    Show entry detail (login required). 
     
    108108        raise Http404 
    109109    try: 
    110         object = Entry.objects.get(pk=object_id) 
     110        obj = Entry.objects.get(pk=obj_id) 
    111111    except Entry.DoesNotExist: 
    112112        raise Http404 
    113113    c = Context(request, { 
    114         'object': object
     114        'obj': obj
    115115    }) 
    116116    t = loader.get_template('blog/entry_detail.html') 
     
    131131    ) 
    132132    try: 
    133         object = Entry.objects.filter(slug__exact=slug)\ 
    134                               .filter(published_at__range=date_range)\ 
    135                               .filter(is_published__exact=True)\ 
    136                               .get(is_active__exact=True) 
     133        obj = Entry.objects.filter(slug__exact=slug)\ 
     134                           .filter(published_at__range=date_range)\ 
     135                           .filter(is_published__exact=True)\ 
     136                           .get(is_active__exact=True) 
    137137    except Entry.DoesNotExist: 
    138138        raise Http404 
     
    142142        if form.is_valid(): 
    143143            comment = form.save(commit=False) 
    144             comment.entry = object 
     144            comment.entry = obj 
    145145            comment.save() 
    146146            return HttpResponseRedirect(comment.get_absolute_url()) 
     
    148148            status_code = 403 
    149149    c = Context(request, { 
    150         'object'    : object
    151         'form'      : form, 
     150        'obj'   : obj
     151        'form'  : form, 
    152152    }) 
    153153    t = loader.get_template('blog/entry_detail.html') 
     
    168168    ) 
    169169    try: 
    170         object = Entry.objects.filter(slug__exact=slug)\ 
    171                               .filter(published_at__range=date_range)\ 
    172                               .filter(is_published__exact=True)\ 
    173                               .get(is_active__exact=True) 
     170        obj = Entry.objects.filter(slug__exact=slug)\ 
     171                           .filter(published_at__range=date_range)\ 
     172                           .filter(is_published__exact=True)\ 
     173                           .get(is_active__exact=True) 
    174174    except Entry.DoesNotExist: 
    175175        raise Http404 
    176176    if request.method == 'GET': 
    177         return HttpResponseRedirect(object.get_absolute_url()) 
     177        return HttpResponseRedirect(obj.get_absolute_url()) 
    178178    data = request.POST.copy() 
    179     data.update({'entry': object.id}) 
     179    data.update({'entry': obj.id}) 
    180180    form = TrackBackForm(data) 
    181181    if form.is_valid(): 
     
    205205        datetime.datetime.combine(date, datetime.time.max), 
    206206    ) 
    207     object_list = Entry.objects.filter(published_at__range=date_range)\ 
    208                                .filter(is_published__exact=True)\ 
    209                                .filter(is_active__exact=True) 
    210     paginator = ObjectPaginator(object_list, DEFAULT_PAGINATION_PER_PAGE) 
    211     try: 
    212         page = int(request.GET.get('page', 1)) 
    213         object_list = paginator.get_page(page - 1) 
    214     except (InvalidPage, ValueError): 
    215         page = 1 
    216         object_list = [] 
    217     c = Context(request, { 
    218         'title'         : _(u'Archive@%s') % date.strftime('%Y/%m/%d'), 
    219         'object_list'   : object_list, 
    220         'page'          : page, 
    221         'paginator'     : paginator, 
     207    obj_list = Entry.objects.filter(published_at__range=date_range)\ 
     208                            .filter(is_published__exact=True)\ 
     209                            .filter(is_active__exact=True) 
     210    paginator = ObjectPaginator(obj_list, DEFAULT_PAGINATION_PER_PAGE) 
     211    try: 
     212        page = int(request.GET.get('page', 1)) 
     213        obj_list = paginator.get_page(page - 1) 
     214    except (InvalidPage, ValueError): 
     215        page = 1 
     216        obj_list = [] 
     217    c = Context(request, { 
     218        'title'     : _(u'Archive@%s') % date.strftime('%Y/%m/%d'), 
     219        'obj_list'  : obj_list, 
     220        'page'      : page, 
     221        'paginator' : paginator, 
    222222    }) 
    223223    t = loader.get_template('blog/entry_list.html') 
     
    243243        datetime.datetime.combine(lastday, datetime.time.max), 
    244244    ) 
    245     object_list = Entry.objects.filter(published_at__range=date_range)\ 
    246                                .filter(is_published__exact=True)\ 
    247                                .filter(is_active__exact=True) 
    248     paginator = ObjectPaginator(object_list, DEFAULT_PAGINATION_PER_PAGE) 
    249     try: 
    250         page = int(request.GET.get('page', 1)) 
    251         object_list = paginator.get_page(page - 1) 
    252     except (InvalidPage, ValueError): 
    253         page = 1 
    254         object_list = [] 
    255     c = Context(request, { 
    256         'title'         : _(u'Archive@%s') % firstday.strftime('%Y/%m'), 
    257         'object_list'   : object_list, 
    258         'page'          : page, 
    259         'paginator'     : paginator, 
     245    obj_list = Entry.objects.filter(published_at__range=date_range)\ 
     246                            .filter(is_published__exact=True)\ 
     247                            .filter(is_active__exact=True) 
     248    paginator = ObjectPaginator(obj_list, DEFAULT_PAGINATION_PER_PAGE) 
     249    try: 
     250        page = int(request.GET.get('page', 1)) 
     251        obj_list = paginator.get_page(page - 1) 
     252    except (InvalidPage, ValueError): 
     253        page = 1 
     254        obj_list = [] 
     255    c = Context(request, { 
     256        'title'     : _(u'Archive@%s') % firstday.strftime('%Y/%m'), 
     257        'obj_list'  : obj_list, 
     258        'page'      : page, 
     259        'paginator' : paginator, 
    260260    }) 
    261261    t = loader.get_template('blog/entry_list.html') 
     
    276276        datetime.datetime.combine(lastday, datetime.time.max), 
    277277    ) 
    278     object_list = Entry.objects.filter(published_at__range=date_range)\ 
    279                                .filter(is_published__exact=True)\ 
    280                                .filter(is_active__exact=True) 
    281     paginator = ObjectPaginator(object_list, DEFAULT_PAGINATION_PER_PAGE) 
    282     try: 
    283         page = int(request.GET.get('page', 1)) 
    284         object_list = paginator.get_page(page - 1) 
    285     except (InvalidPage, ValueError): 
    286         page = 1 
    287         object_list = [] 
    288     c = Context(request, { 
    289         'title'         : _(u'Archive@%s') % firstday.year, 
    290         'object_list'   : object_list, 
    291         'page'          : page, 
    292         'paginator'     : paginator, 
    293     }) 
    294     t = loader.get_template('blog/entry_list.html') 
    295     return HttpResponse(t.render(c)) 
     278    obj_list = Entry.objects.filter(published_at__range=date_range)\ 
     279                            .filter(is_published__exact=True)\ 
     280                            .filter(is_active__exact=True) 
     281    paginator = ObjectPaginator(obj_list, DEFAULT_PAGINATION_PER_PAGE) 
     282    try: 
     283        page = int(request.GET.get('page', 1)) 
     284        obj_list = paginator.get_page(page - 1) 
     285    except (InvalidPage, ValueError): 
     286        page = 1 
     287        obj_list = [] 
     288    c = Context(request, { 
     289        'title'     : _(u'Archive@%s') % firstday.year, 
     290        'obj_list'  : obj_list, 
     291        'page'      : page, 
     292        'paginator' : paginator, 
     293    }) 
     294    t = loader.get_template('blog/entry_list.html') 
     295    return HttpResponse(t.render(c)) 
  • trunk/common/templates/common/_navigation.html

    r15 r35  
    66    </li> 
    77    {% endifnotequal %} 
    8     {% if object_list.count %} 
    9     {% for object in object_list %} 
     8    {% if obj_list %} 
     9    {% for obj in obj_list %} 
    1010    <li> 
    11         {% ifequal PATH_INFO object.get_absolute_url %} 
    12         <a href="{{ object.get_absolute_url }}" class="current" title="{{ object }}">{{ object }}</a> 
     11        {% ifequal PATH_INFO obj.get_absolute_url %} 
     12        <a href="{{ obj.get_absolute_url }}" class="current" title="{{ obj }}">{{ obj }}</a> 
    1313        {% else %} 
    14         <a href="{{ object.get_absolute_url }}" title="{{ object }}">{{ object }}</a> 
     14        <a href="{{ obj.get_absolute_url }}" title="{{ obj }}">{{ obj }}</a> 
    1515        {% endifequal %} 
    1616    </li> 
  • trunk/common/templates/flatpages/default.html

    r20 r35  
    22{% load i18n blogutils markup %} 
    33 
    4 {% block title %}{{ object.title }}{% endblock %} 
     4{% block title %}{{ obj.title }}{% endblock %} 
    55 
    66{% block mainContent %} 
    77<div class="content-box"> 
    8     <h2>{{ object.title }}</h2> 
    9     {{ object.content|restructuredtext:3 }} 
     8    <h2>{{ obj.title }}</h2> 
     9    {{ obj.content|restructuredtext:3 }} 
    1010</div> 
    1111{% endblock %} 
  • trunk/common/templatetags/navigation.py

    r16 r35  
    1313    Create navigation. 
    1414    """ 
    15     object_list = FlatPage.objects.filter(navigation_enabled__exact=True)\ 
    16                                   .filter(is_published__exact=True)\ 
    17                                   .filter(is_active__exact=True) 
     15    obj_list = FlatPage.objects.filter(navigation_enabled__exact=True)\ 
     16                               .filter(is_published__exact=True)\ 
     17                               .filter(is_active__exact=True) 
    1818    return { 
    19         'PATH_INFO'     : path, 
    20         'object_list'   : object_list, 
     19        'PATH_INFO' : path, 
     20        'obj_list'  : obj_list, 
    2121    } 
  • trunk/common/tests.py

    r20 r35  
    7777        #   check context 
    7878        context = response.context[-1] 
    79         self.assertTrue(context.has_key('object')) 
    80         self.assertEqual(context['object'], checked) 
     79        self.assertTrue(context.has_key('obj')) 
     80        self.assertEqual(context['obj'], checked) 
    8181        #   send request (not published) 
    8282        response = self.client.get('/notpublished/') 
     
    102102        #   check context 
    103103        context = response.context[-1] 
    104         self.assertTrue(context.has_key('object')) 
    105         self.assertEqual(context['object'], checked) 
     104        self.assertTrue(context.has_key('obj')) 
     105        self.assertEqual(context['obj'], checked) 
  • trunk/common/views.py

    r34 r35  
    4141    try: 
    4242        if request.user.is_authenticated(): 
    43             object = queryset.get() 
     43            obj = queryset.get() 
    4444        else: 
    45             object = queryset.get(is_published__exact=True) 
     45            obj = queryset.get(is_published__exact=True) 
    4646    except FlatPage.DoesNotExist: 
    4747        raise Http404 
    48     if object.template_name: 
    49         t = loader.select_template((object.template_name, DEFAULT_TEMPLATE)) 
     48    if obj.template_name: 
     49        t = loader.select_template((obj.template_name, DEFAULT_TEMPLATE)) 
    5050    else: 
    5151        t = loader.get_template(DEFAULT_TEMPLATE) 
    5252    c = Context(request, { 
    53         'object': object
     53        'obj': obj
    5454    }) 
    5555    return HttpResponse(t.render(c))