Django

Code

Changeset 2451

Show
Ignore:
Timestamp:
02/28/06 21:21:51 (3 years ago)
Author:
adrian
Message:

magic-removal: Merged to [2450]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/magic-removal/django/contrib/admin/media/js/admin/RelatedObjectLookups.js

    r2421 r2451  
    44function showRelatedObjectLookupPopup(triggeringLink) { 
    55    var name = triggeringLink.id.replace(/^lookup_/, ''); 
    6     var href 
     6    var href; 
    77    if (triggeringLink.href.search(/\?/) >= 0) { 
    88        href = triggeringLink.href + '&pop=1'; 
    99    } else { 
    10         href = triggeringLink.href + '?pop=1' 
     10        href = triggeringLink.href + '?pop=1'; 
    1111    } 
    1212    var win = window.open(href, name, 'height=500,width=740,resizable=yes,scrollbars=yes'); 
     
    3434 
    3535function dismissAddAnotherPopup(win, newId, newRepr) { 
    36     var name = win.name.replace(/___/g, '.') 
     36    var name = win.name.replace(/___/g, '.'); 
    3737    var elem = document.getElementById(name); 
    3838    if (elem) { 
    3939        if (elem.nodeName == 'SELECT') { 
    4040            var o = new Option(newRepr, newId); 
    41             elem.options[elem.options.length] = o 
     41            elem.options[elem.options.length] = o; 
    4242            elem.selectedIndex = elem.length - 1; 
    4343        } else if (elem.nodeName == 'INPUT') { 
  • django/branches/magic-removal/django/contrib/admin/media/js/calendar.js

    r1539 r2451  
    103103    this.currentMonth = this.today.getMonth() + 1; 
    104104    this.currentYear = this.today.getFullYear(); 
    105     this.drawCurrent = function() { 
     105
     106Calendar.prototype = { 
     107    drawCurrent: function() { 
    106108        CalendarNamespace.draw(this.currentMonth, this.currentYear, this.div_id, this.callback); 
    107     } 
    108     this.drawDate = function(month, year) { 
     109    }, 
     110    drawDate: function(month, year) { 
    109111        this.currentMonth = month; 
    110112        this.currentYear = year; 
    111113        this.drawCurrent(); 
    112     } 
    113     this.drawPreviousMonth = function() { 
     114    }, 
     115    drawPreviousMonth: function() { 
    114116        if (this.currentMonth == 1) { 
    115117            this.currentMonth = 12; 
     
    120122        } 
    121123        this.drawCurrent(); 
    122     } 
    123     this.drawNextMonth = function() { 
     124    }, 
     125    drawNextMonth: function() { 
    124126        if (this.currentMonth == 12) { 
    125127            this.currentMonth = 1; 
     
    130132        } 
    131133        this.drawCurrent(); 
    132     } 
    133     this.drawPreviousYear = function() { 
     134    }, 
     135    drawPreviousYear: function() { 
    134136        this.currentYear--; 
    135137        this.drawCurrent(); 
    136     } 
    137     this.drawNextYear = function() { 
     138    }, 
     139    drawNextYear: function() { 
    138140        this.currentYear++; 
    139141        this.drawCurrent(); 
  • django/branches/magic-removal/django/contrib/admin/media/js/core.js

    r453 r2451  
    7171    if (obj.offsetParent) { 
    7272        while (obj.offsetParent) { 
    73             curleft += obj.offsetLeft 
     73            curleft += obj.offsetLeft; 
    7474            obj = obj.offsetParent; 
    7575        } 
     
    8484    if (obj.offsetParent) { 
    8585        while (obj.offsetParent) { 
    86             curtop += obj.offsetTop 
     86            curtop += obj.offsetTop; 
    8787            obj = obj.offsetParent; 
    8888        } 
     
    131131// ---------------------------------------------------------------------------- 
    132132String.prototype.pad_left = function(pad_length, pad_string) { 
    133     new_string = this; 
     133    var new_string = this; 
    134134    for (var i = 0; new_string.length < pad_length; i++) { 
    135135        new_string = pad_string + new_string; 
  • django/branches/magic-removal/django/contrib/admin/media/js/dateparse.js

    r1559 r2451  
    55 
    66/* Finds the index of the first occurence of item in the array, or -1 if not found */ 
    7 Array.prototype.indexOf = function(item) { 
    8     for (var i = 0; i < this.length; i++) { 
    9         if (this[i] == item) { 
    10             return i; 
    11         } 
    12     } 
    13     return -1; 
    14 }; 
     7if (typeof Array.prototype.indexOf == 'undefined') { 
     8    Array.prototype.indexOf = function(item) { 
     9        var len = this.length; 
     10        for (var i = 0; i < len; i++) { 
     11            if (this[i] == item) { 
     12                return i; 
     13            } 
     14        } 
     15        return -1; 
     16    }; 
     17
    1518/* Returns an array of items judged 'true' by the passed in test function */ 
    16 Array.prototype.filter = function(test) { 
    17     var matches = []; 
    18     for (var i = 0; i < this.length; i++) { 
    19         if (test(this[i])) { 
    20             matches[matches.length] = this[i]; 
    21         } 
    22     } 
    23     return matches; 
    24 }; 
     19if (typeof Array.prototype.filter == 'undefined') { 
     20    Array.prototype.filter = function(test) { 
     21        var matches = []; 
     22        var len = this.length; 
     23        for (var i = 0; i < len; i++) { 
     24            if (test(this[i])) { 
     25                matches[matches.length] = this[i]; 
     26            } 
     27        } 
     28        return matches; 
     29    }; 
     30
    2531 
    2632var monthNames = gettext("January February March April May June July August September October November December").split(" "); 
  • django/branches/magic-removal/django/db/backends/mysql/base.py

    r2422 r2451  
    112112    # MySQL doesn't support DATE_TRUNC, so we fake it by subtracting intervals. 
    113113    # If you know of a better way to do this, please file a Django ticket. 
     114    # Note that we can't use DATE_FORMAT directly because that causes the output 
     115    # to be a string rather than a datetime object, and we need MySQL to return 
     116    # a date so that it's typecasted properly into a Python datetime object. 
    114117    subtractions = ["interval (DATE_FORMAT(%s, '%%%%s')) second - interval (DATE_FORMAT(%s, '%%%%i')) minute - interval (DATE_FORMAT(%s, '%%%%H')) hour" % (field_name, field_name, field_name)] 
    115118    if lookup_type in ('year', 'month'): 
  • django/branches/magic-removal/django/views/debug.py

    r2421 r2451  
    256256      hideAll(getElementsByClassName(document, 'ol', 'pre-context')); 
    257257      hideAll(getElementsByClassName(document, 'ol', 'post-context')); 
     258      hideAll(getElementsByClassName(document, 'div', 'pastebin')); 
    258259    } 
    259260    function toggle() { 
     
    272273      var darr = String.fromCharCode(0x25bc); 
    273274      s.innerHTML = s.innerHTML == uarr ? darr : uarr; 
     275      return false; 
     276    } 
     277    function switchPastebinFriendly(link) { 
     278      s1 = "Switch to copy-and-paste view"; 
     279      s2 = "Switch back to interactive view"; 
     280      link.innerHTML = link.innerHTML == s1 ? s2 : s1; 
     281      toggle('browserTraceback', 'pastebinTraceback'); 
    274282      return false; 
    275283    } 
     
    342350<div id="traceback"> 
    343351  <h2>Traceback <span>(innermost last)</span></h2> 
    344   <ul class="traceback"> 
    345     {% for frame in frames %} 
    346       <li class="frame"> 
    347         <code>{{ frame.filename }}</code> in <code>{{ frame.function }}</code> 
    348  
    349         {% if frame.context_line %} 
    350           <div class="context" id="c{{ frame.id }}"> 
    351             {% if frame.pre_context %} 
    352               <ol start="{{ frame.pre_context_lineno|add:"1" }}" class="pre-context" id="pre{{ frame.id }}">{% for line in frame.pre_context %}<li onclick="toggle('pre{{ frame.id }}', 'post{{ frame.id }}')">{{ line|escape }}</li>{% endfor %}</ol> 
    353             {% endif %} 
    354             <ol start="{{ frame.lineno|add:"1" }}" class="context-line"><li onclick="toggle('pre{{ frame.id }}', 'post{{ frame.id }}')">{{ frame.context_line|escape }} <span>...</span></li></ol> 
    355             {% if frame.post_context %} 
    356               <ol start='{{ frame.lineno|add:"2" }}' class="post-context" id="post{{ frame.id }}">{% for line in frame.post_context %}<li onclick="toggle('pre{{ frame.id }}', 'post{{ frame.id }}')">{{ line|escape }}</li>{% endfor %}</ol> 
    357             {% endif %} 
    358           </div> 
    359         {% endif %} 
    360  
    361         {% if frame.vars %} 
    362           <div class="commands"> 
    363               <a href="#" onclick="return varToggle(this, '{{ frame.id }}')"><span>&#x25b6;</span> Local vars</a> 
    364           </div> 
    365           <table class="vars" id="v{{ frame.id }}"> 
    366             <thead> 
    367               <tr> 
    368                 <th>Variable</th> 
    369                 <th>Value</th> 
    370               </tr> 
    371             </thead> 
    372             <tbody> 
    373               {% for var in frame.vars|dictsort:"0" %} 
     352  <div class="commands"><a href="#" onclick="return switchPastebinFriendly(this);">Switch to copy-and-paste view</a></div> 
     353  <br/> 
     354  <div id="browserTraceback"> 
     355    <ul class="traceback"> 
     356      {% for frame in frames %} 
     357        <li class="frame"> 
     358          <code>{{ frame.filename }}</code> in <code>{{ frame.function }}</code> 
     359 
     360          {% if frame.context_line %} 
     361            <div class="context" id="c{{ frame.id }}"> 
     362              {% if frame.pre_context %} 
     363                <ol start="{{ frame.pre_context_lineno|add:"1" }}" class="pre-context" id="pre{{ frame.id }}">{% for line in frame.pre_context %}<li onclick="toggle('pre{{ frame.id }}', 'post{{ frame.id }}')">{{ line|escape }}</li>{% endfor %}</ol> 
     364              {% endif %} 
     365              <ol start="{{ frame.lineno|add:"1" }}" class="context-line"><li onclick="toggle('pre{{ frame.id }}', 'post{{ frame.id }}')">{{ frame.context_line|escape }} <span>...</span></li></ol> 
     366              {% if frame.post_context %} 
     367                <ol start='{{ frame.lineno|add:"2" }}' class="post-context" id="post{{ frame.id }}">{% for line in frame.post_context %}<li onclick="toggle('pre{{ frame.id }}', 'post{{ frame.id }}')">{{ line|escape }}</li>{% endfor %}</ol> 
     368              {% endif %} 
     369            </div> 
     370          {% endif %} 
     371 
     372          {% if frame.vars %} 
     373            <div class="commands"> 
     374                <a href="#" onclick="return varToggle(this, '{{ frame.id }}')"><span>&#x25b6;</span> Local vars</a> 
     375            </div> 
     376            <table class="vars" id="v{{ frame.id }}"> 
     377              <thead> 
    374378                <tr> 
    375                   <td>{{ var.0 }}</td
    376                   <td class="code"><div>{{ var.1|pprint|escape }}</div></td
     379                  <th>Variable</th
     380                  <th>Value</th
    377381                </tr> 
    378               {% endfor %} 
    379             </tbody> 
    380           </table> 
    381         {% endif %} 
    382       </li> 
    383     {% endfor %} 
    384   </ul> 
     382              </thead> 
     383              <tbody> 
     384                {% for var in frame.vars|dictsort:"0" %} 
     385                  <tr> 
     386                    <td>{{ var.0 }}</td> 
     387                    <td class="code"><div>{{ var.1|pprint|escape }}</div></td> 
     388                  </tr> 
     389                {% endfor %} 
     390              </tbody> 
     391            </table> 
     392          {% endif %} 
     393        </li> 
     394      {% endfor %} 
     395    </ul> 
     396  </div> 
     397  <div id="pastebinTraceback" class="pastebin"> 
     398    <table> 
     399      <tbody> 
     400        <tr> 
     401          <td> 
     402            <code> 
     403Traceback (most recent call last):<br/> 
     404{% for frame in frames %} 
     405  File "{{ frame.filename }}" in {{ frame.function }}<br/> 
     406  {% if frame.context_line %} 
     407    &nbsp;&nbsp;{{ frame.lineno|add:"1" }}. {{ frame.context_line|escape }}<br/> 
     408  {% endif %} 
     409{% endfor %}<br/> 
     410&nbsp;&nbsp;{{ exception_type }} at {{ request.path }}<br/> 
     411&nbsp;&nbsp;{{ exception_value|escape }}</code> 
     412          </td> 
     413        </tr> 
     414      </tbody> 
     415    </table> 
     416  </div> 
    385417</div> 
    386418 
  • django/branches/magic-removal/ez_setup.py

    r1961 r2451  
    1515""" 
    1616import sys 
    17 DEFAULT_VERSION = "0.6a9
     17DEFAULT_VERSION = "0.6a10
    1818DEFAULT_URL     = "http://cheeseshop.python.org/packages/%s/s/setuptools/" % sys.version[:3] 
    1919 
     
    2323    'setuptools-0.6a1-py2.3.egg': 'ee819a13b924d9696b0d6ca6d1c5833d', 
    2424    'setuptools-0.6a1-py2.4.egg': '8256b5f1cd9e348ea6877b5ddd56257d', 
     25    'setuptools-0.6a10-py2.3.egg': '162d8357f1aff2b0349c6c247ee62987', 
     26    'setuptools-0.6a10-py2.4.egg': '803a2d8db501c1ac3b5b6fb4e907f788', 
     27    'setuptools-0.6a10dev_r42346-py2.3.egg': 'a7899272cfceb6aa60094ae8928b8077', 
     28    'setuptools-0.6a10dev_r42346-py2.4.egg': '5d42a64adca9aedb409f83ecf22156a5', 
    2529    'setuptools-0.6a2-py2.3.egg': 'b98da449da411267c37a738f0ab625ba', 
    2630    'setuptools-0.6a2-py2.4.egg': 'be5b88bc30aed63fdefd2683be135c3b', 
     
    124128you may need to enable firewall access for this script first. 
    125129I will start the download in %d seconds. 
     130 
     131(Note: if this machine does not have network access, please obtain the file 
     132 
     133   %s 
     134 
     135and place it in this directory before rerunning this script.) 
    126136---------------------------------------------------------------------------""", 
    127                     version, download_base, delay 
     137                    version, download_base, delay, url 
    128138                ); from time import sleep; sleep(delay) 
    129139            log.warn("Downloading %s", url)