Django

Code

Changeset 2388

Show
Ignore:
Timestamp:
02/24/06 23:53:55 (3 years ago)
Author:
adrian
Message:

magic-removal: Merged to [2387]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/magic-removal/django/contrib/admin/templates/admin_doc/bookmarklets.html

    r1522 r2388  
    1717 
    1818<div id="content-main"> 
    19     <h3><a href="javascript:(function(){if(typeof ActiveXObject!='undefined'){x=new ActiveXObject('Microsoft.XMLHTTP')}else if(typeof XMLHttpRequest!='undefined'){x=new XMLHttpRequest()}else{return;}x.open('HEAD',location.href,false);x.send(null);try{view=x.getResponseHeader('x-view');}catch(e){alert('No view found for this page');return;}if(view=="undefined"){alert("No view found for this page");}document.location='{{ admin_url }}doc/views/'+view+'/';})()">{% trans "Documentation for this page" %}</a></h3> 
     19    <h3><a href="javascript:(function(){if(typeof ActiveXObject!='undefined'){x=new ActiveXObject('Microsoft.XMLHTTP')}else if(typeof XMLHttpRequest!='undefined'){x=new XMLHttpRequest()}else{return;}x.open('HEAD',location.href,false);x.send(null);try{view=x.getResponseHeader('x-view');}catch(e){alert('No view found for this page');return;}if(view=='undefined'){alert('No view found for this page');}document.location='{{ admin_url }}doc/views/'+view+'/';})()">{% trans "Documentation for this page" %}</a></h3> 
    2020    <p>{% trans "Jumps you from any page to the documentation for the view that generates that page." %}</p> 
    2121 
  • django/branches/magic-removal/django/core/cache/backends/db.py

    r2378 r2388  
    22 
    33from django.core.cache.backends.base import BaseCache 
    4 from django.core.db import db, DatabaseError 
     4from django.db import connection 
    55import base64, time 
    66from datetime import datetime 
     
    2626 
    2727    def get(self, key, default=None): 
    28         cursor = db.cursor() 
     28        cursor = connection.cursor() 
    2929        cursor.execute("SELECT cache_key, value, expires FROM %s WHERE cache_key = %%s" % self._table, [key]) 
    3030        row = cursor.fetchone() 
     
    3434        if row[2] < now: 
    3535            cursor.execute("DELETE FROM %s WHERE cache_key = %%s" % self._table, [key]) 
    36             db.commit() 
     36            connection.commit() 
    3737            return default 
    3838        return pickle.loads(base64.decodestring(row[1])) 
     
    4141        if timeout is None: 
    4242            timeout = self.default_timeout 
    43         cursor = db.cursor() 
     43        cursor = connection.cursor() 
    4444        cursor.execute("SELECT COUNT(*) FROM %s" % self._table) 
    4545        num = cursor.fetchone()[0] 
     
    5959            pass 
    6060        else: 
    61             db.commit() 
     61            connection.commit() 
    6262 
    6363    def delete(self, key): 
    64         cursor = db.cursor() 
     64        cursor = connection.cursor() 
    6565        cursor.execute("DELETE FROM %s WHERE cache_key = %%s" % self._table, [key]) 
    66         db.commit() 
     66        connection.commit() 
    6767 
    6868    def has_key(self, key): 
    69         cursor = db.cursor() 
     69        cursor = connection.cursor() 
    7070        cursor.execute("SELECT cache_key FROM %s WHERE cache_key = %%s" % self._table, [key]) 
    7171        return cursor.fetchone() is not None 
  • django/branches/magic-removal/django/utils/timesince.py

    r1862 r2388  
    1717      (60, lambda n: ngettext('minute', 'minutes', n)) 
    1818    ) 
     19    # Convert datetime.date to datetime.datetime for comparison 
     20    if d.__class__ is not datetime.datetime: 
     21        d = datetime.datetime(d.year, d.month, d.day) 
    1922    if now: 
    2023        t = now.timetuple() 
     
    2629        tz = None 
    2730    now = datetime.datetime(t[0], t[1], t[2], t[3], t[4], t[5], tzinfo=tz) 
    28      
     31 
    2932    # ignore microsecond part of 'd' since we removed it from 'now' 
    3033    delta = now - (d - datetime.timedelta(0, 0, d.microsecond)) 
  • django/branches/magic-removal/docs/cache.txt

    r2339 r2388  
    3434                                    them with semicolons. 
    3535 
     36                                    This backend requires the 
     37                                    `Python memcached bindings`_. 
     38 
    3639    db://tablename/                 A database backend in a table named 
    3740                                    "tablename". This table should be created 
     
    8386 
    8487.. _memcached: http://www.danga.com/memcached/ 
     88.. _Python memcached bindings: ftp://ftp.tummy.com/pub/python-memcached/ 
    8589 
    8690The per-site cache 
  • django/branches/magic-removal/tests/othertests/defaultfilters.py

    r1947 r2388  
    238238'1 day' 
    239239 
     240# datetime.date compataibility with timesince 
     241>>> timesince(datetime.date.today() - datetime.timedelta(1)) 
     242'1 day, 23 hours' 
     243 
    240244>>> default("val", "default") 
    241245'val'