Repository: dcramer/django-debug-toolbar Branch: master Commit: bf39bb03a077 Files: 97 Total size: 762.0 KB Directory structure: gitextract_prxbugz0/ ├── .gitignore ├── AUTHORS ├── LICENSE ├── MANIFEST.in ├── NEWS ├── README.rst ├── debug_toolbar/ │ ├── __init__.py │ ├── locale/ │ │ ├── de/ │ │ │ └── LC_MESSAGES/ │ │ │ ├── django.mo │ │ │ └── django.po │ │ ├── en/ │ │ │ └── LC_MESSAGES/ │ │ │ ├── django.mo │ │ │ └── django.po │ │ ├── es/ │ │ │ └── LC_MESSAGES/ │ │ │ ├── django.mo │ │ │ └── django.po │ │ ├── fr/ │ │ │ └── LC_MESSAGES/ │ │ │ ├── django.mo │ │ │ └── django.po │ │ ├── he/ │ │ │ └── LC_MESSAGES/ │ │ │ ├── django.mo │ │ │ └── django.po │ │ └── ru/ │ │ └── LC_MESSAGES/ │ │ ├── django.mo │ │ └── django.po │ ├── management/ │ │ ├── __init__.py │ │ └── commands/ │ │ ├── __init__.py │ │ └── debugsqlshell.py │ ├── media/ │ │ └── debug_toolbar/ │ │ ├── Makefile │ │ ├── css/ │ │ │ └── toolbar.css │ │ └── js/ │ │ ├── jquery.cookie.js │ │ ├── jquery.js │ │ └── toolbar.js │ ├── middleware.py │ ├── models.py │ ├── panels/ │ │ ├── __init__.py │ │ ├── cache.py │ │ ├── headers.py │ │ ├── logger.py │ │ ├── profiling.py │ │ ├── request_vars.py │ │ ├── settings_vars.py │ │ ├── signals.py │ │ ├── sql.py │ │ ├── template.py │ │ ├── timer.py │ │ └── version.py │ ├── runtests.py │ ├── templates/ │ │ └── debug_toolbar/ │ │ ├── base.html │ │ ├── panels/ │ │ │ ├── cache.html │ │ │ ├── headers.html │ │ │ ├── logger.html │ │ │ ├── profiling.html │ │ │ ├── request_vars.html │ │ │ ├── settings_vars.html │ │ │ ├── signals.html │ │ │ ├── sql.html │ │ │ ├── sql_explain.html │ │ │ ├── sql_profile.html │ │ │ ├── sql_select.html │ │ │ ├── template_source.html │ │ │ ├── templates.html │ │ │ ├── timer.html │ │ │ └── versions.html │ │ └── redirect.html │ ├── tests/ │ │ ├── __init__.py │ │ ├── templates/ │ │ │ └── 404.html │ │ ├── tests.py │ │ ├── urls.py │ │ └── views.py │ ├── toolbar/ │ │ ├── __init__.py │ │ └── loader.py │ ├── urls.py │ ├── utils/ │ │ ├── __init__.py │ │ ├── compat/ │ │ │ ├── __init__.py │ │ │ └── db.py │ │ ├── sqlparse/ │ │ │ ├── __init__.py │ │ │ ├── engine/ │ │ │ │ ├── __init__.py │ │ │ │ ├── filter.py │ │ │ │ └── grouping.py │ │ │ ├── filters.py │ │ │ ├── formatter.py │ │ │ ├── keywords.py │ │ │ ├── lexer.py │ │ │ ├── sql.py │ │ │ └── tokens.py │ │ └── tracking/ │ │ ├── __init__.py │ │ └── db.py │ └── views.py ├── example/ │ ├── __init__.py │ ├── manage.py │ ├── media/ │ │ └── js/ │ │ ├── jquery.js │ │ ├── mootools.js │ │ └── prototype.js │ ├── settings.py │ ├── templates/ │ │ ├── admin/ │ │ │ └── login.html │ │ ├── index.html │ │ ├── jquery/ │ │ │ └── index.html │ │ ├── mootools/ │ │ │ └── index.html │ │ └── prototype/ │ │ └── index.html │ └── urls.py ├── setup.cfg └── setup.py ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ *.pyc *.DS_Store *~ django_debug_toolbar.egg-info ================================================ FILE: AUTHORS ================================================ The Django Debug Toolbar was original created by Rob Hudson in August 2008. The following is a list of much appreciated contributors: Reto Aebersold Andi Albrecht Chris Beaven Kenneth Belitzky Loic Bistuer Etienne Carrier David Cramer Michael Elsdoerfer Augie Fackler Dan Fairs Alex Gaynor Idan Gazit Matt George Adam Gomaa Daniel Hahler Jacob Kaplan-Moss Russell Keith-Magee Mikhail Korobov Arthur Koziel Jannis Leidel Martin Maney Percy Perez-Pinedo Nowell Strite Malcolm Tredinnick Bryan Veloso Simon Willison Diego Búrigo Zacarão Philip Zeyliger ================================================ FILE: LICENSE ================================================ Copyright (c) Rob Hudson and individual contributors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of Django nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================ FILE: MANIFEST.in ================================================ include AUTHORS include LICENSE include README.rst recursive-include debug_toolbar/media * recursive-include debug_toolbar/templates * ================================================ FILE: NEWS ================================================ News for django-debug-toolbar ============================= 0.8.5 (2011 Apr 25) ------------------- * Ensure if we're overriding the urlconf that we're resetting handler404/500. * Updated middleware logic to avoid work if content-type isn't right. * Change .load() calls to GET to avoid CSRF protection. * Updated SQL panel to match Django's which now includes logging. * Added basic multi-db support. * Some HTML validation fixes. * Added support for `executemany`. Thanks to postal2600. * Added support for LogBook. Thanks to Vincent Driessen. * Added clean_params method to DatabaseStatTracker to scrub non-unicode data for displaying on the sql panel. Thanks to Matthew J Morrison 0.8.4 (2010 Nov 8) ------------------ * Added print style to hide the toolbar (issue 90) * Fixed "Badly formatted SQL query plan" (issue 86) * Fixed "SQL not selectable due to line chart" (issue 85) * Fixed "Redirect page does not set cookie" (issue 6) * Fixed template block inheritance bug (issues 77 and 97). * Fixed flash of unstyled toolbar. * Updated to work with old TEMPLATE_LOADERS settings from < 1.2. * Updated to stop template loader iteration when template is found. (Note: NEWS was started after the 0.8.3 release and is not complete) ================================================ FILE: README.rst ================================================ ==================== Django Debug Toolbar ==================== The Django Debug Toolbar is a configurable set of panels that display various debug information about the current request/response and when clicked, display more details about the panel's content. Currently, the following panels have been written and are working: - Django version - Request timer - A list of settings in settings.py - Common HTTP headers - GET/POST/cookie/session variable display - Templates and context used, and their template paths - SQL queries including time to execute and links to EXPLAIN each query - List of signals, their args and receivers - Logging output via Python's built-in logging, or via the `logbook `_ module There is also one Django management command currently: - `debugsqlshell`: Outputs the SQL that gets executed as you work in the Python interactive shell. (See example below) If you have ideas for other panels please let us know. Installation ============ #. Add the `debug_toolbar` directory to your Python path. #. Add the following middleware to your project's `settings.py` file: ``'debug_toolbar.middleware.DebugToolbarMiddleware',`` Tying into middleware allows each panel to be instantiated on request and rendering to happen on response. The order of MIDDLEWARE_CLASSES is important: the Debug Toolbar middleware must come after any other middleware that encodes the response's content (such as GZipMiddleware). Note: The debug toolbar will only display itself if the mimetype of the response is either `text/html` or `application/xhtml+xml` and contains a closing `` tag. Note: Be aware of middleware ordering and other middleware that may intercept requests and return responses. Putting the debug toolbar middleware *after* the Flatpage middleware, for example, means the toolbar will not show up on flatpages. #. Make sure your IP is listed in the `INTERNAL_IPS` setting. If you are working locally this will be: INTERNAL_IPS = ('127.0.0.1',) Note: This is required because of the built-in requirements of the `show_toolbar` method. See below for how to define a method to determine your own logic for displaying the toolbar. #. Add `debug_toolbar` to your `INSTALLED_APPS` setting so Django can find the template files associated with the Debug Toolbar. Alternatively, add the path to the debug toolbar templates (``'path/to/debug_toolbar/templates'`` to your ``TEMPLATE_DIRS`` setting.) Configuration ============= The debug toolbar has two settings that can be set in `settings.py`: #. Optional: Add a tuple called `DEBUG_TOOLBAR_PANELS` to your ``settings.py`` file that specifies the full Python path to the panel that you want included in the Toolbar. This setting looks very much like the `MIDDLEWARE_CLASSES` setting. For example:: DEBUG_TOOLBAR_PANELS = ( 'debug_toolbar.panels.version.VersionDebugPanel', 'debug_toolbar.panels.timer.TimerDebugPanel', 'debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel', 'debug_toolbar.panels.headers.HeaderDebugPanel', 'debug_toolbar.panels.request_vars.RequestVarsDebugPanel', 'debug_toolbar.panels.template.TemplateDebugPanel', 'debug_toolbar.panels.sql.SQLDebugPanel', 'debug_toolbar.panels.signals.SignalDebugPanel', 'debug_toolbar.panels.logger.LoggingPanel', ) You can change the ordering of this tuple to customize the order of the panels you want to display, or add/remove panels. If you have custom panels you can include them in this way -- just provide the full Python path to your panel. #. Optional: There are a few configuration options to the debug toolbar that can be placed in a dictionary: * `INTERCEPT_REDIRECTS`: If set to True (default), the debug toolbar will show an intermediate page upon redirect so you can view any debug information prior to redirecting. This page will provide a link to the redirect destination you can follow when ready. If set to False, redirects will proceed as normal. * `SHOW_TOOLBAR_CALLBACK`: If not set or set to None, the debug_toolbar middleware will use its built-in show_toolbar method for determining whether the toolbar should show or not. The default checks are that DEBUG must be set to True and the IP of the request must be in INTERNAL_IPS. You can provide your own method for displaying the toolbar which contains your custom logic. This method should return True or False. * `EXTRA_SIGNALS`: An array of custom signals that might be in your project, defined as the python path to the signal. * `HIDE_DJANGO_SQL`: If set to True (the default) then code in Django itself won't be shown in SQL stacktraces. * `SHOW_TEMPLATE_CONTEXT`: If set to True (the default) then a template's context will be included with it in the Template debug panel. Turning this off is useful when you have large template contexts, or you have template contexts with lazy datastructures that you don't want to be evaluated. * `TAG`: If set, this will be the tag to which debug_toolbar will attach the debug toolbar. Defaults to 'body'. Example configuration:: def custom_show_toolbar(request): return True # Always show toolbar, for example purposes only. DEBUG_TOOLBAR_CONFIG = { 'INTERCEPT_REDIRECTS': False, 'SHOW_TOOLBAR_CALLBACK': custom_show_toolbar, 'EXTRA_SIGNALS': ['myproject.signals.MySignal'], 'HIDE_DJANGO_SQL': False, 'TAG': 'div', } `debugsqlshell` =============== The following is sample output from running the `debugsqlshell` management command. Each ORM call that results in a database query will be beautifully output in the shell:: $ ./manage.py debugsqlshell Python 2.6.1 (r261:67515, Jul 7 2009, 23:51:51) [GCC 4.2.1 (Apple Inc. build 5646)] on darwin Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) >>> from page.models import Page >>> ### Lookup and use resulting in an extra query... >>> p = Page.objects.get(pk=1) SELECT "page_page"."id", "page_page"."number", "page_page"."template_id", "page_page"."description" FROM "page_page" WHERE "page_page"."id" = 1 >>> print p.template.name SELECT "page_template"."id", "page_template"."name", "page_template"."description" FROM "page_template" WHERE "page_template"."id" = 1 Home >>> ### Using select_related to avoid 2nd database call... >>> p = Page.objects.select_related('template').get(pk=1) SELECT "page_page"."id", "page_page"."number", "page_page"."template_id", "page_page"."description", "page_template"."id", "page_template"."name", "page_template"."description" FROM "page_page" INNER JOIN "page_template" ON ("page_page"."template_id" = "page_template"."id") WHERE "page_page"."id" = 1 >>> print p.template.name Home TODOs and BUGS ============== See: https://github.com/django-debug-toolbar/django-debug-toolbar/issues ================================================ FILE: debug_toolbar/__init__.py ================================================ VERSION = (0, 8, 5) __version__ = '.'.join(map(str, VERSION)) ================================================ FILE: debug_toolbar/locale/de/LC_MESSAGES/django.po ================================================ # Django Debug Toolbar auf Deutsch. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # Jannis Leidel, 2009. # # msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2009-11-18 08:06-0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: panels/cache.py:92 #, python-format msgid "Cache: %.2fms" msgstr "" #: panels/cache.py:95 msgid "Cache Usage" msgstr "" #: panels/headers.py:36 panels/headers.py:39 msgid "HTTP Headers" msgstr "" #: panels/logger.py:56 msgid "Logging" msgstr "Logging" #: panels/logger.py:63 #, fuzzy msgid "Log Messages" msgstr "Nachricht" #: panels/request_vars.py:13 panels/request_vars.py:16 msgid "Request Vars" msgstr "" #: panels/settings_vars.py:16 msgid "Settings" msgstr "Einstellungen" #: panels/settings_vars.py:19 #, python-format msgid "Settings from %s" msgstr "" #: panels/signals.py:39 panels/signals.py:42 msgid "Signals" msgstr "Signals" #: panels/sql.py:146 msgid "SQL" msgstr "" #: panels/sql.py:160 msgid "SQL Queries" msgstr "" #: panels/template.py:47 msgid "Templates" msgstr "Templates" #: panels/template.py:52 #, python-format msgid "Templates (%(num_templates)s rendered)" msgstr "" #: panels/timer.py:35 templates/debug_toolbar/panels/cache.html:39 #: templates/debug_toolbar/panels/logger.html:7 #: templates/debug_toolbar/panels/sql.html:5 #: templates/debug_toolbar/panels/sql_explain.html:11 #: templates/debug_toolbar/panels/sql_profile.html:12 #: templates/debug_toolbar/panels/sql_select.html:11 msgid "Time" msgstr "Zeit" #: panels/timer.py:47 #, fuzzy msgid "Resource Usage" msgstr "Ressource" #: panels/timer.py:78 msgid "User CPU time" msgstr "" #: panels/timer.py:79 msgid "System CPU time" msgstr "" #: panels/timer.py:80 #, fuzzy msgid "Total CPU time" msgstr "Zeit gesamt" #: panels/timer.py:81 msgid "Elapsed time" msgstr "" #: panels/timer.py:82 msgid "Context switches" msgstr "" #: panels/version.py:20 panels/version.py:29 #, fuzzy msgid "Versions" msgstr "Django-Version" #: templates/debug_toolbar/base.html:23 msgid "Hide Toolbar" msgstr "" #: templates/debug_toolbar/base.html:23 msgid "Hide" msgstr "Verbergen" #: templates/debug_toolbar/base.html:48 msgid "Show Toolbar" msgstr "" #: templates/debug_toolbar/base.html:54 msgid "Close" msgstr "Schließen" #: templates/debug_toolbar/redirect.html:7 #: templates/debug_toolbar/panels/logger.html:9 msgid "Location" msgstr "Ort" #: templates/debug_toolbar/redirect.html:9 msgid "" "The Django Debug Toolbar has intercepted a redirect to the above URL for " "debug viewing purposes. You can click the above link to continue with the " "redirect as normal. If you'd like to disable this feature, set the " "DEBUG_TOOLBAR_CONFIG dictionary's key " "INTERCEPT_REDIRECTS to False." msgstr "" #: templates/debug_toolbar/panels/cache.html:14 msgid "Total Calls" msgstr "Aufrufe gesamt" #: templates/debug_toolbar/panels/cache.html:16 msgid "Total Time" msgstr "Zeit gesamt" #: templates/debug_toolbar/panels/cache.html:18 msgid "Hits" msgstr "Aufrufe" #: templates/debug_toolbar/panels/cache.html:20 msgid "Misses" msgstr "" #: templates/debug_toolbar/panels/cache.html:35 msgid "Breakdown" msgstr "" #: templates/debug_toolbar/panels/cache.html:40 msgid "Type" msgstr "Typ" #: templates/debug_toolbar/panels/cache.html:41 msgid "Parameters" msgstr "Parameter" #: templates/debug_toolbar/panels/cache.html:42 msgid "Function" msgstr "Funktion" #: templates/debug_toolbar/panels/headers.html:5 msgid "Key" msgstr "Schlüssel" #: templates/debug_toolbar/panels/headers.html:6 #: templates/debug_toolbar/panels/request_vars.html:37 #: templates/debug_toolbar/panels/request_vars.html:63 #: templates/debug_toolbar/panels/request_vars.html:85 #: templates/debug_toolbar/panels/request_vars.html:107 #: templates/debug_toolbar/panels/settings_vars.html:6 #: templates/debug_toolbar/panels/timer.html:10 msgid "Value" msgstr "Wert" #: templates/debug_toolbar/panels/logger.html:6 msgid "Level" msgstr "Niveau" #: templates/debug_toolbar/panels/logger.html:8 msgid "Message" msgstr "Nachricht" #: templates/debug_toolbar/panels/logger.html:24 msgid "No messages logged" msgstr "Keine Nachricht gespeichert" #: templates/debug_toolbar/panels/request_vars.html:3 msgid "View information" msgstr "" #: templates/debug_toolbar/panels/request_vars.html:7 #, fuzzy msgid "View Function" msgstr "Funktion" #: templates/debug_toolbar/panels/request_vars.html:8 msgid "args" msgstr "" #: templates/debug_toolbar/panels/request_vars.html:9 msgid "kwargs" msgstr "" #: templates/debug_toolbar/panels/request_vars.html:27 #, fuzzy msgid "COOKIES Variables" msgstr "Variable" #: templates/debug_toolbar/panels/request_vars.html:36 #: templates/debug_toolbar/panels/request_vars.html:62 #: templates/debug_toolbar/panels/request_vars.html:84 #: templates/debug_toolbar/panels/request_vars.html:106 msgid "Variable" msgstr "Variable" #: templates/debug_toolbar/panels/request_vars.html:50 msgid "No COOKIE data" msgstr "Keine COOKIE-Daten" #: templates/debug_toolbar/panels/request_vars.html:53 #, fuzzy msgid "SESSION Variables" msgstr "Variable" #: templates/debug_toolbar/panels/request_vars.html:76 msgid "No SESSION data" msgstr "Keine SESSION-Daten" #: templates/debug_toolbar/panels/request_vars.html:79 #, fuzzy msgid "GET Variables" msgstr "Variable" #: templates/debug_toolbar/panels/request_vars.html:98 msgid "No GET data" msgstr "Keine GET-Daten" #: templates/debug_toolbar/panels/request_vars.html:101 #, fuzzy msgid "POST Variables" msgstr "Variable" #: templates/debug_toolbar/panels/request_vars.html:120 msgid "No POST data" msgstr "Keine POST-Daten" #: templates/debug_toolbar/panels/settings_vars.html:5 msgid "Setting" msgstr "Einstellung" #: templates/debug_toolbar/panels/signals.html:5 msgid "Signal" msgstr "Signal" #: templates/debug_toolbar/panels/signals.html:6 msgid "Providing Args" msgstr "" #: templates/debug_toolbar/panels/signals.html:7 msgid "Receivers" msgstr "" #: templates/debug_toolbar/panels/sql.html:6 msgid "Action" msgstr "Aktion" #: templates/debug_toolbar/panels/sql.html:7 msgid "Stacktrace" msgstr "" #: templates/debug_toolbar/panels/sql.html:8 msgid "Query" msgstr "" #: templates/debug_toolbar/panels/sql.html:38 msgid "Line" msgstr "Zeile" #: templates/debug_toolbar/panels/sql.html:39 msgid "Method" msgstr "Methode" #: templates/debug_toolbar/panels/sql.html:40 msgid "File" msgstr "Datei" #: templates/debug_toolbar/panels/sql_explain.html:3 #: templates/debug_toolbar/panels/sql_profile.html:3 #: templates/debug_toolbar/panels/sql_select.html:3 #: templates/debug_toolbar/panels/template_source.html:3 msgid "Back" msgstr "Zurück" #: templates/debug_toolbar/panels/sql_explain.html:4 msgid "SQL Explained" msgstr "" #: templates/debug_toolbar/panels/sql_explain.html:9 #: templates/debug_toolbar/panels/sql_profile.html:10 #: templates/debug_toolbar/panels/sql_select.html:9 msgid "Executed SQL" msgstr "Ausgeführtes SQL" #: templates/debug_toolbar/panels/sql_profile.html:4 msgid "SQL Profiled" msgstr "" #: templates/debug_toolbar/panels/sql_profile.html:35 msgid "Error" msgstr "Fehler" #: templates/debug_toolbar/panels/sql_select.html:4 msgid "SQL Selected" msgstr "" #: templates/debug_toolbar/panels/sql_select.html:34 msgid "Empty set" msgstr "Leeres Set" #: templates/debug_toolbar/panels/template_source.html:4 #, fuzzy msgid "Template Source" msgstr "Template" #: templates/debug_toolbar/panels/templates.html:2 #, fuzzy msgid "Template path" msgstr "Template" #: templates/debug_toolbar/panels/templates.html:13 msgid "Template" msgstr "Template" #: templates/debug_toolbar/panels/templates.html:21 #: templates/debug_toolbar/panels/templates.html:37 msgid "Toggle Context" msgstr "" #: templates/debug_toolbar/panels/templates.html:28 #: templates/debug_toolbar/panels/templates.html:43 msgid "None" msgstr "Nichts" #: templates/debug_toolbar/panels/templates.html:31 msgid "Context processor" msgstr "" #: templates/debug_toolbar/panels/timer.html:9 msgid "Resource" msgstr "Ressource" #: templates/debug_toolbar/panels/versions.html:6 msgid "Package" msgstr "" #: templates/debug_toolbar/panels/versions.html:7 #, fuzzy msgid "Version" msgstr "Django-Version" ================================================ FILE: debug_toolbar/locale/en/LC_MESSAGES/django.po ================================================ # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # Percy Pérez-Pinedo, 2009. # # msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2009-11-18 08:06-0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: panels/cache.py:92 #, python-format msgid "Cache: %.2fms" msgstr "" #: panels/cache.py:95 msgid "Cache Usage" msgstr "" #: panels/headers.py:36 panels/headers.py:39 msgid "HTTP Headers" msgstr "" #: panels/logger.py:56 msgid "Logging" msgstr "" #: panels/logger.py:63 msgid "Log Messages" msgstr "" #: panels/request_vars.py:13 panels/request_vars.py:16 msgid "Request Vars" msgstr "" #: panels/settings_vars.py:16 msgid "Settings" msgstr "" #: panels/settings_vars.py:19 #, python-format msgid "Settings from %s" msgstr "" #: panels/signals.py:39 panels/signals.py:42 msgid "Signals" msgstr "" #: panels/sql.py:146 msgid "SQL" msgstr "" #: panels/sql.py:160 msgid "SQL Queries" msgstr "" #: panels/template.py:47 msgid "Templates" msgstr "" #: panels/template.py:52 #, python-format msgid "Templates (%(num_templates)s rendered)" msgstr "" #: panels/timer.py:35 templates/debug_toolbar/panels/cache.html:39 #: templates/debug_toolbar/panels/logger.html:7 #: templates/debug_toolbar/panels/sql.html:5 #: templates/debug_toolbar/panels/sql_explain.html:11 #: templates/debug_toolbar/panels/sql_profile.html:12 #: templates/debug_toolbar/panels/sql_select.html:11 msgid "Time" msgstr "" #: panels/timer.py:47 msgid "Resource Usage" msgstr "" #: panels/timer.py:78 msgid "User CPU time" msgstr "" #: panels/timer.py:79 msgid "System CPU time" msgstr "" #: panels/timer.py:80 msgid "Total CPU time" msgstr "" #: panels/timer.py:81 msgid "Elapsed time" msgstr "" #: panels/timer.py:82 msgid "Context switches" msgstr "" #: panels/version.py:20 panels/version.py:29 msgid "Versions" msgstr "" #: templates/debug_toolbar/base.html:23 msgid "Hide Toolbar" msgstr "" #: templates/debug_toolbar/base.html:23 msgid "Hide" msgstr "" #: templates/debug_toolbar/base.html:48 msgid "Show Toolbar" msgstr "" #: templates/debug_toolbar/base.html:54 msgid "Close" msgstr "" #: templates/debug_toolbar/redirect.html:7 #: templates/debug_toolbar/panels/logger.html:9 msgid "Location" msgstr "" #: templates/debug_toolbar/redirect.html:9 msgid "" "The Django Debug Toolbar has intercepted a redirect to the above URL for " "debug viewing purposes. You can click the above link to continue with the " "redirect as normal. If you'd like to disable this feature, set the " "DEBUG_TOOLBAR_CONFIG dictionary's key " "INTERCEPT_REDIRECTS to False." msgstr "" #: templates/debug_toolbar/panels/cache.html:14 msgid "Total Calls" msgstr "" #: templates/debug_toolbar/panels/cache.html:16 msgid "Total Time" msgstr "" #: templates/debug_toolbar/panels/cache.html:18 msgid "Hits" msgstr "" #: templates/debug_toolbar/panels/cache.html:20 msgid "Misses" msgstr "" #: templates/debug_toolbar/panels/cache.html:35 msgid "Breakdown" msgstr "" #: templates/debug_toolbar/panels/cache.html:40 msgid "Type" msgstr "" #: templates/debug_toolbar/panels/cache.html:41 msgid "Parameters" msgstr "" #: templates/debug_toolbar/panels/cache.html:42 msgid "Function" msgstr "" #: templates/debug_toolbar/panels/headers.html:5 msgid "Key" msgstr "" #: templates/debug_toolbar/panels/headers.html:6 #: templates/debug_toolbar/panels/request_vars.html:37 #: templates/debug_toolbar/panels/request_vars.html:63 #: templates/debug_toolbar/panels/request_vars.html:85 #: templates/debug_toolbar/panels/request_vars.html:107 #: templates/debug_toolbar/panels/settings_vars.html:6 #: templates/debug_toolbar/panels/timer.html:10 msgid "Value" msgstr "" #: templates/debug_toolbar/panels/logger.html:6 msgid "Level" msgstr "" #: templates/debug_toolbar/panels/logger.html:8 msgid "Message" msgstr "" #: templates/debug_toolbar/panels/logger.html:24 msgid "No messages logged" msgstr "" #: templates/debug_toolbar/panels/request_vars.html:3 msgid "View information" msgstr "" #: templates/debug_toolbar/panels/request_vars.html:7 msgid "View Function" msgstr "" #: templates/debug_toolbar/panels/request_vars.html:8 msgid "args" msgstr "" #: templates/debug_toolbar/panels/request_vars.html:9 msgid "kwargs" msgstr "" #: templates/debug_toolbar/panels/request_vars.html:27 msgid "COOKIES Variables" msgstr "" #: templates/debug_toolbar/panels/request_vars.html:36 #: templates/debug_toolbar/panels/request_vars.html:62 #: templates/debug_toolbar/panels/request_vars.html:84 #: templates/debug_toolbar/panels/request_vars.html:106 msgid "Variable" msgstr "" #: templates/debug_toolbar/panels/request_vars.html:50 msgid "No COOKIE data" msgstr "" #: templates/debug_toolbar/panels/request_vars.html:53 msgid "SESSION Variables" msgstr "" #: templates/debug_toolbar/panels/request_vars.html:76 msgid "No SESSION data" msgstr "" #: templates/debug_toolbar/panels/request_vars.html:79 msgid "GET Variables" msgstr "" #: templates/debug_toolbar/panels/request_vars.html:98 msgid "No GET data" msgstr "" #: templates/debug_toolbar/panels/request_vars.html:101 msgid "POST Variables" msgstr "" #: templates/debug_toolbar/panels/request_vars.html:120 msgid "No POST data" msgstr "" #: templates/debug_toolbar/panels/settings_vars.html:5 msgid "Setting" msgstr "" #: templates/debug_toolbar/panels/signals.html:5 msgid "Signal" msgstr "" #: templates/debug_toolbar/panels/signals.html:6 msgid "Providing Args" msgstr "" #: templates/debug_toolbar/panels/signals.html:7 msgid "Receivers" msgstr "" #: templates/debug_toolbar/panels/sql.html:6 msgid "Action" msgstr "" #: templates/debug_toolbar/panels/sql.html:7 msgid "Stacktrace" msgstr "" #: templates/debug_toolbar/panels/sql.html:8 msgid "Query" msgstr "" #: templates/debug_toolbar/panels/sql.html:38 msgid "Line" msgstr "" #: templates/debug_toolbar/panels/sql.html:39 msgid "Method" msgstr "" #: templates/debug_toolbar/panels/sql.html:40 msgid "File" msgstr "" #: templates/debug_toolbar/panels/sql_explain.html:3 #: templates/debug_toolbar/panels/sql_profile.html:3 #: templates/debug_toolbar/panels/sql_select.html:3 #: templates/debug_toolbar/panels/template_source.html:3 msgid "Back" msgstr "" #: templates/debug_toolbar/panels/sql_explain.html:4 msgid "SQL Explained" msgstr "" #: templates/debug_toolbar/panels/sql_explain.html:9 #: templates/debug_toolbar/panels/sql_profile.html:10 #: templates/debug_toolbar/panels/sql_select.html:9 msgid "Executed SQL" msgstr "" #: templates/debug_toolbar/panels/sql_profile.html:4 msgid "SQL Profiled" msgstr "" #: templates/debug_toolbar/panels/sql_profile.html:35 msgid "Error" msgstr "" #: templates/debug_toolbar/panels/sql_select.html:4 msgid "SQL Selected" msgstr "" #: templates/debug_toolbar/panels/sql_select.html:34 msgid "Empty set" msgstr "" #: templates/debug_toolbar/panels/template_source.html:4 msgid "Template Source" msgstr "" #: templates/debug_toolbar/panels/templates.html:2 msgid "Template path" msgstr "" #: templates/debug_toolbar/panels/templates.html:13 msgid "Template" msgstr "" #: templates/debug_toolbar/panels/templates.html:21 #: templates/debug_toolbar/panels/templates.html:37 msgid "Toggle Context" msgstr "" #: templates/debug_toolbar/panels/templates.html:28 #: templates/debug_toolbar/panels/templates.html:43 msgid "None" msgstr "" #: templates/debug_toolbar/panels/templates.html:31 msgid "Context processor" msgstr "" #: templates/debug_toolbar/panels/timer.html:9 msgid "Resource" msgstr "" #: templates/debug_toolbar/panels/versions.html:6 msgid "Package" msgstr "" #: templates/debug_toolbar/panels/versions.html:7 msgid "Version" msgstr "" ================================================ FILE: debug_toolbar/locale/es/LC_MESSAGES/django.po ================================================ # Django Debug Toolbar en Español. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # Percy Pérez-Pinedo , 2009. # # Caracteres especiales: á, é, í, ó, ú, ñ, # msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2009-11-18 08:06-0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: panels/cache.py:92 #, python-format msgid "Cache: %.2fms" msgstr "" #: panels/cache.py:95 msgid "Cache Usage" msgstr "" #: panels/headers.py:36 panels/headers.py:39 msgid "HTTP Headers" msgstr "" #: panels/logger.py:56 msgid "Logging" msgstr "Registros" #: panels/logger.py:63 #, fuzzy msgid "Log Messages" msgstr "Mensaje" #: panels/request_vars.py:13 panels/request_vars.py:16 msgid "Request Vars" msgstr "" #: panels/settings_vars.py:16 msgid "Settings" msgstr "Configuraciones" #: panels/settings_vars.py:19 #, python-format msgid "Settings from %s" msgstr "" #: panels/signals.py:39 panels/signals.py:42 msgid "Signals" msgstr "Señales" #: panels/sql.py:146 msgid "SQL" msgstr "" #: panels/sql.py:160 msgid "SQL Queries" msgstr "" #: panels/template.py:47 msgid "Templates" msgstr "Plantillas" #: panels/template.py:52 #, python-format msgid "Templates (%(num_templates)s rendered)" msgstr "" #: panels/timer.py:35 templates/debug_toolbar/panels/cache.html:39 #: templates/debug_toolbar/panels/logger.html:7 #: templates/debug_toolbar/panels/sql.html:5 #: templates/debug_toolbar/panels/sql_explain.html:11 #: templates/debug_toolbar/panels/sql_profile.html:12 #: templates/debug_toolbar/panels/sql_select.html:11 msgid "Time" msgstr "Tiempo" #: panels/timer.py:47 #, fuzzy msgid "Resource Usage" msgstr "Recurso" #: panels/timer.py:78 msgid "User CPU time" msgstr "" #: panels/timer.py:79 msgid "System CPU time" msgstr "" #: panels/timer.py:80 #, fuzzy msgid "Total CPU time" msgstr "Tiempo Total" #: panels/timer.py:81 msgid "Elapsed time" msgstr "" #: panels/timer.py:82 msgid "Context switches" msgstr "" #: panels/version.py:20 panels/version.py:29 #, fuzzy msgid "Versions" msgstr "Versión Django" #: templates/debug_toolbar/base.html:23 msgid "Hide Toolbar" msgstr "" #: templates/debug_toolbar/base.html:23 msgid "Hide" msgstr "Ocultar" #: templates/debug_toolbar/base.html:48 msgid "Show Toolbar" msgstr "" #: templates/debug_toolbar/base.html:54 msgid "Close" msgstr "Cerrar" #: templates/debug_toolbar/redirect.html:7 #: templates/debug_toolbar/panels/logger.html:9 msgid "Location" msgstr "" #: templates/debug_toolbar/redirect.html:9 msgid "" "The Django Debug Toolbar has intercepted a redirect to the above URL for " "debug viewing purposes. You can click the above link to continue with the " "redirect as normal. If you'd like to disable this feature, set the " "DEBUG_TOOLBAR_CONFIG dictionary's key " "INTERCEPT_REDIRECTS to False." msgstr "" #: templates/debug_toolbar/panels/cache.html:14 msgid "Total Calls" msgstr "Total Llamadas" #: templates/debug_toolbar/panels/cache.html:16 msgid "Total Time" msgstr "Tiempo Total" #: templates/debug_toolbar/panels/cache.html:18 msgid "Hits" msgstr "Visitas" #: templates/debug_toolbar/panels/cache.html:20 msgid "Misses" msgstr "" #: templates/debug_toolbar/panels/cache.html:35 msgid "Breakdown" msgstr "" #: templates/debug_toolbar/panels/cache.html:40 msgid "Type" msgstr "Tipo" #: templates/debug_toolbar/panels/cache.html:41 msgid "Parameters" msgstr "Parámetros" #: templates/debug_toolbar/panels/cache.html:42 msgid "Function" msgstr "Función" #: templates/debug_toolbar/panels/headers.html:5 msgid "Key" msgstr "Llave" #: templates/debug_toolbar/panels/headers.html:6 #: templates/debug_toolbar/panels/request_vars.html:37 #: templates/debug_toolbar/panels/request_vars.html:63 #: templates/debug_toolbar/panels/request_vars.html:85 #: templates/debug_toolbar/panels/request_vars.html:107 #: templates/debug_toolbar/panels/settings_vars.html:6 #: templates/debug_toolbar/panels/timer.html:10 msgid "Value" msgstr "Valor" #: templates/debug_toolbar/panels/logger.html:6 msgid "Level" msgstr "Nivel" #: templates/debug_toolbar/panels/logger.html:8 msgid "Message" msgstr "Mensaje" #: templates/debug_toolbar/panels/logger.html:24 msgid "No messages logged" msgstr "No hay mensajes registrados" #: templates/debug_toolbar/panels/request_vars.html:3 msgid "View information" msgstr "" #: templates/debug_toolbar/panels/request_vars.html:7 #, fuzzy msgid "View Function" msgstr "Función" #: templates/debug_toolbar/panels/request_vars.html:8 msgid "args" msgstr "" #: templates/debug_toolbar/panels/request_vars.html:9 msgid "kwargs" msgstr "" #: templates/debug_toolbar/panels/request_vars.html:27 #, fuzzy msgid "COOKIES Variables" msgstr "Variable" #: templates/debug_toolbar/panels/request_vars.html:36 #: templates/debug_toolbar/panels/request_vars.html:62 #: templates/debug_toolbar/panels/request_vars.html:84 #: templates/debug_toolbar/panels/request_vars.html:106 #, fuzzy msgid "Variable" msgstr "Variable" #: templates/debug_toolbar/panels/request_vars.html:50 #, fuzzy msgid "No COOKIE data" msgstr "No GET datos" #: templates/debug_toolbar/panels/request_vars.html:53 #, fuzzy msgid "SESSION Variables" msgstr "Variable" #: templates/debug_toolbar/panels/request_vars.html:76 msgid "No SESSION data" msgstr "No SESSION datos" #: templates/debug_toolbar/panels/request_vars.html:79 #, fuzzy msgid "GET Variables" msgstr "Variable" #: templates/debug_toolbar/panels/request_vars.html:98 msgid "No GET data" msgstr "No GET datos" #: templates/debug_toolbar/panels/request_vars.html:101 #, fuzzy msgid "POST Variables" msgstr "Variable" #: templates/debug_toolbar/panels/request_vars.html:120 msgid "No POST data" msgstr "No POST datos" #: templates/debug_toolbar/panels/settings_vars.html:5 msgid "Setting" msgstr "Configuración" #: templates/debug_toolbar/panels/signals.html:5 msgid "Signal" msgstr "Señal" #: templates/debug_toolbar/panels/signals.html:6 msgid "Providing Args" msgstr "" #: templates/debug_toolbar/panels/signals.html:7 msgid "Receivers" msgstr "" #: templates/debug_toolbar/panels/sql.html:6 msgid "Action" msgstr "Acción" #: templates/debug_toolbar/panels/sql.html:7 msgid "Stacktrace" msgstr "" #: templates/debug_toolbar/panels/sql.html:8 msgid "Query" msgstr "" #: templates/debug_toolbar/panels/sql.html:38 msgid "Line" msgstr "Línea" #: templates/debug_toolbar/panels/sql.html:39 msgid "Method" msgstr "Método" #: templates/debug_toolbar/panels/sql.html:40 msgid "File" msgstr "Archivo" #: templates/debug_toolbar/panels/sql_explain.html:3 #: templates/debug_toolbar/panels/sql_profile.html:3 #: templates/debug_toolbar/panels/sql_select.html:3 #: templates/debug_toolbar/panels/template_source.html:3 msgid "Back" msgstr "Regresar" #: templates/debug_toolbar/panels/sql_explain.html:4 msgid "SQL Explained" msgstr "" #: templates/debug_toolbar/panels/sql_explain.html:9 #: templates/debug_toolbar/panels/sql_profile.html:10 #: templates/debug_toolbar/panels/sql_select.html:9 msgid "Executed SQL" msgstr "SQL Ejecutado" #: templates/debug_toolbar/panels/sql_profile.html:4 msgid "SQL Profiled" msgstr "" #: templates/debug_toolbar/panels/sql_profile.html:35 msgid "Error" msgstr "" #: templates/debug_toolbar/panels/sql_select.html:4 msgid "SQL Selected" msgstr "" #: templates/debug_toolbar/panels/sql_select.html:34 msgid "Empty set" msgstr "Set Vacío" #: templates/debug_toolbar/panels/template_source.html:4 #, fuzzy msgid "Template Source" msgstr "Plantilla" #: templates/debug_toolbar/panels/templates.html:2 #, fuzzy msgid "Template path" msgstr "Plantilla" #: templates/debug_toolbar/panels/templates.html:13 msgid "Template" msgstr "Plantilla" #: templates/debug_toolbar/panels/templates.html:21 #: templates/debug_toolbar/panels/templates.html:37 msgid "Toggle Context" msgstr "" #: templates/debug_toolbar/panels/templates.html:28 #: templates/debug_toolbar/panels/templates.html:43 msgid "None" msgstr "Ninguno" #: templates/debug_toolbar/panels/templates.html:31 msgid "Context processor" msgstr "" #: templates/debug_toolbar/panels/timer.html:9 msgid "Resource" msgstr "Recurso" #: templates/debug_toolbar/panels/versions.html:6 msgid "Package" msgstr "" #: templates/debug_toolbar/panels/versions.html:7 #, fuzzy msgid "Version" msgstr "Versión Django" ================================================ FILE: debug_toolbar/locale/fr/LC_MESSAGES/django.po ================================================ # Django Debug Toolbar in French. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # David Paccoud, 2009. # # msgid "" msgstr "" "Project-Id-Version: Django Debug Toolbar 0.8.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2009-11-18 08:06-0800\n" "PO-Revision-Date: 2009-10-14 22:53+0200\n" "Last-Translator: David Paccoud \n" "Language-Team: French \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: panels/cache.py:92 #, python-format msgid "Cache: %.2fms" msgstr "" #: panels/cache.py:95 msgid "Cache Usage" msgstr "Usage du cache" #: panels/headers.py:36 panels/headers.py:39 msgid "HTTP Headers" msgstr "En-têtes HTTP" #: panels/logger.py:56 msgid "Logging" msgstr "Journaux" #: panels/logger.py:63 #, fuzzy msgid "Log Messages" msgstr "Message" #: panels/request_vars.py:13 panels/request_vars.py:16 msgid "Request Vars" msgstr "Variables de requête" #: panels/settings_vars.py:16 msgid "Settings" msgstr "Paramètres" #: panels/settings_vars.py:19 #, python-format msgid "Settings from %s" msgstr "Paramètres de %s" #: panels/signals.py:39 panels/signals.py:42 msgid "Signals" msgstr "Signaux" #: panels/sql.py:146 msgid "SQL" msgstr "SQL" #: panels/sql.py:160 #, fuzzy msgid "SQL Queries" msgstr "Requêtes SQL" #: panels/template.py:47 msgid "Templates" msgstr "Gabarits" #: panels/template.py:52 #, python-format msgid "Templates (%(num_templates)s rendered)" msgstr "Gabarits (%(num_templates)s affichés)" #: panels/timer.py:35 templates/debug_toolbar/panels/cache.html:39 #: templates/debug_toolbar/panels/logger.html:7 #: templates/debug_toolbar/panels/sql.html:5 #: templates/debug_toolbar/panels/sql_explain.html:11 #: templates/debug_toolbar/panels/sql_profile.html:12 #: templates/debug_toolbar/panels/sql_select.html:11 msgid "Time" msgstr "Temps" #: panels/timer.py:47 #, fuzzy msgid "Resource Usage" msgstr "Usage des ressources" #: panels/timer.py:78 msgid "User CPU time" msgstr "Temps CPU utilisateur" #: panels/timer.py:79 msgid "System CPU time" msgstr "Temps CPU système" #: panels/timer.py:80 #, fuzzy msgid "Total CPU time" msgstr "Temps CPU Total" #: panels/timer.py:81 msgid "Elapsed time" msgstr "Temps écoulé" #: panels/timer.py:82 #, fuzzy msgid "Context switches" msgstr "Changements de contexte" #: panels/version.py:20 panels/version.py:29 #, fuzzy msgid "Versions" msgstr "Versions" #: templates/debug_toolbar/base.html:23 msgid "Hide Toolbar" msgstr "Masquer la barre" #: templates/debug_toolbar/base.html:23 msgid "Hide" msgstr "Masquer" #: templates/debug_toolbar/base.html:48 msgid "Show Toolbar" msgstr "Afficher la barre" #: templates/debug_toolbar/base.html:54 msgid "Close" msgstr "Fermer" #: templates/debug_toolbar/redirect.html:7 #: templates/debug_toolbar/panels/logger.html:9 msgid "Location" msgstr "Emplacement" #: templates/debug_toolbar/redirect.html:9 msgid "" "The Django Debug Toolbar has intercepted a redirect to the above URL for " "debug viewing purposes. You can click the above link to continue with the " "redirect as normal. If you'd like to disable this feature, set the " "DEBUG_TOOLBAR_CONFIG dictionary's key " "INTERCEPT_REDIRECTS to False." msgstr "" "La barre de Debug Django a intercepté une redirection vers l'adresse ci-" "dessous afin de permettre la consultation des messages de debug. Vous " "pouvez cliquer sur le lien ci-dessus pour continuer normalement avec la " "redirection. Si vous voulez désactiver cette fonctionnalité, paramétrez la " "valeur de la clé INTERCEPT_REDIRECTS du dictionnaire " "DEBUG_TOOLBAR_CONFIG à False." #: templates/debug_toolbar/panels/cache.html:14 msgid "Total Calls" msgstr "Nombre total d'appels" #: templates/debug_toolbar/panels/cache.html:16 msgid "Total Time" msgstr "Temps Total" #: templates/debug_toolbar/panels/cache.html:18 msgid "Hits" msgstr "Requêtes" #: templates/debug_toolbar/panels/cache.html:20 msgid "Misses" msgstr "Ratés" #: templates/debug_toolbar/panels/cache.html:35 msgid "Breakdown" msgstr "Cassé" #: templates/debug_toolbar/panels/cache.html:40 msgid "Type" msgstr "Type" #: templates/debug_toolbar/panels/cache.html:41 msgid "Parameters" msgstr "Paramètres" #: templates/debug_toolbar/panels/cache.html:42 msgid "Function" msgstr "Fonction" #: templates/debug_toolbar/panels/headers.html:5 msgid "Key" msgstr "Clé" #: templates/debug_toolbar/panels/headers.html:6 #: templates/debug_toolbar/panels/request_vars.html:37 #: templates/debug_toolbar/panels/request_vars.html:63 #: templates/debug_toolbar/panels/request_vars.html:85 #: templates/debug_toolbar/panels/request_vars.html:107 #: templates/debug_toolbar/panels/settings_vars.html:6 #: templates/debug_toolbar/panels/timer.html:10 msgid "Value" msgstr "Valeur" #: templates/debug_toolbar/panels/logger.html:6 msgid "Level" msgstr "Niveau" #: templates/debug_toolbar/panels/logger.html:8 msgid "Message" msgstr "Message" #: templates/debug_toolbar/panels/logger.html:24 msgid "No messages logged" msgstr "Aucun message dans le journal" #: templates/debug_toolbar/panels/request_vars.html:3 msgid "View information" msgstr "" #: templates/debug_toolbar/panels/request_vars.html:7 #, fuzzy msgid "View Function" msgstr "Fonction" #: templates/debug_toolbar/panels/request_vars.html:8 msgid "args" msgstr "" #: templates/debug_toolbar/panels/request_vars.html:9 msgid "kwargs" msgstr "" #: templates/debug_toolbar/panels/request_vars.html:27 msgid "COOKIES Variables" msgstr "Variables des COOKIES" #: templates/debug_toolbar/panels/request_vars.html:36 #: templates/debug_toolbar/panels/request_vars.html:62 #: templates/debug_toolbar/panels/request_vars.html:84 #: templates/debug_toolbar/panels/request_vars.html:106 msgid "Variable" msgstr "Variable" #: templates/debug_toolbar/panels/request_vars.html:50 msgid "No COOKIE data" msgstr "Aucune donnée de COOKIE" #: templates/debug_toolbar/panels/request_vars.html:53 msgid "SESSION Variables" msgstr "Variables de SESSION" #: templates/debug_toolbar/panels/request_vars.html:76 msgid "No SESSION data" msgstr "Aucune donnée de SESSION" #: templates/debug_toolbar/panels/request_vars.html:79 msgid "GET Variables" msgstr "Variables GET" #: templates/debug_toolbar/panels/request_vars.html:98 msgid "No GET data" msgstr "Aucune donnée GET" #: templates/debug_toolbar/panels/request_vars.html:101 msgid "POST Variables" msgstr "Variables POST" #: templates/debug_toolbar/panels/request_vars.html:120 msgid "No POST data" msgstr "Aucune donnée POST" #: templates/debug_toolbar/panels/settings_vars.html:5 msgid "Setting" msgstr "Paramètre" #: templates/debug_toolbar/panels/signals.html:5 msgid "Signal" msgstr "Signal" #: templates/debug_toolbar/panels/signals.html:6 msgid "Providing Args" msgstr "" #: templates/debug_toolbar/panels/signals.html:7 msgid "Receivers" msgstr "Receveurs" #: templates/debug_toolbar/panels/sql.html:6 msgid "Action" msgstr "Action" #: templates/debug_toolbar/panels/sql.html:7 msgid "Stacktrace" msgstr "Pile d'appel" #: templates/debug_toolbar/panels/sql.html:8 msgid "Query" msgstr "Requête" #: templates/debug_toolbar/panels/sql.html:38 msgid "Line" msgstr "Ligne" #: templates/debug_toolbar/panels/sql.html:39 msgid "Method" msgstr "Méthode" #: templates/debug_toolbar/panels/sql.html:40 msgid "File" msgstr "Fichier" #: templates/debug_toolbar/panels/sql_explain.html:3 #: templates/debug_toolbar/panels/sql_profile.html:3 #: templates/debug_toolbar/panels/sql_select.html:3 #: templates/debug_toolbar/panels/template_source.html:3 msgid "Back" msgstr "Retour" #: templates/debug_toolbar/panels/sql_explain.html:4 msgid "SQL Explained" msgstr "SQL Expliqué" #: templates/debug_toolbar/panels/sql_explain.html:9 #: templates/debug_toolbar/panels/sql_profile.html:10 #: templates/debug_toolbar/panels/sql_select.html:9 msgid "Executed SQL" msgstr "SQL Exécuté" #: templates/debug_toolbar/panels/sql_profile.html:4 msgid "SQL Profiled" msgstr "SQL Profilé" #: templates/debug_toolbar/panels/sql_profile.html:35 msgid "Error" msgstr "Erreur" #: templates/debug_toolbar/panels/sql_select.html:4 msgid "SQL Selected" msgstr "SQL Sélectionné" #: templates/debug_toolbar/panels/sql_select.html:34 msgid "Empty set" msgstr "Ensemble vide" #: templates/debug_toolbar/panels/template_source.html:4 msgid "Template Source" msgstr "Source du gabarit" #: templates/debug_toolbar/panels/templates.html:2 msgid "Template path" msgstr "Chemin du gabarit" #: templates/debug_toolbar/panels/templates.html:13 msgid "Template" msgstr "Gabarit" #: templates/debug_toolbar/panels/templates.html:21 #: templates/debug_toolbar/panels/templates.html:37 msgid "Toggle Context" msgstr "Afficher/Masquer le contexte" #: templates/debug_toolbar/panels/templates.html:28 #: templates/debug_toolbar/panels/templates.html:43 msgid "None" msgstr "Aucun" #: templates/debug_toolbar/panels/templates.html:31 msgid "Context processor" msgstr "Processeur de contexte" #: templates/debug_toolbar/panels/timer.html:9 msgid "Resource" msgstr "Ressources" #: templates/debug_toolbar/panels/versions.html:6 msgid "Package" msgstr "Paquet" #: templates/debug_toolbar/panels/versions.html:7 msgid "Version" msgstr "Version" ================================================ FILE: debug_toolbar/locale/he/LC_MESSAGES/django.po ================================================ # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2009-11-18 08:06-0800\n" "PO-Revision-Date: 2009-08-24 23:08-0600\n" "Last-Translator: Alex \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: panels/cache.py:92 #, python-format msgid "Cache: %.2fms" msgstr "" #: panels/cache.py:95 msgid "Cache Usage" msgstr "" #: panels/headers.py:36 panels/headers.py:39 msgid "HTTP Headers" msgstr "" #: panels/logger.py:56 msgid "Logging" msgstr "רישום יומן" #: panels/logger.py:63 #, fuzzy msgid "Log Messages" msgstr "הודעה" #: panels/request_vars.py:13 panels/request_vars.py:16 msgid "Request Vars" msgstr "" #: panels/settings_vars.py:16 msgid "Settings" msgstr "" #: panels/settings_vars.py:19 #, python-format msgid "Settings from %s" msgstr "" #: panels/signals.py:39 panels/signals.py:42 msgid "Signals" msgstr "סימנים" #: panels/sql.py:146 msgid "SQL" msgstr "" #: panels/sql.py:160 msgid "SQL Queries" msgstr "" #: panels/template.py:47 msgid "Templates" msgstr "תבניות" #: panels/template.py:52 #, python-format msgid "Templates (%(num_templates)s rendered)" msgstr "" #: panels/timer.py:35 templates/debug_toolbar/panels/cache.html:39 #: templates/debug_toolbar/panels/logger.html:7 #: templates/debug_toolbar/panels/sql.html:5 #: templates/debug_toolbar/panels/sql_explain.html:11 #: templates/debug_toolbar/panels/sql_profile.html:12 #: templates/debug_toolbar/panels/sql_select.html:11 msgid "Time" msgstr "זמן" #: panels/timer.py:47 msgid "Resource Usage" msgstr "" #: panels/timer.py:78 msgid "User CPU time" msgstr "" #: panels/timer.py:79 msgid "System CPU time" msgstr "" #: panels/timer.py:80 #, fuzzy msgid "Total CPU time" msgstr "זמן" #: panels/timer.py:81 msgid "Elapsed time" msgstr "" #: panels/timer.py:82 msgid "Context switches" msgstr "" #: panels/version.py:20 panels/version.py:29 #, fuzzy msgid "Versions" msgstr "ג 'נגו גירסה" #: templates/debug_toolbar/base.html:23 msgid "Hide Toolbar" msgstr "" #: templates/debug_toolbar/base.html:23 msgid "Hide" msgstr "הסתיר" #: templates/debug_toolbar/base.html:48 msgid "Show Toolbar" msgstr "" #: templates/debug_toolbar/base.html:54 msgid "Close" msgstr "סגור" #: templates/debug_toolbar/redirect.html:7 #: templates/debug_toolbar/panels/logger.html:9 msgid "Location" msgstr "מקום" #: templates/debug_toolbar/redirect.html:9 msgid "" "The Django Debug Toolbar has intercepted a redirect to the above URL for " "debug viewing purposes. You can click the above link to continue with the " "redirect as normal. If you'd like to disable this feature, set the " "DEBUG_TOOLBAR_CONFIG dictionary's key " "INTERCEPT_REDIRECTS to False." msgstr "" #: templates/debug_toolbar/panels/cache.html:14 msgid "Total Calls" msgstr "" #: templates/debug_toolbar/panels/cache.html:16 msgid "Total Time" msgstr "זמן" #: templates/debug_toolbar/panels/cache.html:18 msgid "Hits" msgstr "הצלחות" #: templates/debug_toolbar/panels/cache.html:20 msgid "Misses" msgstr "" #: templates/debug_toolbar/panels/cache.html:35 msgid "Breakdown" msgstr "" #: templates/debug_toolbar/panels/cache.html:40 msgid "Type" msgstr "סוג" #: templates/debug_toolbar/panels/cache.html:41 msgid "Parameters" msgstr "" #: templates/debug_toolbar/panels/cache.html:42 msgid "Function" msgstr "" #: templates/debug_toolbar/panels/headers.html:5 msgid "Key" msgstr "מפתח" #: templates/debug_toolbar/panels/headers.html:6 #: templates/debug_toolbar/panels/request_vars.html:37 #: templates/debug_toolbar/panels/request_vars.html:63 #: templates/debug_toolbar/panels/request_vars.html:85 #: templates/debug_toolbar/panels/request_vars.html:107 #: templates/debug_toolbar/panels/settings_vars.html:6 #: templates/debug_toolbar/panels/timer.html:10 msgid "Value" msgstr "ערך" #: templates/debug_toolbar/panels/logger.html:6 msgid "Level" msgstr "רמה" #: templates/debug_toolbar/panels/logger.html:8 msgid "Message" msgstr "הודעה" #: templates/debug_toolbar/panels/logger.html:24 msgid "No messages logged" msgstr "אין הודעות" #: templates/debug_toolbar/panels/request_vars.html:3 msgid "View information" msgstr "" #: templates/debug_toolbar/panels/request_vars.html:7 msgid "View Function" msgstr "" #: templates/debug_toolbar/panels/request_vars.html:8 msgid "args" msgstr "" #: templates/debug_toolbar/panels/request_vars.html:9 msgid "kwargs" msgstr "" #: templates/debug_toolbar/panels/request_vars.html:27 #, fuzzy msgid "COOKIES Variables" msgstr "מזהה" #: templates/debug_toolbar/panels/request_vars.html:36 #: templates/debug_toolbar/panels/request_vars.html:62 #: templates/debug_toolbar/panels/request_vars.html:84 #: templates/debug_toolbar/panels/request_vars.html:106 msgid "Variable" msgstr "מזהה" #: templates/debug_toolbar/panels/request_vars.html:50 msgid "No COOKIE data" msgstr "אין נתונים לעוגיות" #: templates/debug_toolbar/panels/request_vars.html:53 #, fuzzy msgid "SESSION Variables" msgstr "מזהה" #: templates/debug_toolbar/panels/request_vars.html:76 msgid "No SESSION data" msgstr "אין נתונים להתחברות" #: templates/debug_toolbar/panels/request_vars.html:79 #, fuzzy msgid "GET Variables" msgstr "מזהה" #: templates/debug_toolbar/panels/request_vars.html:98 msgid "No GET data" msgstr "שום דבר עבור GET" #: templates/debug_toolbar/panels/request_vars.html:101 #, fuzzy msgid "POST Variables" msgstr "מזהה" #: templates/debug_toolbar/panels/request_vars.html:120 msgid "No POST data" msgstr "שום דבר עבור POST" #: templates/debug_toolbar/panels/settings_vars.html:5 msgid "Setting" msgstr "" #: templates/debug_toolbar/panels/signals.html:5 msgid "Signal" msgstr "סימן" #: templates/debug_toolbar/panels/signals.html:6 msgid "Providing Args" msgstr "" #: templates/debug_toolbar/panels/signals.html:7 msgid "Receivers" msgstr "" #: templates/debug_toolbar/panels/sql.html:6 msgid "Action" msgstr "פעילות" #: templates/debug_toolbar/panels/sql.html:7 msgid "Stacktrace" msgstr "" #: templates/debug_toolbar/panels/sql.html:8 msgid "Query" msgstr "" #: templates/debug_toolbar/panels/sql.html:38 msgid "Line" msgstr "שורה" #: templates/debug_toolbar/panels/sql.html:39 msgid "Method" msgstr "" #: templates/debug_toolbar/panels/sql.html:40 msgid "File" msgstr "קובץ" #: templates/debug_toolbar/panels/sql_explain.html:3 #: templates/debug_toolbar/panels/sql_profile.html:3 #: templates/debug_toolbar/panels/sql_select.html:3 #: templates/debug_toolbar/panels/template_source.html:3 msgid "Back" msgstr "חזרה" #: templates/debug_toolbar/panels/sql_explain.html:4 msgid "SQL Explained" msgstr "" #: templates/debug_toolbar/panels/sql_explain.html:9 #: templates/debug_toolbar/panels/sql_profile.html:10 #: templates/debug_toolbar/panels/sql_select.html:9 msgid "Executed SQL" msgstr "הסבר עבור SQL" #: templates/debug_toolbar/panels/sql_profile.html:4 msgid "SQL Profiled" msgstr "" #: templates/debug_toolbar/panels/sql_profile.html:35 msgid "Error" msgstr "שגיאה" #: templates/debug_toolbar/panels/sql_select.html:4 msgid "SQL Selected" msgstr "" #: templates/debug_toolbar/panels/sql_select.html:34 msgid "Empty set" msgstr "תוצאות ריק" #: templates/debug_toolbar/panels/template_source.html:4 #, fuzzy msgid "Template Source" msgstr "תבנית" #: templates/debug_toolbar/panels/templates.html:2 #, fuzzy msgid "Template path" msgstr "תבנית" #: templates/debug_toolbar/panels/templates.html:13 msgid "Template" msgstr "תבנית" #: templates/debug_toolbar/panels/templates.html:21 #: templates/debug_toolbar/panels/templates.html:37 msgid "Toggle Context" msgstr "" #: templates/debug_toolbar/panels/templates.html:28 #: templates/debug_toolbar/panels/templates.html:43 msgid "None" msgstr "" #: templates/debug_toolbar/panels/templates.html:31 msgid "Context processor" msgstr "" #: templates/debug_toolbar/panels/timer.html:9 msgid "Resource" msgstr "" #: templates/debug_toolbar/panels/versions.html:6 msgid "Package" msgstr "" #: templates/debug_toolbar/panels/versions.html:7 #, fuzzy msgid "Version" msgstr "ג 'נגו גירסה" ================================================ FILE: debug_toolbar/locale/ru/LC_MESSAGES/django.po ================================================ # Django Debug Toolbar in Russian. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # Mikhail Korobov, 2009. # # msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2009-11-18 08:06-0800\n" "PO-Revision-Date: \n" "Last-Translator: Mikhail Korobov \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: panels/cache.py:92 #, python-format msgid "Cache: %.2fms" msgstr "" #: panels/cache.py:95 msgid "Cache Usage" msgstr "" #: panels/headers.py:36 panels/headers.py:39 msgid "HTTP Headers" msgstr "Заголовки HTTP" #: panels/logger.py:56 msgid "Logging" msgstr "Журналирование" #: panels/logger.py:63 #, fuzzy msgid "Log Messages" msgstr "Сообщение" #: panels/request_vars.py:13 panels/request_vars.py:16 msgid "Request Vars" msgstr "Запрос" #: panels/settings_vars.py:16 msgid "Settings" msgstr "Настройки" #: panels/settings_vars.py:19 #, python-format msgid "Settings from %s" msgstr "" #: panels/signals.py:39 panels/signals.py:42 msgid "Signals" msgstr "Сигналы" #: panels/sql.py:146 msgid "SQL" msgstr "" #: panels/sql.py:160 msgid "SQL Queries" msgstr "" #: panels/template.py:47 msgid "Templates" msgstr "Шаблоны" #: panels/template.py:52 #, python-format msgid "Templates (%(num_templates)s rendered)" msgstr "" #: panels/timer.py:35 templates/debug_toolbar/panels/cache.html:39 #: templates/debug_toolbar/panels/logger.html:7 #: templates/debug_toolbar/panels/sql.html:5 #: templates/debug_toolbar/panels/sql_explain.html:11 #: templates/debug_toolbar/panels/sql_profile.html:12 #: templates/debug_toolbar/panels/sql_select.html:11 msgid "Time" msgstr "Время" #: panels/timer.py:47 #, fuzzy msgid "Resource Usage" msgstr "Ресурс" #: panels/timer.py:78 msgid "User CPU time" msgstr "" #: panels/timer.py:79 msgid "System CPU time" msgstr "" #: panels/timer.py:80 #, fuzzy msgid "Total CPU time" msgstr "Общее время" #: panels/timer.py:81 msgid "Elapsed time" msgstr "" #: panels/timer.py:82 msgid "Context switches" msgstr "" #: panels/version.py:20 panels/version.py:29 #, fuzzy msgid "Versions" msgstr "Версия Django" #: templates/debug_toolbar/base.html:23 msgid "Hide Toolbar" msgstr "" #: templates/debug_toolbar/base.html:23 msgid "Hide" msgstr "Скрыть" #: templates/debug_toolbar/base.html:48 msgid "Show Toolbar" msgstr "" #: templates/debug_toolbar/base.html:54 msgid "Close" msgstr "Закрыть" #: templates/debug_toolbar/redirect.html:7 #: templates/debug_toolbar/panels/logger.html:9 msgid "Location" msgstr "Место" #: templates/debug_toolbar/redirect.html:9 msgid "" "The Django Debug Toolbar has intercepted a redirect to the above URL for " "debug viewing purposes. You can click the above link to continue with the " "redirect as normal. If you'd like to disable this feature, set the " "DEBUG_TOOLBAR_CONFIG dictionary's key " "INTERCEPT_REDIRECTS to False." msgstr "" "Django Debug Toolbar в отладочных целях перехватила редирект на адрес, " "указанный выше. Вы можете нажать на ссылку, чтобы продолжить обычное " "выполнение. Если хотите отключить это поведение, установите в словаре " "DEBUG_TOOLBAR_CONFIG ключ INTERCEPT_REDIRECTS " "равным False." #: templates/debug_toolbar/panels/cache.html:14 msgid "Total Calls" msgstr "Всего вызовов" #: templates/debug_toolbar/panels/cache.html:16 msgid "Total Time" msgstr "Общее время" #: templates/debug_toolbar/panels/cache.html:18 msgid "Hits" msgstr "" #: templates/debug_toolbar/panels/cache.html:20 msgid "Misses" msgstr "" #: templates/debug_toolbar/panels/cache.html:35 msgid "Breakdown" msgstr "" #: templates/debug_toolbar/panels/cache.html:40 msgid "Type" msgstr "" #: templates/debug_toolbar/panels/cache.html:41 msgid "Parameters" msgstr "" #: templates/debug_toolbar/panels/cache.html:42 msgid "Function" msgstr "" #: templates/debug_toolbar/panels/headers.html:5 msgid "Key" msgstr "Заголовок" #: templates/debug_toolbar/panels/headers.html:6 #: templates/debug_toolbar/panels/request_vars.html:37 #: templates/debug_toolbar/panels/request_vars.html:63 #: templates/debug_toolbar/panels/request_vars.html:85 #: templates/debug_toolbar/panels/request_vars.html:107 #: templates/debug_toolbar/panels/settings_vars.html:6 #: templates/debug_toolbar/panels/timer.html:10 msgid "Value" msgstr "Значение" #: templates/debug_toolbar/panels/logger.html:6 msgid "Level" msgstr "Уровень" #: templates/debug_toolbar/panels/logger.html:8 msgid "Message" msgstr "Сообщение" #: templates/debug_toolbar/panels/logger.html:24 msgid "No messages logged" msgstr "Сообщений нет" #: templates/debug_toolbar/panels/request_vars.html:3 msgid "View information" msgstr "" #: templates/debug_toolbar/panels/request_vars.html:7 msgid "View Function" msgstr "" #: templates/debug_toolbar/panels/request_vars.html:8 msgid "args" msgstr "" #: templates/debug_toolbar/panels/request_vars.html:9 msgid "kwargs" msgstr "" #: templates/debug_toolbar/panels/request_vars.html:27 #, fuzzy msgid "COOKIES Variables" msgstr "Переменная" #: templates/debug_toolbar/panels/request_vars.html:36 #: templates/debug_toolbar/panels/request_vars.html:62 #: templates/debug_toolbar/panels/request_vars.html:84 #: templates/debug_toolbar/panels/request_vars.html:106 msgid "Variable" msgstr "Переменная" #: templates/debug_toolbar/panels/request_vars.html:50 msgid "No COOKIE data" msgstr "" #: templates/debug_toolbar/panels/request_vars.html:53 #, fuzzy msgid "SESSION Variables" msgstr "Переменная" #: templates/debug_toolbar/panels/request_vars.html:76 msgid "No SESSION data" msgstr "" #: templates/debug_toolbar/panels/request_vars.html:79 #, fuzzy msgid "GET Variables" msgstr "Переменная" #: templates/debug_toolbar/panels/request_vars.html:98 msgid "No GET data" msgstr "" #: templates/debug_toolbar/panels/request_vars.html:101 #, fuzzy msgid "POST Variables" msgstr "Переменная" #: templates/debug_toolbar/panels/request_vars.html:120 msgid "No POST data" msgstr "" #: templates/debug_toolbar/panels/settings_vars.html:5 msgid "Setting" msgstr "Параметр" #: templates/debug_toolbar/panels/signals.html:5 msgid "Signal" msgstr "Сигналы" #: templates/debug_toolbar/panels/signals.html:6 msgid "Providing Args" msgstr "" #: templates/debug_toolbar/panels/signals.html:7 msgid "Receivers" msgstr "" #: templates/debug_toolbar/panels/sql.html:6 msgid "Action" msgstr "Действие" #: templates/debug_toolbar/panels/sql.html:7 msgid "Stacktrace" msgstr "" #: templates/debug_toolbar/panels/sql.html:8 msgid "Query" msgstr "Запрос" #: templates/debug_toolbar/panels/sql.html:38 msgid "Line" msgstr "Строка" #: templates/debug_toolbar/panels/sql.html:39 msgid "Method" msgstr "Метод" #: templates/debug_toolbar/panels/sql.html:40 msgid "File" msgstr "Файл" #: templates/debug_toolbar/panels/sql_explain.html:3 #: templates/debug_toolbar/panels/sql_profile.html:3 #: templates/debug_toolbar/panels/sql_select.html:3 #: templates/debug_toolbar/panels/template_source.html:3 msgid "Back" msgstr "Назад" #: templates/debug_toolbar/panels/sql_explain.html:4 msgid "SQL Explained" msgstr "" #: templates/debug_toolbar/panels/sql_explain.html:9 #: templates/debug_toolbar/panels/sql_profile.html:10 #: templates/debug_toolbar/panels/sql_select.html:9 msgid "Executed SQL" msgstr "Запрос" #: templates/debug_toolbar/panels/sql_profile.html:4 msgid "SQL Profiled" msgstr "" #: templates/debug_toolbar/panels/sql_profile.html:35 msgid "Error" msgstr "Ошибка" #: templates/debug_toolbar/panels/sql_select.html:4 msgid "SQL Selected" msgstr "" #: templates/debug_toolbar/panels/sql_select.html:34 msgid "Empty set" msgstr "Ничего" #: templates/debug_toolbar/panels/template_source.html:4 #, fuzzy msgid "Template Source" msgstr "Шаблоны" #: templates/debug_toolbar/panels/templates.html:2 #, fuzzy msgid "Template path" msgstr "Шаблоны" #: templates/debug_toolbar/panels/templates.html:13 msgid "Template" msgstr "" #: templates/debug_toolbar/panels/templates.html:21 #: templates/debug_toolbar/panels/templates.html:37 msgid "Toggle Context" msgstr "" #: templates/debug_toolbar/panels/templates.html:28 #: templates/debug_toolbar/panels/templates.html:43 msgid "None" msgstr "" #: templates/debug_toolbar/panels/templates.html:31 msgid "Context processor" msgstr "" #: templates/debug_toolbar/panels/timer.html:9 msgid "Resource" msgstr "Ресурс" #: templates/debug_toolbar/panels/versions.html:6 msgid "Package" msgstr "" #: templates/debug_toolbar/panels/versions.html:7 #, fuzzy msgid "Version" msgstr "Версия Django" ================================================ FILE: debug_toolbar/management/__init__.py ================================================ ================================================ FILE: debug_toolbar/management/commands/__init__.py ================================================ ================================================ FILE: debug_toolbar/management/commands/debugsqlshell.py ================================================ import os from optparse import make_option from django.core.management.base import NoArgsCommand from django.db.backends import util from debug_toolbar.utils import sqlparse class PrintQueryWrapper(util.CursorDebugWrapper): def execute(self, sql, params=()): try: return self.cursor.execute(sql, params) finally: raw_sql = self.db.ops.last_executed_query(self.cursor, sql, params) print sqlparse.format(raw_sql, reindent=True) print util.CursorDebugWrapper = PrintQueryWrapper # The rest is copy/paste from django/core/management/commands/shell.py class Command(NoArgsCommand): option_list = NoArgsCommand.option_list + ( make_option('--plain', action='store_true', dest='plain', help='Tells Django to use plain Python, not IPython.'), ) help = "Runs a Python interactive interpreter. Tries to use IPython, if it's available." requires_model_validation = False def handle_noargs(self, **options): # XXX: (Temporary) workaround for ticket #1796: force early loading of all # models from installed apps. from django.db.models.loading import get_models loaded_models = get_models() use_plain = options.get('plain', False) try: if use_plain: # Don't bother loading IPython, because the user wants plain Python. raise ImportError import IPython # Explicitly pass an empty list as arguments, because otherwise IPython # would use sys.argv from this script. shell = IPython.Shell.IPShell(argv=[]) shell.mainloop() except ImportError: import code # Set up a dictionary to serve as the environment for the shell, so # that tab completion works on objects that are imported at runtime. # See ticket 5082. imported_objects = {} try: # Try activating rlcompleter, because it's handy. import readline except ImportError: pass else: # We don't have to wrap the following import in a 'try', because # we already know 'readline' was imported successfully. import rlcompleter readline.set_completer(rlcompleter.Completer(imported_objects).complete) readline.parse_and_bind("tab:complete") # We want to honor both $PYTHONSTARTUP and .pythonrc.py, so follow system # conventions and get $PYTHONSTARTUP first then import user. if not use_plain: pythonrc = os.environ.get("PYTHONSTARTUP") if pythonrc and os.path.isfile(pythonrc): try: execfile(pythonrc) except NameError: pass # This will import .pythonrc.py as a side-effect import user code.interact(local=imported_objects) ================================================ FILE: debug_toolbar/media/debug_toolbar/Makefile ================================================ # Make file to compress and join all JS files all: compress_js compress_css compress_js: java -jar ~/bin/yuicompressor.jar js/jquery.js > js/toolbar.min.js java -jar ~/bin/yuicompressor.jar js/toolbar.js >> js/toolbar.min.js compress_css: java -jar ~/bin/yuicompressor.jar --type css css/toolbar.css > css/toolbar.min.css ================================================ FILE: debug_toolbar/media/debug_toolbar/css/toolbar.css ================================================ /* http://www.positioniseverything.net/easyclearing.html */ .clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } .clearfix {display: inline-block;} /* Hides from IE-mac \*/ .clearfix {display: block;} * html .clearfix {height: 1%;} /* end hide from IE-mac */ /* Debug Toolbar CSS Reset, adapted from Eric Meyer's CSS Reset */ #djDebug {color:#000;background:#FFF;} #djDebug, #djDebug div, #djDebug span, #djDebug applet, #djDebug object, #djDebug iframe, #djDebug h1, #djDebug h2, #djDebug h3, #djDebug h4, #djDebug h5, #djDebug h6, #djDebug p, #djDebug blockquote, #djDebug pre, #djDebug a, #djDebug abbr, #djDebug acronym, #djDebug address, #djDebug big, #djDebug cite, #djDebug code, #djDebug del, #djDebug dfn, #djDebug em, #djDebug font, #djDebug img, #djDebug ins, #djDebug kbd, #djDebug q, #djDebug s, #djDebug samp, #djDebug small, #djDebug strike, #djDebug strong, #djDebug sub, #djDebug sup, #djDebug tt, #djDebug var, #djDebug b, #djDebug u, #djDebug i, #djDebug center, #djDebug dl, #djDebug dt, #djDebug dd, #djDebug ol, #djDebug ul, #djDebug li, #djDebug fieldset, #djDebug form, #djDebug label, #djDebug legend, #djDebug table, #djDebug caption, #djDebug tbody, #djDebug tfoot, #djDebug thead, #djDebug tr, #djDebug th, #djDebug td { margin:0; padding:0; border:0; outline:0; font-size:12px; line-height:1.5em; color:#000; vertical-align:baseline; background:transparent; font-family:sans-serif; text-align:left; } #djDebug #djDebugToolbar { background:#111; width:200px; z-index:100000000; position:fixed; top:0; bottom:0; right:0; opacity:0.9; } #djDebug #djDebugToolbar small { color:#999; } #djDebug #djDebugToolbar ul { margin:0; padding:0; list-style:none; } #djDebug #djDebugToolbar li { border-bottom:1px solid #222; color:#fff; display:block; font-weight:bold; float:none; margin:0; padding:0; position:relative; width:auto; } #djDebug #djDebugToolbar li>a, #djDebug #djDebugToolbar li>div.contentless { font-weight:normal; font-style:normal; text-decoration:none; display:block; font-size:16px; padding:10px 10px 5px 25px; color:#fff; } #djDebug #djDebugToolbar li a:hover { color:#111; background-color:#ffc; } #djDebug #djDebugToolbar li.active { background-image:url(../img/indicator.png); background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAgFJREFUeNqUlE1LAmEQx11fesNeDLt08hZ4KcgvIF7EgxcR9CT4IQwErx47WhFBdvPgwUNQeOiogiLRQSQUQaKD6Vpba7ar20izMe4+bjTwY5/Zl//OMzPPcCaTaRUwAxbTjynAdAHq84XGARuADQXN+MGEIJG1QmCaOZVK7WKUdmCdYMf7K/hDKwagwjRLPp9/cLvdzUKh8Ab+GgosExGz5hvFSJAbDAYKmFSpVM4DgUABX57l6wsYAR/AO64/MQUyyauiE1SdTqdTC4fDZ61W6x0FRUAAXvEqElGJCP5qzG3H5XIdFovFdCgUOgB3B3AC28AmyekSKSDH3LL2piRJcjabvU4kEnfg8sAL0Me1GulYE+ViQdWq1ep9NBrN9vv9J3B7KPyKOf3EtNAe1VVwzjwez36pVDoKBoMu3KpNs13dlg0FZ+ZwOJx+v3+PHATO6H2r0UOe54fJZPIil8vVSLtMjE7LQsFGo/EYiUSuut3uM/aimjPJSFQnCE0+hVNzE4/Hb1FoyOjBCasHdYKiKPLpdPo0k8k0GY1NKyvTyjIFe71eLRaLHZfLZYFx9AS8jhgR6gXb7faJ1+u9FATBglWU8cMxRjki0RmOMmu9Xo/4fL4y9pmVzEMZBcakGPJfw3YWzRY2rA19dWLLBMNCaAXXNHNPIVFO/zOtZ/YtwADKQgq0l7HbRAAAAABJRU5ErkJggg==); background-repeat:no-repeat; background-position:left center; background-color:#333; padding-left:10px; } #djDebug #djDebugToolbar li.active a:hover { color:#b36a60; background-color:transparent; } #djDebug #djDebugToolbar li small { font-size:12px; color:#999; font-style:normal; text-decoration:none; font-variant:small-caps; } #djDebug #djDebugToolbarHandle { position:fixed; background:#fff; border:1px solid #111; top:30px; right:0; z-index:100000000; opacity:0.75; } #djDebug a#djShowToolBarButton { display:block; height:75px; width:30px; border-right:none; border-bottom:4px solid #fff; border-top:4px solid #fff; border-left:4px solid #fff; color:#fff; font-size:10px; font-weight:bold; text-decoration:none; text-align:center; text-indent:-999999px; background:#000 url(../img/djdt_vertical.png) no-repeat left center; background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAABLCAYAAAACnsWZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAN1wAADdcBQiibeAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAATCSURBVGiB7ZlvSBtnHMe/sckZY5aMw06r7aTLjGOwTKOMEWYs7M2EaaUdjG6+GDoQ9mIyupUxGIONwVZfDHwxg2E4igym24s5sFB0oDRq1yi1G0RijTjhjJBI86fR/LvbC+nFs7ncXR7jMsgXDp67e57vffI8v/s9z3NRAeBQxCr7rwGkVAIkVQmQVCVAUpUASVX0gGqxGxaLBTabDVqtFn6/H5OTk4jFYifJxovLdgwNDXGH1dDQkLVeoY+iH+KiBxSNwaOy2+0wmUyKzH0+H7xer2Koo5IVg/loZGSkuGOwtraW2KOggHt7e8QesmMwEomAZVlF5uvr64qBjko2YEtLC9bW1ogfqFRFn2b+v4CpVIovsyyrOP6OSyrksS8uKysDTdNQq9XY3d1FIpEoAFpGshJma2sr53A4OI/Hw7EsK0jIDMNw4+PjXFdXVyEWDLkr6PV6bmJiQvbs4XK5uJqampMBpCiKW1hYUDzF+Xw+zmAwFB5wcHBQMdxjDQ8PHwug6EtC0zS2trag0+kE16enp7G4uAiv14tUKgWz2Qyr1YrOzk6oVCq+XjweR11dHYLBYDZ7RcpK3tvbK+iRcDjMdXR0iP5Sm83GMQwjaNPX11e4IR4dHRU8bGBgQNKsp6dH0MbpdBYO0OVyCR5mNBolzTQaDZdOp/k2c3NzxICiMwlN03x5e3sboVBIrCqvZDIJhmH4c6PRKNlGSqKrGYqi+HJFRQX6+/tlGWq12qxlEmXt2pWVlbxTzGMtLS0VbogjkQjxLw+Hw8QeooA7OzvE5n6/n9hDNAbdbrfibeZRLS8vE7UH8lxunaSKfkUte9MEAAa6EhrqVNZ7HAc8DETBpo935a1oiJ1zH6O5rUH0fmI/iQ2PH1Nji/jpuxlwHHn0KOpBKVFaDRqbz6Gx+RysdjOudn9P7FmwGGy/+DLa3rQQ++QNmEykEA3t8UcsGn+izhvvvEIEBxAM8c2xO/iy74bgWu35KjhmPkLt+SoAwFnTaTI6HPMQMxsBLM1mvgdqdVSO2vKkqAdvXL+FuzOrYFkOd/9YzVqHfsbAlze95NNlnht3FQx0JU6pyxDejSGZyHyFOGs6DWu7GVVnjLh3+wGWZ8m+sMoGfLG1Ht3vvwZruxn1jdWCDVJgO4R7tx9gauwO5iZXiIAUA+r05fhi9D28/pZVluH9+XV8ctmBoJ98qQVIAGooNUZmr+KlV59TZMpsBHCl6Ss8Cu+T8uV+iz/4+qJiOOAg3Xz47eW8oQ5LtAcNdCWmtr55IlX8Oe3BX4sb2PTuIJ1Ko95cjResz6Kt0yKIy0Q8hY66awgFHxEBiqaZC91NArhYZB+fvu3E/M2/s9a32Ey4/ks/qs4c7OSocjUudDfhtx9cRICiQ9zc9rzgfPjzSVE44ODlGLr2q+BaPuFxVKKA9eZqwfnvP85Lmt362Q2WzURMfWN1jtryJApooCv5cmA7hGhI+j+PVDKNAPOQP9cbKwjxcsSghsrcKq/Q4FK/XZYhpdVk2h0q5ytRwFg0k8OeelqHzxzvKjbPtgRTKtEhjkXIzQuaqIM75FNV0C/9wUlKokPscW8SLzhXl/8hag+UNu7kKgGSqgRIqhIgqUqApCp6wH8B9cAOKo9Os8wAAAAASUVORK5CYII=); opacity:0.5; } #djDebug a#djShowToolBarButton:hover { background-color:#111; padding-right:6px; border-top-color:#FFE761; border-left-color:#FFE761; border-bottom-color:#FFE761; opacity:1.0; } #djDebug code { display:block; font-family:Consolas, Monaco, "Bitstream Vera Sans Mono", "Lucida Console", monospace; white-space:pre; overflow:auto; } #djDebug tr.djDebugOdd { background-color:#f5f5f5; } #djDebug .panelContent { display:none; position:fixed; margin:0; top:0; right:200px; bottom:0; left:0px; background-color:#eee; color:#666; z-index:100000000; } #djDebug .panelContent > div { border-bottom:1px solid #ddd; } #djDebug .djDebugPanelTitle { position:absolute; background-color:#ffc; color:#666; padding-left:20px; top:0; right:0; left:0; height:50px; } #djDebug .djDebugPanelTitle code { display:inline; font-size:inherit; } #djDebug .djDebugPanelContent { position:absolute; top:50px; right:0; bottom:0; left:0; height:auto; padding:5px 0 0 20px; } #djDebug .djDebugPanelContent .scroll { height:100%; overflow:auto; display:block; padding:0 10px 0 0; } #djDebug h3 { font-size:24px; font-weight:normal; line-height:50px; } #djDebug h4 { font-size:20px; font-weight:bold; margin-top:0.8em; } #djDebug .panelContent table { border:1px solid #ccc; border-collapse:collapse; width:100%; background-color:#fff; display:block; margin-top:0.8em; overflow: auto; } #djDebug .panelContent tbody td, #djDebug .panelContent tbody th { vertical-align:top; padding:2px 3px; } #djDebug .panelContent thead th { padding:1px 6px 1px 3px; text-align:left; font-weight:bold; font-size:14px; } #djDebug .panelContent tbody th { width:12em; text-align:right; color:#666; padding-right:.5em; } #djDebug .djTemplateHideContextDiv { background-color:#fff; } /* #djDebug .panelContent p a:hover, #djDebug .panelContent dd a:hover { color:#111; background-color:#ffc; } #djDebug .panelContent p { padding:0 5px; } #djDebug .panelContent p, #djDebug .panelContent table, #djDebug .panelContent ol, #djDebug .panelContent ul, #djDebug .panelContent dl { margin:5px 0 15px; background-color:#fff; } #djDebug .panelContent table { clear:both; border:0; padding:0; margin:0; border-collapse:collapse; border-spacing:0; } #djDebug .panelContent table a { color:#000; padding:2px 4px; } #djDebug .panelContent table a:hover { background-color:#ffc; } #djDebug .panelContent table th { background-color:#333; font-weight:bold; color:#fff; padding:3px 7px 3px; text-align:left; cursor:pointer; } #djDebug .panelContent table td { padding:5px 10px; font-size:14px; background:#fff; color:#000; vertical-align:top; border:0; } #djDebug .panelContent table tr.djDebugOdd td { background:#eee; } */ #djDebug .panelContent .djDebugClose { text-indent:-9999999px; display:block; position:absolute; top:4px; right:15px; height:40px; width:40px; background:url(../img/close.png) no-repeat center center; background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA7dJREFUeNqsWM1PE0EU3+7ShdJKoTRA8UYgIUKM3rmaEI0euXsw0YMHIZEbxBijEiIHLkb/A44SDYlXzkYPGBM+ri1NWz7aUmhp6+9tps10mLfdfrzkl2535r39zc77mvUdHh4abUoUCAD3xP/fQAFItWJkYmLC+e1p8eGPgQcC08ycf8BPgW2vhr0SeQa8AWIe5k4LvATiwCrwtZmS2WT8IfAL+OKRhCoxoftH2GqLyBLwHbhvdC53ha2lVrfmE/DKzbLP5yubplnt7e310f+rq6tqpVLxVatVy0VtHbgNLHohsupGIhQKFQG7v79f+8CLiwsjl8sVAZsxQbYTwFrDwpTwpaj4ptPu6+vLDw4OBkHA014QobOzs3yhUAgyUx4BP2rhq/rIe53GwMBAeXx83DMJEpobi8WCpMtMWeOc9TkwoyMRjUattrMedBkyM+KZN4isqDMDgUCuExIyGbKlGVpRiSzo8kQ4HA4ZXRLGVuzo6GhBJjKviw6dT5TLZSOTyRinp6cGQrV+n67hnEY6nTaur6+1PkM2NWTm5fCd0xDRhh89CKHpXCMijLGxMef6+PjYiRSSUqlUv6/arOlKMlcjQlV0qsGDTZPehpYIxurXRCSRSFByq5NQ56hvhWwj8cm2p7A9UdKYVBX8fn+F2+tIJGIgmzaQkUnYtm0MDw+zvsLYniQiEc2q/WxxwmqRHxrISA9xxiyLDzTGdsRsJwJoK3QPo3vctnhpAzLqTexhiVOg6JAdU5bLy0vHZ+Ro8mg7Q0QO1LvwenZZJycnN3yCIPsMRRYnjO0DU/SY+wprW7fiWmjKJMgnUIcafEaeoxZCJWJI9lH4UjV2u6pSPp/XJR9jaGiIKrERDAbrjllzYOQJZ4zm6ISxuSsntB3gqTyazWZtMowa0aBFb4HegC6aRkZG2C2hLSObmqEdOcVvUdJUZyBlZ7tVa1ASdEUvjW3ZUqvvO82e3kqlUuVOSZANvBFd0fugawM2VKclOT8/tzohQ7pkgzn/rHNdvLbLJkPxeDzHRRIXIaTDkCB57XacoJPZW8bZQpSskslk0Y0QjdEcmstsB8myegrsYbqmENfJU3dOpZyOEwjdCqLIWUyxWKygVzHFccJ2eVkbar/qdq5ZFC3/R5dUb6EBsqQmyEtLuawj0eykRwpPgL0uRO+esLXW7tmX9nEWeAEk2yCQFLqzzb4MeK3Zn4FRsapNEXqGy2eJTTF3VOh27bOE/Ia2pQ81YeCO+P+XknGrH2pq8l+AAQDv/n2Gmq99BgAAAABJRU5ErkJggg==); } #djDebug .panelContent .djDebugClose:hover { background-image:url(../img/close_hover.png); background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABCVJREFUeNqsWG1IU1EYfjfd0i1bTc2WFTW3tG2aFWlEf4KkMIrCvhH6U9DnjxTyV0ZEXxIVGBH1JyKIPiBK8kf1syCKwu8M3VQsK7OV6ba2udZ7bmd6d+85827zhYftnnPe5z73nvc95z1X5XQ6IUHLQqQjiul1E8KHGIqHxGw2C7+pcd58E6KMooAzphPxnKJBKbFSIfsRpxAmBWMLKI4iviBOIm5O5qSepL8c8R5xQ6EIqZmobzPlSkhINeIpYhkkb0WUqzreqbmEOBaTOjQGf/0+CHz7Klxqc+aAehrGbkrM2b6IyEVUKRFyMpYI38dW8HS0gc/5kdmfnpcPepsD0vMLeRSEm6ivEzeqJOlLsuIJyzs40Au/Xr+CP64uRXORZraCoXQ1aHMX8YZsRDRG0lcqpA1hl3p4mt+C+/nThILDWLYR9EtXsrraEY6IEHGwHmCJGG16k7AIYsTX0/KO1WWn95QJqZWODHxyws8XjUmnjPtZg8DFsFqpkB2sdWL4zWuYKuNwmVwu1w6xkA2s7GAFpnaGAcxbd8H8snJQa7QTUZ+aCrlr10NexR5Iy8yW+REuwsmwDeL0XSOLjfYW5pNZtldC9orS/4FoK4LWa5cgHP4L9n1HILNoudCuM82F1qsXgcXJSOs1ESFkF7WKe8JBfxifQMVMY8/o+P+Z+TYoPFwNoYAfMh3FE2udz8d8CPJWCLdKM03MbcXpySJTY5EtmsNuFW+uex4/gJFe14SYxUuiRHi/fIaue7f5CzKb20KEGKWtYx4Pl2jM54WW+joY6euR9Xm/DkDT5bMQHB3h+7O5jepEMiAUDDBvRtpCfn9CWUWEuGUbkF7PdSDZQQLTaC+S9Rks+VB4qCoqmxRyu4mQbmlrisEY5hEtLN8ynh2RmBjt74sK4LyK3VwhHO5uNa0xoxYMEtVk02KZbk7uxB400C/ERPOVc1EBrMsxcTdCScYQ68L9ZiiyjryUprC+wM5c0PoaH4EmIwMCv4eh6+6t8VghAWzdtVdYzHoaHjKFEE6GvRTvvmSZvScd8f3hHfjT2z0lS3zaQgtkb6tkde3EN3I/kjX3ET9kwVdSOmV7jaF0Fav5BxEh3X3PyPaVBVaYta48aRGkJtHOt7C6zrPKgMvSoCU2vbhEIEpGBKcw6qQ1LLNmrWaVioRIk2kUtvK4SsWSVaCdl8cbcjxW8UxOZqcRJ2TThITZCO+HZvB2dsQsnnUFNtAtWRpLZ430FKjinH0VHSdCXg8EhwaFS03WbEjR6Sc7TkRCoErp2beKlvwX+EtkKqRkGATEYTXSY4SSkx5x2Eyr7WStnXLVJXr2JfPoQBxEDCYgYJD6Oib7MqC0DLiOyKFPVU9TD2J8lqinY3Oo75R9lhC/oQbRhxoSIDZ63UGK9Xg/1ETsnwADAJrrTk7nZiozAAAAAElFTkSuQmCC); } #djDebug .panelContent .djDebugClose.djDebugBack { background-image:url(../img/back.png); background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA7FJREFUeNrMWM1PE0EU3+7S7bZdKSFNSIFgJJAgINE7VxOi0SP/gYkePAiJ3CDGGJUQOXAx+h9wlGhIvHI2fgQ08mEkkjZNIZR2+7Httr63zMoyOzPdthx8yS+bnZn3m9/OvDcfG9jd3ZVatDggDLhO3j8DioBMMySDg4P2s6PJzu8AbhKMcNr8AHwkWPNL7FfIPcATQMJH2xGCh4AkYAHwtpGT3KD+FuAT4I1PEbQliO8XwtWSkFnAe8ANqX2bIFyzzU7NK8AjEXMgELBkWa6HQqEAvpfL5XqtVgvU63VF4LYE6APM+BGyIBKh67oJUCORCLPDQqEg5fN5E6ByKJA7BVg892FU+mJWvGN5a5pmdHV1RUGAr7lAQdls1igWi1FOk9uAD0760jHynOXR2dlp9fb2+haBhm0TiUQUfTlNFnnBeh8wxhIRj8eVllc98OWIGSN9eoTM0y3D4XC+HRFuMcjFqJqnhUyz1olYLKa730uVCrMjXrmIy1ln9vb2pt1CpljZQcdE1ihIW/sHHrayWbHLq1ZNGDPIyaiacguZZAhhph+K+fpr39Ppqcg/wtHhcE46QnAXHT4XwbJssjJECwbtp1EqS99AjNNpSD0r//77wH7yRgW5qeJhmJ44ChmiHYLBIHOMY9GINDrQ9y8uHDEoEMs7FNl+x5HhieFwD6GQbs8GJMtBbtCBmIkrA3anOD0YH2ci+21RWJ4vldibG5u7W5b+E8O95oguhM0LP1PhBauTOfj1Tnxg+c+DpD0aOFq6pjE75HAfoZAdunGlUpH9iLh6uc9+nsaFt5xlHO4dmZwxtynVKm5avIUrqoWkaxAnTmdOnGC5SARyIjdVvA0bX8ZRt0E7GYZhNgpWb0b1c0UIODfcC9o6XZvL5VTYwrnp6zaMEyd9eYZcyMmoWncLWQUcemIim82xFjTeQiey4+Nj1qZ3CNOySu++zxhzeimTyVjtpiZywIiwNr0XrGPAMh20aCcnJ0o7YtAXOTj3nyXeKZ55ykaiZDKZZ2WS6KiIPhwRaI9F1wm8mT3lBJueSqWkdDptigRhHbbBtpzpQJujb4EdnFOTzjvJ4+kcYF8nFEWpqapqf4xpmjXLsmRynVAFg7VMn1dF95oZcuR/yWPDDqvVKsIp8nOknGOJaHTTQ4e7gM0L2NM2Cddiq3dfnMdxwANAugUBaeI73ujPgN9jwGtAD/mqFZJ6kuC3xApp20N8L+y3hHuE1lw/amKAUfK+hYtxsz9qHPsrwACHs5P9Qys/0AAAAABJRU5ErkJggg==); } #djDebug .panelContent .djDebugClose.djDebugBack:hover { background-image:url(../img/back_hover.png); background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA6hJREFUeNrMWF1Ik1EYPtt0pkuGa/aDJTY3nNvSfkglvEwQpa7CbrosKAghBedNikKgEgVe1m03SVeJXmSXBmIozpxpuiUS/eicSc75m73vx/nGt7Nzvm8/BR14+Pjec85znp297znv++kCgQBJs1kBuYDz9H0KEAWEUiGx2WzSMyvFxa8B6iicgjFzgBGKwWSJdUnuyB1AF+BUisK/AToBz7V2RK9B1ACYBDxLQwShc3Cuj3IJm5qQVsAQ4ALJvFVQrlbRAJGPPAE8UKU+2Ce/d6Jk98d36dV44iTR54DvGlTd7jGgCNCSjJBONRHR+Q8kMjtDooF5bn9uaRkxuTwkt+yciAK5UX2fmrNiVLzmzd77ukR+jr0j28GFpP6LIzYHMVdfIcais6IhjYBh2VlZITMANzsj4ntPwiNDaTmHpa6RmCov87r8AA8vau7yRGxOjactAhvOjUxP8LrcdM0EIR3syN0vAbL+djjjkAm/GZS4OK2DFdLEOyc2xsfi/3frcb4/COxqXPI5EwwGm5RC6nnRwTpmgdNNKpq9iZFiLZTsWXkmoRDkQk5Oq1cKqU3wDf80lxDFXGzvTlhUFqm2OwLOWlkI3qIOZc/h3s4hL0y3QyvSM7+4hFxq74otGg2txuyVzW3SU7QryM2YHfD3WFGIPeHQ3AjreETrc34y3d8b8wtZDApE+/5WRHrHnRGJEXDbUYiFte5HIsLtRTGTPR3Sovj3oH8oRaIotB8t5h9kAm6LnvwnDe+acILRJPZ+ZeTgr5f9A+2u2/el3cDd2lz+zF+Qzx1GIYus1WC2oEPptET4+vukp+wXrJ3XBNyLeppjxoWILjtHh5eW6OD6tbxEJno6Y4vJfoJ2NRHIidyMeQHum5DsI6PsJJPTremsvIgSiVDhHFXevnjMvmRHrL56QbaXFuN2hLeQyB43psROCm/c4nXdhB0ZkHdkALDGjjBXVXMPNNFBp9bM1TU88xqKYG/fR+woY7GDFFxtyDg0MScxnrHzunpEGdon9rj/h4kR1j/logKrlZcqIlH2MYt0laeUKlbVEOPpUtGQNq0CqxvwUDR766OPbM3NqibPeU4XySuvVNPplZNnUc6aUjlxACG8Rx01GyLHgKmBQbOKfaosJ7Rq3xaa8vcK6WBBQ75ZQgrNy5YRyVR6OOE6zbYzbX7K1ZdOyUloNe8B3AOspCFghc71aH0Z0KX4feSvf5bQctZkP9Sgg7jo+ywm6+l+qPkjwADNS26fFM/O1QAAAABJRU5ErkJggg==); } #djDebug .panelContent dt, #djDebug .panelContent dd { display:block; } #djDebug .panelContent dt { margin-top:0.75em; } #djDebug .panelContent dd { margin-left:10px; } #djDebug a.toggleTemplate { padding:4px; background-color:#bbb; -moz-border-radius:3px; -webkit-border-radius:3px; } #djDebug a.toggleTemplate:hover { padding:4px; background-color:#444; color:#ffe761; -moz-border-radius:3px; -webkit-border-radius:3px; } #djDebug a.djTemplateShowContext, #djDebug a.djTemplateShowContext span.toggleArrow { color:#999; } #djDebug a.djTemplateShowContext:hover, #djDebug a.djTemplateShowContext:hover span.toggleArrow { color:#000; cursor:pointer; } #djDebug .djDebugSqlWrap { position:relative; } #djDebug .djDebugCollapse { display: inline-block; background: #ddd; background: url(data:image/gif;base64,R0lGODlhBgAKAJEDAJGRkdra2qysrP///yH5BAEAAAMALAAAAAAGAAoAAAIPnI+JIRImABBQ0sGc2qoAADs=) 0 3px repeat-x; width: 18px; text-indent: -10000em; } #djDebug .djSelected .djDebugCollapse { background: inherit; text-indent: 0; width: auto; display: inline; } #djDebug .djUnselected { display: none; } #djDebug tr.djHiddenByDefault { display: none; } #djDebug tr.djSelected { display: table-row; } #djDebug .djDebugSql { z-index:100000002; } #djDebug .djSQLDetailsDiv tbody th { text-align: left; } #djDebug .djSqlExplain td { white-space: pre; } #djDebug span.djDebugLineChart { background-color:#777; height:3px; position:absolute; bottom:0; top:0; left:0; display:block; z-index:1000000001; } #djDebug span.djDebugLineChartWarning { background-color:#900; } #djDebug .highlight { color:#000; } #djDebug .highlight .err { color:#000; } /* Error */ #djDebug .highlight .g { color:#000; } /* Generic */ #djDebug .highlight .k { color:#000; font-weight:bold } /* Keyword */ #djDebug .highlight .o { color:#000; } /* Operator */ #djDebug .highlight .n { color:#000; } /* Name */ #djDebug .highlight .mi { color:#000; font-weight:bold } /* Literal.Number.Integer */ #djDebug .highlight .l { color:#000; } /* Literal */ #djDebug .highlight .x { color:#000; } /* Other */ #djDebug .highlight .p { color:#000; } /* Punctuation */ #djDebug .highlight .m { color:#000; font-weight:bold } /* Literal.Number */ #djDebug .highlight .s { color:#333 } /* Literal.String */ #djDebug .highlight .w { color:#888888 } /* Text.Whitespace */ #djDebug .highlight .il { color:#000; font-weight:bold } /* Literal.Number.Integer.Long */ #djDebug .highlight .na { color:#333 } /* Name.Attribute */ #djDebug .highlight .nt { color:#000; font-weight:bold } /* Name.Tag */ #djDebug .highlight .nv { color:#333 } /* Name.Variable */ #djDebug .highlight .s2 { color:#333 } /* Literal.String.Double */ #djDebug .highlight .cp { color:#333 } /* Comment.Preproc */ #djDebug .timeline { width: 30%; } #djDebug .djDebugTimeline { position: relative; height: 100%; min-height: 100%; } #djDebug div.djDebugLineChart { position: absolute; left: 0; right: 0; top: 0; bottom: 0; vertical-align: middle; } #djDebug div.djDebugLineChart strong { text-indent: -10000em; display: block; font-weight: normal; vertical-align: middle; background-color:#ccc; } #djDebug div.djDebugLineChartWarning strong { background-color:#900; } #djDebug .djDebugInTransaction div.djDebugLineChart strong { background-color: #d3ff82; } #djDebug .djDebugStartTransaction div.djDebugLineChart strong { border-left: 1px solid #94b24d; } #djDebug .djDebugEndTransaction div.djDebugLineChart strong { border-right: 1px solid #94b24d; } #djDebug .djDebugHover div.djDebugLineChart strong { background-color: #000; } #djDebug .djDebugInTransaction.djDebugHover div.djDebugLineChart strong { background-color: #94b24d; } #djDebug .panelContent ul.stats { position: relative; } #djDebug .panelContent ul.stats li { width: 30%; float: left; } #djDebug .panelContent ul.stats li strong.label { display: block; } #djDebug .panelContent ul.stats li span.color { height: 12px; width: 3px; display: inline-block; } #djDebug .panelContent ul.stats li span.info { display: block; padding-left: 5px; } #djDebug .panelcontent thead th { white-space: nowrap; } #djDebug .djDebugRowWarning .time { color: red; } #djdebug .panelcontent table .toggle { width: 14px; padding-top: 3px; } #djdebug .panelcontent table .actions { min-width: 70px; } #djdebug .panelcontent table .color { width: 3px; } #djdebug .panelcontent table .color span { width: 3px; height: 12px; overflow: hidden; padding: 0; } #djDebug .djToggleSwitch { text-decoration: none; border: 1px solid #999; height: 12px; width: 12px; line-height: 12px; text-align: center; color: #777; display: inline-block; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFF', endColorstr='#DCDCDC'); /* for IE */ background: -webkit-gradient(linear, left top, left bottom, from(#FFF), to(#DCDCDC)); /* for webkit browsers */ background:-moz-linear-gradient(center top , #FFFFFF 0pt, #DCDCDC 100%) repeat scroll 0 0 transparent; } #djDebug .djNoToggleSwitch { height: 14px; width: 14px; display: inline-block; } #djDebug .djSQLDetailsDiv { margin-top:0.8em; } #djDebug .djSQLDetailsDiv pre { color: #777; border:1px solid #ccc; border-collapse:collapse; background-color:#fff; display:block; overflow: auto; padding:2px 3px; margin-bottom: 3px; font-family:Consolas, Monaco, "Bitstream Vera Sans Mono", "Lucida Console", monospace; } #djDebug .stack span { color: #000; font-weight: bold; } #djDebug .stack span.path { color: #777; font-weight: normal; } #djDebug .stack span.code { font-weight: normal; } @media print { #djDebug { display: none; } } ================================================ FILE: debug_toolbar/media/debug_toolbar/js/jquery.cookie.js ================================================ /** * Cookie plugin * * Copyright (c) 2006 Klaus Hartl (stilbuero.de) * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * */ /** * Create a cookie with the given name and value and other optional parameters. * * @example $.cookie('the_cookie', 'the_value'); * @desc Set the value of a cookie. * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true }); * @desc Create a cookie with all available options. * @example $.cookie('the_cookie', 'the_value'); * @desc Create a session cookie. * @example $.cookie('the_cookie', null); * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain * used when the cookie was set. * * @param String name The name of the cookie. * @param String value The value of the cookie. * @param Object options An object literal containing key/value pairs to provide optional cookie attributes. * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object. * If a negative value is specified (e.g. a date in the past), the cookie will be deleted. * If set to null or omitted, the cookie will be a session cookie and will not be retained * when the the browser exits. * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie). * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie). * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will * require a secure protocol (like HTTPS). * @type undefined * * @name $.cookie * @cat Plugins/Cookie * @author Klaus Hartl/klaus.hartl@stilbuero.de */ /** * Get the value of a cookie with the given name. * * @example $.cookie('the_cookie'); * @desc Get the value of a cookie. * * @param String name The name of the cookie. * @return The value of the cookie. * @type String * * @name $.cookie * @cat Plugins/Cookie * @author Klaus Hartl/klaus.hartl@stilbuero.de */ jQuery.cookie = function(name, value, options) { if (typeof value != 'undefined') { // name and value given, set cookie options = options || {}; if (value === null) { value = ''; options.expires = -1; } var expires = ''; if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { var date; if (typeof options.expires == 'number') { date = new Date(); date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)); } else { date = options.expires; } expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE } // CAUTION: Needed to parenthesize options.path and options.domain // in the following expressions, otherwise they evaluate to undefined // in the packed version for some reason... var path = options.path ? '; path=' + (options.path) : ''; var domain = options.domain ? '; domain=' + (options.domain) : ''; var secure = options.secure ? '; secure' : ''; document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); } else { // only name given, get cookie var cookieValue = null; if (document.cookie && document.cookie != '') { var cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) { var cookie = jQuery.trim(cookies[i]); // Does this cookie string begin with the name we want? if (cookie.substring(0, name.length + 1) == (name + '=')) { cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); break; } } } return cookieValue; } }; ================================================ FILE: debug_toolbar/media/debug_toolbar/js/jquery.js ================================================ /*! * jQuery JavaScript Library v1.4.1 * http://jquery.com/ * * Copyright 2010, John Resig * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * * Includes Sizzle.js * http://sizzlejs.com/ * Copyright 2010, The Dojo Foundation * Released under the MIT, BSD, and GPL Licenses. * * Date: Mon Jan 25 19:43:33 2010 -0500 */ (function( window, undefined ) { // Define a local copy of jQuery var jQuery = function( selector, context ) { // The jQuery object is actually just the init constructor 'enhanced' return new jQuery.fn.init( selector, context ); }, // Map over jQuery in case of overwrite _jQuery = window.jQuery, // Map over the $ in case of overwrite _$ = window.$, // Use the correct document accordingly with window argument (sandbox) document = window.document, // A central reference to the root jQuery(document) rootjQuery, // A simple way to check for HTML strings or ID strings // (both of which we optimize for) quickExpr = /^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/, // Is it a simple selector isSimple = /^.[^:#\[\.,]*$/, // Check if a string has a non-whitespace character in it rnotwhite = /\S/, // Used for trimming whitespace rtrim = /^(\s|\u00A0)+|(\s|\u00A0)+$/g, // Match a standalone tag rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, // Keep a UserAgent string for use with jQuery.browser userAgent = navigator.userAgent, // For matching the engine and version of the browser browserMatch, // Has the ready events already been bound? readyBound = false, // The functions to execute on DOM ready readyList = [], // The ready event handler DOMContentLoaded, // Save a reference to some core methods toString = Object.prototype.toString, hasOwnProperty = Object.prototype.hasOwnProperty, push = Array.prototype.push, slice = Array.prototype.slice, indexOf = Array.prototype.indexOf; jQuery.fn = jQuery.prototype = { init: function( selector, context ) { var match, elem, ret, doc; // Handle $(""), $(null), or $(undefined) if ( !selector ) { return this; } // Handle $(DOMElement) if ( selector.nodeType ) { this.context = this[0] = selector; this.length = 1; return this; } // Handle HTML strings if ( typeof selector === "string" ) { // Are we dealing with HTML string or an ID? match = quickExpr.exec( selector ); // Verify a match, and that no context was specified for #id if ( match && (match[1] || !context) ) { // HANDLE: $(html) -> $(array) if ( match[1] ) { doc = (context ? context.ownerDocument || context : document); // If a single string is passed in and it's a single tag // just do a createElement and skip the rest ret = rsingleTag.exec( selector ); if ( ret ) { if ( jQuery.isPlainObject( context ) ) { selector = [ document.createElement( ret[1] ) ]; jQuery.fn.attr.call( selector, context, true ); } else { selector = [ doc.createElement( ret[1] ) ]; } } else { ret = buildFragment( [ match[1] ], [ doc ] ); selector = (ret.cacheable ? ret.fragment.cloneNode(true) : ret.fragment).childNodes; } // HANDLE: $("#id") } else { elem = document.getElementById( match[2] ); if ( elem ) { // Handle the case where IE and Opera return items // by name instead of ID if ( elem.id !== match[2] ) { return rootjQuery.find( selector ); } // Otherwise, we inject the element directly into the jQuery object this.length = 1; this[0] = elem; } this.context = document; this.selector = selector; return this; } // HANDLE: $("TAG") } else if ( !context && /^\w+$/.test( selector ) ) { this.selector = selector; this.context = document; selector = document.getElementsByTagName( selector ); // HANDLE: $(expr, $(...)) } else if ( !context || context.jquery ) { return (context || rootjQuery).find( selector ); // HANDLE: $(expr, context) // (which is just equivalent to: $(context).find(expr) } else { return jQuery( context ).find( selector ); } // HANDLE: $(function) // Shortcut for document ready } else if ( jQuery.isFunction( selector ) ) { return rootjQuery.ready( selector ); } if (selector.selector !== undefined) { this.selector = selector.selector; this.context = selector.context; } return jQuery.isArray( selector ) ? this.setArray( selector ) : jQuery.makeArray( selector, this ); }, // Start with an empty selector selector: "", // The current version of jQuery being used jquery: "1.4.1", // The default length of a jQuery object is 0 length: 0, // The number of elements contained in the matched element set size: function() { return this.length; }, toArray: function() { return slice.call( this, 0 ); }, // Get the Nth element in the matched element set OR // Get the whole matched element set as a clean array get: function( num ) { return num == null ? // Return a 'clean' array this.toArray() : // Return just the object ( num < 0 ? this.slice(num)[ 0 ] : this[ num ] ); }, // Take an array of elements and push it onto the stack // (returning the new matched element set) pushStack: function( elems, name, selector ) { // Build a new jQuery matched element set var ret = jQuery( elems || null ); // Add the old object onto the stack (as a reference) ret.prevObject = this; ret.context = this.context; if ( name === "find" ) { ret.selector = this.selector + (this.selector ? " " : "") + selector; } else if ( name ) { ret.selector = this.selector + "." + name + "(" + selector + ")"; } // Return the newly-formed element set return ret; }, // Force the current matched set of elements to become // the specified array of elements (destroying the stack in the process) // You should use pushStack() in order to do this, but maintain the stack setArray: function( elems ) { // Resetting the length to 0, then using the native Array push // is a super-fast way to populate an object with array-like properties this.length = 0; push.apply( this, elems ); return this; }, // Execute a callback for every element in the matched set. // (You can seed the arguments with an array of args, but this is // only used internally.) each: function( callback, args ) { return jQuery.each( this, callback, args ); }, ready: function( fn ) { // Attach the listeners jQuery.bindReady(); // If the DOM is already ready if ( jQuery.isReady ) { // Execute the function immediately fn.call( document, jQuery ); // Otherwise, remember the function for later } else if ( readyList ) { // Add the function to the wait list readyList.push( fn ); } return this; }, eq: function( i ) { return i === -1 ? this.slice( i ) : this.slice( i, +i + 1 ); }, first: function() { return this.eq( 0 ); }, last: function() { return this.eq( -1 ); }, slice: function() { return this.pushStack( slice.apply( this, arguments ), "slice", slice.call(arguments).join(",") ); }, map: function( callback ) { return this.pushStack( jQuery.map(this, function( elem, i ) { return callback.call( elem, i, elem ); })); }, end: function() { return this.prevObject || jQuery(null); }, // For internal use only. // Behaves like an Array's method, not like a jQuery method. push: push, sort: [].sort, splice: [].splice }; // Give the init function the jQuery prototype for later instantiation jQuery.fn.init.prototype = jQuery.fn; jQuery.extend = jQuery.fn.extend = function() { // copy reference to target object var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options, name, src, copy; // Handle a deep copy situation if ( typeof target === "boolean" ) { deep = target; target = arguments[1] || {}; // skip the boolean and the target i = 2; } // Handle case when target is a string or something (possible in deep copy) if ( typeof target !== "object" && !jQuery.isFunction(target) ) { target = {}; } // extend jQuery itself if only one argument is passed if ( length === i ) { target = this; --i; } for ( ; i < length; i++ ) { // Only deal with non-null/undefined values if ( (options = arguments[ i ]) != null ) { // Extend the base object for ( name in options ) { src = target[ name ]; copy = options[ name ]; // Prevent never-ending loop if ( target === copy ) { continue; } // Recurse if we're merging object literal values or arrays if ( deep && copy && ( jQuery.isPlainObject(copy) || jQuery.isArray(copy) ) ) { var clone = src && ( jQuery.isPlainObject(src) || jQuery.isArray(src) ) ? src : jQuery.isArray(copy) ? [] : {}; // Never move original objects, clone them target[ name ] = jQuery.extend( deep, clone, copy ); // Don't bring in undefined values } else if ( copy !== undefined ) { target[ name ] = copy; } } } } // Return the modified object return target; }; jQuery.extend({ noConflict: function( deep ) { window.$ = _$; if ( deep ) { window.jQuery = _jQuery; } return jQuery; }, // Is the DOM ready to be used? Set to true once it occurs. isReady: false, // Handle when the DOM is ready ready: function() { // Make sure that the DOM is not already loaded if ( !jQuery.isReady ) { // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). if ( !document.body ) { return setTimeout( jQuery.ready, 13 ); } // Remember that the DOM is ready jQuery.isReady = true; // If there are functions bound, to execute if ( readyList ) { // Execute all of them var fn, i = 0; while ( (fn = readyList[ i++ ]) ) { fn.call( document, jQuery ); } // Reset the list of functions readyList = null; } // Trigger any bound ready events if ( jQuery.fn.triggerHandler ) { jQuery( document ).triggerHandler( "ready" ); } } }, bindReady: function() { if ( readyBound ) { return; } readyBound = true; // Catch cases where $(document).ready() is called after the // browser event has already occurred. if ( document.readyState === "complete" ) { return jQuery.ready(); } // Mozilla, Opera and webkit nightlies currently support this event if ( document.addEventListener ) { // Use the handy event callback document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); // A fallback to window.onload, that will always work window.addEventListener( "load", jQuery.ready, false ); // If IE event model is used } else if ( document.attachEvent ) { // ensure firing before onload, // maybe late but safe also for iframes document.attachEvent("onreadystatechange", DOMContentLoaded); // A fallback to window.onload, that will always work window.attachEvent( "onload", jQuery.ready ); // If IE and not a frame // continually check to see if the document is ready var toplevel = false; try { toplevel = window.frameElement == null; } catch(e) {} if ( document.documentElement.doScroll && toplevel ) { doScrollCheck(); } } }, // See test/unit/core.js for details concerning isFunction. // Since version 1.3, DOM methods and functions like alert // aren't supported. They return false on IE (#2968). isFunction: function( obj ) { return toString.call(obj) === "[object Function]"; }, isArray: function( obj ) { return toString.call(obj) === "[object Array]"; }, isPlainObject: function( obj ) { // Must be an Object. // Because of IE, we also have to check the presence of the constructor property. // Make sure that DOM nodes and window objects don't pass through, as well if ( !obj || toString.call(obj) !== "[object Object]" || obj.nodeType || obj.setInterval ) { return false; } // Not own constructor property must be Object if ( obj.constructor && !hasOwnProperty.call(obj, "constructor") && !hasOwnProperty.call(obj.constructor.prototype, "isPrototypeOf") ) { return false; } // Own properties are enumerated firstly, so to speed up, // if last one is own, then all properties are own. var key; for ( key in obj ) {} return key === undefined || hasOwnProperty.call( obj, key ); }, isEmptyObject: function( obj ) { for ( var name in obj ) { return false; } return true; }, error: function( msg ) { throw msg; }, parseJSON: function( data ) { if ( typeof data !== "string" || !data ) { return null; } // Make sure the incoming data is actual JSON // Logic borrowed from http://json.org/json2.js if ( /^[\],:{}\s]*$/.test(data.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@") .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]") .replace(/(?:^|:|,)(?:\s*\[)+/g, "")) ) { // Try to use the native JSON parser first return window.JSON && window.JSON.parse ? window.JSON.parse( data ) : (new Function("return " + data))(); } else { jQuery.error( "Invalid JSON: " + data ); } }, noop: function() {}, // Evalulates a script in a global context globalEval: function( data ) { if ( data && rnotwhite.test(data) ) { // Inspired by code by Andrea Giammarchi // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html var head = document.getElementsByTagName("head")[0] || document.documentElement, script = document.createElement("script"); script.type = "text/javascript"; if ( jQuery.support.scriptEval ) { script.appendChild( document.createTextNode( data ) ); } else { script.text = data; } // Use insertBefore instead of appendChild to circumvent an IE6 bug. // This arises when a base node is used (#2709). head.insertBefore( script, head.firstChild ); head.removeChild( script ); } }, nodeName: function( elem, name ) { return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); }, // args is for internal usage only each: function( object, callback, args ) { var name, i = 0, length = object.length, isObj = length === undefined || jQuery.isFunction(object); if ( args ) { if ( isObj ) { for ( name in object ) { if ( callback.apply( object[ name ], args ) === false ) { break; } } } else { for ( ; i < length; ) { if ( callback.apply( object[ i++ ], args ) === false ) { break; } } } // A special, fast, case for the most common use of each } else { if ( isObj ) { for ( name in object ) { if ( callback.call( object[ name ], name, object[ name ] ) === false ) { break; } } } else { for ( var value = object[0]; i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {} } } return object; }, trim: function( text ) { return (text || "").replace( rtrim, "" ); }, // results is for internal usage only makeArray: function( array, results ) { var ret = results || []; if ( array != null ) { // The window, strings (and functions) also have 'length' // The extra typeof function check is to prevent crashes // in Safari 2 (See: #3039) if ( array.length == null || typeof array === "string" || jQuery.isFunction(array) || (typeof array !== "function" && array.setInterval) ) { push.call( ret, array ); } else { jQuery.merge( ret, array ); } } return ret; }, inArray: function( elem, array ) { if ( array.indexOf ) { return array.indexOf( elem ); } for ( var i = 0, length = array.length; i < length; i++ ) { if ( array[ i ] === elem ) { return i; } } return -1; }, merge: function( first, second ) { var i = first.length, j = 0; if ( typeof second.length === "number" ) { for ( var l = second.length; j < l; j++ ) { first[ i++ ] = second[ j ]; } } else { while ( second[j] !== undefined ) { first[ i++ ] = second[ j++ ]; } } first.length = i; return first; }, grep: function( elems, callback, inv ) { var ret = []; // Go through the array, only saving the items // that pass the validator function for ( var i = 0, length = elems.length; i < length; i++ ) { if ( !inv !== !callback( elems[ i ], i ) ) { ret.push( elems[ i ] ); } } return ret; }, // arg is for internal usage only map: function( elems, callback, arg ) { var ret = [], value; // Go through the array, translating each of the items to their // new value (or values). for ( var i = 0, length = elems.length; i < length; i++ ) { value = callback( elems[ i ], i, arg ); if ( value != null ) { ret[ ret.length ] = value; } } return ret.concat.apply( [], ret ); }, // A global GUID counter for objects guid: 1, proxy: function( fn, proxy, thisObject ) { if ( arguments.length === 2 ) { if ( typeof proxy === "string" ) { thisObject = fn; fn = thisObject[ proxy ]; proxy = undefined; } else if ( proxy && !jQuery.isFunction( proxy ) ) { thisObject = proxy; proxy = undefined; } } if ( !proxy && fn ) { proxy = function() { return fn.apply( thisObject || this, arguments ); }; } // Set the guid of unique handler to the same of original handler, so it can be removed if ( fn ) { proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; } // So proxy can be declared as an argument return proxy; }, // Use of jQuery.browser is frowned upon. // More details: http://docs.jquery.com/Utilities/jQuery.browser uaMatch: function( ua ) { ua = ua.toLowerCase(); var match = /(webkit)[ \/]([\w.]+)/.exec( ua ) || /(opera)(?:.*version)?[ \/]([\w.]+)/.exec( ua ) || /(msie) ([\w.]+)/.exec( ua ) || !/compatible/.test( ua ) && /(mozilla)(?:.*? rv:([\w.]+))?/.exec( ua ) || []; return { browser: match[1] || "", version: match[2] || "0" }; }, browser: {} }); browserMatch = jQuery.uaMatch( userAgent ); if ( browserMatch.browser ) { jQuery.browser[ browserMatch.browser ] = true; jQuery.browser.version = browserMatch.version; } // Deprecated, use jQuery.browser.webkit instead if ( jQuery.browser.webkit ) { jQuery.browser.safari = true; } if ( indexOf ) { jQuery.inArray = function( elem, array ) { return indexOf.call( array, elem ); }; } // All jQuery objects should point back to these rootjQuery = jQuery(document); // Cleanup functions for the document ready method if ( document.addEventListener ) { DOMContentLoaded = function() { document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); jQuery.ready(); }; } else if ( document.attachEvent ) { DOMContentLoaded = function() { // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). if ( document.readyState === "complete" ) { document.detachEvent( "onreadystatechange", DOMContentLoaded ); jQuery.ready(); } }; } // The DOM ready check for Internet Explorer function doScrollCheck() { if ( jQuery.isReady ) { return; } try { // If IE is used, use the trick by Diego Perini // http://javascript.nwbox.com/IEContentLoaded/ document.documentElement.doScroll("left"); } catch( error ) { setTimeout( doScrollCheck, 1 ); return; } // and execute any waiting functions jQuery.ready(); } function evalScript( i, elem ) { if ( elem.src ) { jQuery.ajax({ url: elem.src, async: false, dataType: "script" }); } else { jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" ); } if ( elem.parentNode ) { elem.parentNode.removeChild( elem ); } } // Mutifunctional method to get and set values to a collection // The value/s can be optionally by executed if its a function function access( elems, key, value, exec, fn, pass ) { var length = elems.length; // Setting many attributes if ( typeof key === "object" ) { for ( var k in key ) { access( elems, k, key[k], exec, fn, value ); } return elems; } // Setting one attribute if ( value !== undefined ) { // Optionally, function values get executed if exec is true exec = !pass && exec && jQuery.isFunction(value); for ( var i = 0; i < length; i++ ) { fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); } return elems; } // Getting an attribute return length ? fn( elems[0], key ) : null; } function now() { return (new Date).getTime(); } (function() { jQuery.support = {}; var root = document.documentElement, script = document.createElement("script"), div = document.createElement("div"), id = "script" + now(); div.style.display = "none"; div.innerHTML = "
a"; var all = div.getElementsByTagName("*"), a = div.getElementsByTagName("a")[0]; // Can't get basic test support if ( !all || !all.length || !a ) { return; } jQuery.support = { // IE strips leading whitespace when .innerHTML is used leadingWhitespace: div.firstChild.nodeType === 3, // Make sure that tbody elements aren't automatically inserted // IE will insert them into empty tables tbody: !div.getElementsByTagName("tbody").length, // Make sure that link elements get serialized correctly by innerHTML // This requires a wrapper element in IE htmlSerialize: !!div.getElementsByTagName("link").length, // Get the style information from getAttribute // (IE uses .cssText insted) style: /red/.test( a.getAttribute("style") ), // Make sure that URLs aren't manipulated // (IE normalizes it by default) hrefNormalized: a.getAttribute("href") === "/a", // Make sure that element opacity exists // (IE uses filter instead) // Use a regex to work around a WebKit issue. See #5145 opacity: /^0.55$/.test( a.style.opacity ), // Verify style float existence // (IE uses styleFloat instead of cssFloat) cssFloat: !!a.style.cssFloat, // Make sure that if no value is specified for a checkbox // that it defaults to "on". // (WebKit defaults to "" instead) checkOn: div.getElementsByTagName("input")[0].value === "on", // Make sure that a selected-by-default option has a working selected property. // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) optSelected: document.createElement("select").appendChild( document.createElement("option") ).selected, // Will be defined later checkClone: false, scriptEval: false, noCloneEvent: true, boxModel: null }; script.type = "text/javascript"; try { script.appendChild( document.createTextNode( "window." + id + "=1;" ) ); } catch(e) {} root.insertBefore( script, root.firstChild ); // Make sure that the execution of code works by injecting a script // tag with appendChild/createTextNode // (IE doesn't support this, fails, and uses .text instead) if ( window[ id ] ) { jQuery.support.scriptEval = true; delete window[ id ]; } root.removeChild( script ); if ( div.attachEvent && div.fireEvent ) { div.attachEvent("onclick", function click() { // Cloning a node shouldn't copy over any // bound event handlers (IE does this) jQuery.support.noCloneEvent = false; div.detachEvent("onclick", click); }); div.cloneNode(true).fireEvent("onclick"); } div = document.createElement("div"); div.innerHTML = ""; var fragment = document.createDocumentFragment(); fragment.appendChild( div.firstChild ); // WebKit doesn't clone checked state correctly in fragments jQuery.support.checkClone = fragment.cloneNode(true).cloneNode(true).lastChild.checked; // Figure out if the W3C box model works as expected // document.body must exist before we can do this jQuery(function() { var div = document.createElement("div"); div.style.width = div.style.paddingLeft = "1px"; document.body.appendChild( div ); jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2; document.body.removeChild( div ).style.display = 'none'; div = null; }); // Technique from Juriy Zaytsev // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/ var eventSupported = function( eventName ) { var el = document.createElement("div"); eventName = "on" + eventName; var isSupported = (eventName in el); if ( !isSupported ) { el.setAttribute(eventName, "return;"); isSupported = typeof el[eventName] === "function"; } el = null; return isSupported; }; jQuery.support.submitBubbles = eventSupported("submit"); jQuery.support.changeBubbles = eventSupported("change"); // release memory in IE root = script = div = all = a = null; })(); jQuery.props = { "for": "htmlFor", "class": "className", readonly: "readOnly", maxlength: "maxLength", cellspacing: "cellSpacing", rowspan: "rowSpan", colspan: "colSpan", tabindex: "tabIndex", usemap: "useMap", frameborder: "frameBorder" }; var expando = "jQuery" + now(), uuid = 0, windowData = {}; var emptyObject = {}; jQuery.extend({ cache: {}, expando:expando, // The following elements throw uncatchable exceptions if you // attempt to add expando properties to them. noData: { "embed": true, "object": true, "applet": true }, data: function( elem, name, data ) { if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) { return; } elem = elem == window ? windowData : elem; var id = elem[ expando ], cache = jQuery.cache, thisCache; // Handle the case where there's no name immediately if ( !name && !id ) { return null; } // Compute a unique ID for the element if ( !id ) { id = ++uuid; } // Avoid generating a new cache unless none exists and we // want to manipulate it. if ( typeof name === "object" ) { elem[ expando ] = id; thisCache = cache[ id ] = jQuery.extend(true, {}, name); } else if ( cache[ id ] ) { thisCache = cache[ id ]; } else if ( typeof data === "undefined" ) { thisCache = emptyObject; } else { thisCache = cache[ id ] = {}; } // Prevent overriding the named cache with undefined values if ( data !== undefined ) { elem[ expando ] = id; thisCache[ name ] = data; } return typeof name === "string" ? thisCache[ name ] : thisCache; }, removeData: function( elem, name ) { if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) { return; } elem = elem == window ? windowData : elem; var id = elem[ expando ], cache = jQuery.cache, thisCache = cache[ id ]; // If we want to remove a specific section of the element's data if ( name ) { if ( thisCache ) { // Remove the section of cache data delete thisCache[ name ]; // If we've removed all the data, remove the element's cache if ( jQuery.isEmptyObject(thisCache) ) { jQuery.removeData( elem ); } } // Otherwise, we want to remove all of the element's data } else { // Clean up the element expando try { delete elem[ expando ]; } catch( e ) { // IE has trouble directly removing the expando // but it's ok with using removeAttribute if ( elem.removeAttribute ) { elem.removeAttribute( expando ); } } // Completely remove the data cache delete cache[ id ]; } } }); jQuery.fn.extend({ data: function( key, value ) { if ( typeof key === "undefined" && this.length ) { return jQuery.data( this[0] ); } else if ( typeof key === "object" ) { return this.each(function() { jQuery.data( this, key ); }); } var parts = key.split("."); parts[1] = parts[1] ? "." + parts[1] : ""; if ( value === undefined ) { var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); if ( data === undefined && this.length ) { data = jQuery.data( this[0], key ); } return data === undefined && parts[1] ? this.data( parts[0] ) : data; } else { return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function() { jQuery.data( this, key, value ); }); } }, removeData: function( key ) { return this.each(function() { jQuery.removeData( this, key ); }); } }); jQuery.extend({ queue: function( elem, type, data ) { if ( !elem ) { return; } type = (type || "fx") + "queue"; var q = jQuery.data( elem, type ); // Speed up dequeue by getting out quickly if this is just a lookup if ( !data ) { return q || []; } if ( !q || jQuery.isArray(data) ) { q = jQuery.data( elem, type, jQuery.makeArray(data) ); } else { q.push( data ); } return q; }, dequeue: function( elem, type ) { type = type || "fx"; var queue = jQuery.queue( elem, type ), fn = queue.shift(); // If the fx queue is dequeued, always remove the progress sentinel if ( fn === "inprogress" ) { fn = queue.shift(); } if ( fn ) { // Add a progress sentinel to prevent the fx queue from being // automatically dequeued if ( type === "fx" ) { queue.unshift("inprogress"); } fn.call(elem, function() { jQuery.dequeue(elem, type); }); } } }); jQuery.fn.extend({ queue: function( type, data ) { if ( typeof type !== "string" ) { data = type; type = "fx"; } if ( data === undefined ) { return jQuery.queue( this[0], type ); } return this.each(function( i, elem ) { var queue = jQuery.queue( this, type, data ); if ( type === "fx" && queue[0] !== "inprogress" ) { jQuery.dequeue( this, type ); } }); }, dequeue: function( type ) { return this.each(function() { jQuery.dequeue( this, type ); }); }, // Based off of the plugin by Clint Helfers, with permission. // http://blindsignals.com/index.php/2009/07/jquery-delay/ delay: function( time, type ) { time = jQuery.fx ? jQuery.fx.speeds[time] || time : time; type = type || "fx"; return this.queue( type, function() { var elem = this; setTimeout(function() { jQuery.dequeue( elem, type ); }, time ); }); }, clearQueue: function( type ) { return this.queue( type || "fx", [] ); } }); var rclass = /[\n\t]/g, rspace = /\s+/, rreturn = /\r/g, rspecialurl = /href|src|style/, rtype = /(button|input)/i, rfocusable = /(button|input|object|select|textarea)/i, rclickable = /^(a|area)$/i, rradiocheck = /radio|checkbox/; jQuery.fn.extend({ attr: function( name, value ) { return access( this, name, value, true, jQuery.attr ); }, removeAttr: function( name, fn ) { return this.each(function(){ jQuery.attr( this, name, "" ); if ( this.nodeType === 1 ) { this.removeAttribute( name ); } }); }, addClass: function( value ) { if ( jQuery.isFunction(value) ) { return this.each(function(i) { var self = jQuery(this); self.addClass( value.call(this, i, self.attr("class")) ); }); } if ( value && typeof value === "string" ) { var classNames = (value || "").split( rspace ); for ( var i = 0, l = this.length; i < l; i++ ) { var elem = this[i]; if ( elem.nodeType === 1 ) { if ( !elem.className ) { elem.className = value; } else { var className = " " + elem.className + " "; for ( var c = 0, cl = classNames.length; c < cl; c++ ) { if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) { elem.className += " " + classNames[c]; } } } } } } return this; }, removeClass: function( value ) { if ( jQuery.isFunction(value) ) { return this.each(function(i) { var self = jQuery(this); self.removeClass( value.call(this, i, self.attr("class")) ); }); } if ( (value && typeof value === "string") || value === undefined ) { var classNames = (value || "").split(rspace); for ( var i = 0, l = this.length; i < l; i++ ) { var elem = this[i]; if ( elem.nodeType === 1 && elem.className ) { if ( value ) { var className = (" " + elem.className + " ").replace(rclass, " "); for ( var c = 0, cl = classNames.length; c < cl; c++ ) { className = className.replace(" " + classNames[c] + " ", " "); } elem.className = className.substring(1, className.length - 1); } else { elem.className = ""; } } } } return this; }, toggleClass: function( value, stateVal ) { var type = typeof value, isBool = typeof stateVal === "boolean"; if ( jQuery.isFunction( value ) ) { return this.each(function(i) { var self = jQuery(this); self.toggleClass( value.call(this, i, self.attr("class"), stateVal), stateVal ); }); } return this.each(function() { if ( type === "string" ) { // toggle individual class names var className, i = 0, self = jQuery(this), state = stateVal, classNames = value.split( rspace ); while ( (className = classNames[ i++ ]) ) { // check each className given, space seperated list state = isBool ? state : !self.hasClass( className ); self[ state ? "addClass" : "removeClass" ]( className ); } } else if ( type === "undefined" || type === "boolean" ) { if ( this.className ) { // store className if set jQuery.data( this, "__className__", this.className ); } // toggle whole className this.className = this.className || value === false ? "" : jQuery.data( this, "__className__" ) || ""; } }); }, hasClass: function( selector ) { var className = " " + selector + " "; for ( var i = 0, l = this.length; i < l; i++ ) { if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { return true; } } return false; }, val: function( value ) { if ( value === undefined ) { var elem = this[0]; if ( elem ) { if ( jQuery.nodeName( elem, "option" ) ) { return (elem.attributes.value || {}).specified ? elem.value : elem.text; } // We need to handle select boxes special if ( jQuery.nodeName( elem, "select" ) ) { var index = elem.selectedIndex, values = [], options = elem.options, one = elem.type === "select-one"; // Nothing was selected if ( index < 0 ) { return null; } // Loop through all the selected options for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { var option = options[ i ]; if ( option.selected ) { // Get the specifc value for the option value = jQuery(option).val(); // We don't need an array for one selects if ( one ) { return value; } // Multi-Selects return an array values.push( value ); } } return values; } // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified if ( rradiocheck.test( elem.type ) && !jQuery.support.checkOn ) { return elem.getAttribute("value") === null ? "on" : elem.value; } // Everything else, we just grab the value return (elem.value || "").replace(rreturn, ""); } return undefined; } var isFunction = jQuery.isFunction(value); return this.each(function(i) { var self = jQuery(this), val = value; if ( this.nodeType !== 1 ) { return; } if ( isFunction ) { val = value.call(this, i, self.val()); } // Typecast each time if the value is a Function and the appended // value is therefore different each time. if ( typeof val === "number" ) { val += ""; } if ( jQuery.isArray(val) && rradiocheck.test( this.type ) ) { this.checked = jQuery.inArray( self.val(), val ) >= 0; } else if ( jQuery.nodeName( this, "select" ) ) { var values = jQuery.makeArray(val); jQuery( "option", this ).each(function() { this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; }); if ( !values.length ) { this.selectedIndex = -1; } } else { this.value = val; } }); } }); jQuery.extend({ attrFn: { val: true, css: true, html: true, text: true, data: true, width: true, height: true, offset: true }, attr: function( elem, name, value, pass ) { // don't set attributes on text and comment nodes if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) { return undefined; } if ( pass && name in jQuery.attrFn ) { return jQuery(elem)[name](value); } var notxml = elem.nodeType !== 1 || !jQuery.isXMLDoc( elem ), // Whether we are setting (or getting) set = value !== undefined; // Try to normalize/fix the name name = notxml && jQuery.props[ name ] || name; // Only do all the following if this is a node (faster for style) if ( elem.nodeType === 1 ) { // These attributes require special treatment var special = rspecialurl.test( name ); // Safari mis-reports the default selected property of an option // Accessing the parent's selectedIndex property fixes it if ( name === "selected" && !jQuery.support.optSelected ) { var parent = elem.parentNode; if ( parent ) { parent.selectedIndex; // Make sure that it also works with optgroups, see #5701 if ( parent.parentNode ) { parent.parentNode.selectedIndex; } } } // If applicable, access the attribute via the DOM 0 way if ( name in elem && notxml && !special ) { if ( set ) { // We can't allow the type property to be changed (since it causes problems in IE) if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) { jQuery.error( "type property can't be changed" ); } elem[ name ] = value; } // browsers index elements by id/name on forms, give priority to attributes. if ( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) { return elem.getAttributeNode( name ).nodeValue; } // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ if ( name === "tabIndex" ) { var attributeNode = elem.getAttributeNode( "tabIndex" ); return attributeNode && attributeNode.specified ? attributeNode.value : rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? 0 : undefined; } return elem[ name ]; } if ( !jQuery.support.style && notxml && name === "style" ) { if ( set ) { elem.style.cssText = "" + value; } return elem.style.cssText; } if ( set ) { // convert the value to a string (all browsers do this but IE) see #1070 elem.setAttribute( name, "" + value ); } var attr = !jQuery.support.hrefNormalized && notxml && special ? // Some attributes require a special call on IE elem.getAttribute( name, 2 ) : elem.getAttribute( name ); // Non-existent attributes return null, we normalize to undefined return attr === null ? undefined : attr; } // elem is actually elem.style ... set the style // Using attr for specific style information is now deprecated. Use style insead. return jQuery.style( elem, name, value ); } }); var fcleanup = function( nm ) { return nm.replace(/[^\w\s\.\|`]/g, function( ch ) { return "\\" + ch; }); }; /* * A number of helper functions used for managing events. * Many of the ideas behind this code originated from * Dean Edwards' addEvent library. */ jQuery.event = { // Bind an event to an element // Original by Dean Edwards add: function( elem, types, handler, data ) { if ( elem.nodeType === 3 || elem.nodeType === 8 ) { return; } // For whatever reason, IE has trouble passing the window object // around, causing it to be cloned in the process if ( elem.setInterval && ( elem !== window && !elem.frameElement ) ) { elem = window; } // Make sure that the function being executed has a unique ID if ( !handler.guid ) { handler.guid = jQuery.guid++; } // if data is passed, bind to handler if ( data !== undefined ) { // Create temporary function pointer to original handler var fn = handler; // Create unique handler function, wrapped around original handler handler = jQuery.proxy( fn ); // Store data in unique handler handler.data = data; } // Init the element's event structure var events = jQuery.data( elem, "events" ) || jQuery.data( elem, "events", {} ), handle = jQuery.data( elem, "handle" ), eventHandle; if ( !handle ) { eventHandle = function() { // Handle the second event of a trigger and when // an event is called after a page has unloaded return typeof jQuery !== "undefined" && !jQuery.event.triggered ? jQuery.event.handle.apply( eventHandle.elem, arguments ) : undefined; }; handle = jQuery.data( elem, "handle", eventHandle ); } // If no handle is found then we must be trying to bind to one of the // banned noData elements if ( !handle ) { return; } // Add elem as a property of the handle function // This is to prevent a memory leak with non-native // event in IE. handle.elem = elem; // Handle multiple events separated by a space // jQuery(...).bind("mouseover mouseout", fn); types = types.split( /\s+/ ); var type, i = 0; while ( (type = types[ i++ ]) ) { // Namespaced event handlers var namespaces = type.split("."); type = namespaces.shift(); if ( i > 1 ) { handler = jQuery.proxy( handler ); if ( data !== undefined ) { handler.data = data; } } handler.type = namespaces.slice(0).sort().join("."); // Get the current list of functions bound to this event var handlers = events[ type ], special = this.special[ type ] || {}; // Init the event handler queue if ( !handlers ) { handlers = events[ type ] = {}; // Check for a special event handler // Only use addEventListener/attachEvent if the special // events handler returns false if ( !special.setup || special.setup.call( elem, data, namespaces, handler) === false ) { // Bind the global event handler to the element if ( elem.addEventListener ) { elem.addEventListener( type, handle, false ); } else if ( elem.attachEvent ) { elem.attachEvent( "on" + type, handle ); } } } if ( special.add ) { var modifiedHandler = special.add.call( elem, handler, data, namespaces, handlers ); if ( modifiedHandler && jQuery.isFunction( modifiedHandler ) ) { modifiedHandler.guid = modifiedHandler.guid || handler.guid; modifiedHandler.data = modifiedHandler.data || handler.data; modifiedHandler.type = modifiedHandler.type || handler.type; handler = modifiedHandler; } } // Add the function to the element's handler list handlers[ handler.guid ] = handler; // Keep track of which events have been used, for global triggering this.global[ type ] = true; } // Nullify elem to prevent memory leaks in IE elem = null; }, global: {}, // Detach an event or set of events from an element remove: function( elem, types, handler ) { // don't do events on text and comment nodes if ( elem.nodeType === 3 || elem.nodeType === 8 ) { return; } var events = jQuery.data( elem, "events" ), ret, type, fn; if ( events ) { // Unbind all events for the element if ( types === undefined || (typeof types === "string" && types.charAt(0) === ".") ) { for ( type in events ) { this.remove( elem, type + (types || "") ); } } else { // types is actually an event object here if ( types.type ) { handler = types.handler; types = types.type; } // Handle multiple events separated by a space // jQuery(...).unbind("mouseover mouseout", fn); types = types.split(/\s+/); var i = 0; while ( (type = types[ i++ ]) ) { // Namespaced event handlers var namespaces = type.split("."); type = namespaces.shift(); var all = !namespaces.length, cleaned = jQuery.map( namespaces.slice(0).sort(), fcleanup ), namespace = new RegExp("(^|\\.)" + cleaned.join("\\.(?:.*\\.)?") + "(\\.|$)"), special = this.special[ type ] || {}; if ( events[ type ] ) { // remove the given handler for the given type if ( handler ) { fn = events[ type ][ handler.guid ]; delete events[ type ][ handler.guid ]; // remove all handlers for the given type } else { for ( var handle in events[ type ] ) { // Handle the removal of namespaced events if ( all || namespace.test( events[ type ][ handle ].type ) ) { delete events[ type ][ handle ]; } } } if ( special.remove ) { special.remove.call( elem, namespaces, fn); } // remove generic event handler if no more handlers exist for ( ret in events[ type ] ) { break; } if ( !ret ) { if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { if ( elem.removeEventListener ) { elem.removeEventListener( type, jQuery.data( elem, "handle" ), false ); } else if ( elem.detachEvent ) { elem.detachEvent( "on" + type, jQuery.data( elem, "handle" ) ); } } ret = null; delete events[ type ]; } } } } // Remove the expando if it's no longer used for ( ret in events ) { break; } if ( !ret ) { var handle = jQuery.data( elem, "handle" ); if ( handle ) { handle.elem = null; } jQuery.removeData( elem, "events" ); jQuery.removeData( elem, "handle" ); } } }, // bubbling is internal trigger: function( event, data, elem /*, bubbling */ ) { // Event object or event type var type = event.type || event, bubbling = arguments[3]; if ( !bubbling ) { event = typeof event === "object" ? // jQuery.Event object event[expando] ? event : // Object literal jQuery.extend( jQuery.Event(type), event ) : // Just the event type (string) jQuery.Event(type); if ( type.indexOf("!") >= 0 ) { event.type = type = type.slice(0, -1); event.exclusive = true; } // Handle a global trigger if ( !elem ) { // Don't bubble custom events when global (to avoid too much overhead) event.stopPropagation(); // Only trigger if we've ever bound an event for it if ( this.global[ type ] ) { jQuery.each( jQuery.cache, function() { if ( this.events && this.events[type] ) { jQuery.event.trigger( event, data, this.handle.elem ); } }); } } // Handle triggering a single element // don't do events on text and comment nodes if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) { return undefined; } // Clean up in case it is reused event.result = undefined; event.target = elem; // Clone the incoming data, if any data = jQuery.makeArray( data ); data.unshift( event ); } event.currentTarget = elem; // Trigger the event, it is assumed that "handle" is a function var handle = jQuery.data( elem, "handle" ); if ( handle ) { handle.apply( elem, data ); } var parent = elem.parentNode || elem.ownerDocument; // Trigger an inline bound script try { if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) { if ( elem[ "on" + type ] && elem[ "on" + type ].apply( elem, data ) === false ) { event.result = false; } } // prevent IE from throwing an error for some elements with some event types, see #3533 } catch (e) {} if ( !event.isPropagationStopped() && parent ) { jQuery.event.trigger( event, data, parent, true ); } else if ( !event.isDefaultPrevented() ) { var target = event.target, old, isClick = jQuery.nodeName(target, "a") && type === "click"; if ( !isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) { try { if ( target[ type ] ) { // Make sure that we don't accidentally re-trigger the onFOO events old = target[ "on" + type ]; if ( old ) { target[ "on" + type ] = null; } this.triggered = true; target[ type ](); } // prevent IE from throwing an error for some elements with some event types, see #3533 } catch (e) {} if ( old ) { target[ "on" + type ] = old; } this.triggered = false; } } }, handle: function( event ) { // returned undefined or false var all, handlers; event = arguments[0] = jQuery.event.fix( event || window.event ); event.currentTarget = this; // Namespaced event handlers var namespaces = event.type.split("."); event.type = namespaces.shift(); // Cache this now, all = true means, any handler all = !namespaces.length && !event.exclusive; var namespace = new RegExp("(^|\\.)" + namespaces.slice(0).sort().join("\\.(?:.*\\.)?") + "(\\.|$)"); handlers = ( jQuery.data(this, "events") || {} )[ event.type ]; for ( var j in handlers ) { var handler = handlers[ j ]; // Filter the functions by class if ( all || namespace.test(handler.type) ) { // Pass in a reference to the handler function itself // So that we can later remove it event.handler = handler; event.data = handler.data; var ret = handler.apply( this, arguments ); if ( ret !== undefined ) { event.result = ret; if ( ret === false ) { event.preventDefault(); event.stopPropagation(); } } if ( event.isImmediatePropagationStopped() ) { break; } } } return event.result; }, props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), fix: function( event ) { if ( event[ expando ] ) { return event; } // store a copy of the original event object // and "clone" to set read-only properties var originalEvent = event; event = jQuery.Event( originalEvent ); for ( var i = this.props.length, prop; i; ) { prop = this.props[ --i ]; event[ prop ] = originalEvent[ prop ]; } // Fix target property, if necessary if ( !event.target ) { event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either } // check if target is a textnode (safari) if ( event.target.nodeType === 3 ) { event.target = event.target.parentNode; } // Add relatedTarget, if necessary if ( !event.relatedTarget && event.fromElement ) { event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement; } // Calculate pageX/Y if missing and clientX/Y available if ( event.pageX == null && event.clientX != null ) { var doc = document.documentElement, body = document.body; event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0); event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0); } // Add which for key events if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) ) { event.which = event.charCode || event.keyCode; } // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs) if ( !event.metaKey && event.ctrlKey ) { event.metaKey = event.ctrlKey; } // Add which for click: 1 === left; 2 === middle; 3 === right // Note: button is not normalized, so don't use it if ( !event.which && event.button !== undefined ) { event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) )); } return event; }, // Deprecated, use jQuery.guid instead guid: 1E8, // Deprecated, use jQuery.proxy instead proxy: jQuery.proxy, special: { ready: { // Make sure the ready event is setup setup: jQuery.bindReady, teardown: jQuery.noop }, live: { add: function( proxy, data, namespaces, live ) { jQuery.extend( proxy, data || {} ); proxy.guid += data.selector + data.live; data.liveProxy = proxy; jQuery.event.add( this, data.live, liveHandler, data ); }, remove: function( namespaces ) { if ( namespaces.length ) { var remove = 0, name = new RegExp("(^|\\.)" + namespaces[0] + "(\\.|$)"); jQuery.each( (jQuery.data(this, "events").live || {}), function() { if ( name.test(this.type) ) { remove++; } }); if ( remove < 1 ) { jQuery.event.remove( this, namespaces[0], liveHandler ); } } }, special: {} }, beforeunload: { setup: function( data, namespaces, fn ) { // We only want to do this special case on windows if ( this.setInterval ) { this.onbeforeunload = fn; } return false; }, teardown: function( namespaces, fn ) { if ( this.onbeforeunload === fn ) { this.onbeforeunload = null; } } } } }; jQuery.Event = function( src ) { // Allow instantiation without the 'new' keyword if ( !this.preventDefault ) { return new jQuery.Event( src ); } // Event object if ( src && src.type ) { this.originalEvent = src; this.type = src.type; // Event type } else { this.type = src; } // timeStamp is buggy for some events on Firefox(#3843) // So we won't rely on the native value this.timeStamp = now(); // Mark it as fixed this[ expando ] = true; }; function returnFalse() { return false; } function returnTrue() { return true; } // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html jQuery.Event.prototype = { preventDefault: function() { this.isDefaultPrevented = returnTrue; var e = this.originalEvent; if ( !e ) { return; } // if preventDefault exists run it on the original event if ( e.preventDefault ) { e.preventDefault(); } // otherwise set the returnValue property of the original event to false (IE) e.returnValue = false; }, stopPropagation: function() { this.isPropagationStopped = returnTrue; var e = this.originalEvent; if ( !e ) { return; } // if stopPropagation exists run it on the original event if ( e.stopPropagation ) { e.stopPropagation(); } // otherwise set the cancelBubble property of the original event to true (IE) e.cancelBubble = true; }, stopImmediatePropagation: function() { this.isImmediatePropagationStopped = returnTrue; this.stopPropagation(); }, isDefaultPrevented: returnFalse, isPropagationStopped: returnFalse, isImmediatePropagationStopped: returnFalse }; // Checks if an event happened on an element within another element // Used in jQuery.event.special.mouseenter and mouseleave handlers var withinElement = function( event ) { // Check if mouse(over|out) are still within the same parent element var parent = event.relatedTarget; // Traverse up the tree while ( parent && parent !== this ) { // Firefox sometimes assigns relatedTarget a XUL element // which we cannot access the parentNode property of try { parent = parent.parentNode; // assuming we've left the element since we most likely mousedover a xul element } catch(e) { break; } } if ( parent !== this ) { // set the correct event type event.type = event.data; // handle event if we actually just moused on to a non sub-element jQuery.event.handle.apply( this, arguments ); } }, // In case of event delegation, we only need to rename the event.type, // liveHandler will take care of the rest. delegate = function( event ) { event.type = event.data; jQuery.event.handle.apply( this, arguments ); }; // Create mouseenter and mouseleave events jQuery.each({ mouseenter: "mouseover", mouseleave: "mouseout" }, function( orig, fix ) { jQuery.event.special[ orig ] = { setup: function( data ) { jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig ); }, teardown: function( data ) { jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement ); } }; }); // submit delegation if ( !jQuery.support.submitBubbles ) { jQuery.event.special.submit = { setup: function( data, namespaces, fn ) { if ( this.nodeName.toLowerCase() !== "form" ) { jQuery.event.add(this, "click.specialSubmit." + fn.guid, function( e ) { var elem = e.target, type = elem.type; if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) { return trigger( "submit", this, arguments ); } }); jQuery.event.add(this, "keypress.specialSubmit." + fn.guid, function( e ) { var elem = e.target, type = elem.type; if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) { return trigger( "submit", this, arguments ); } }); } else { return false; } }, remove: function( namespaces, fn ) { jQuery.event.remove( this, "click.specialSubmit" + (fn ? "."+fn.guid : "") ); jQuery.event.remove( this, "keypress.specialSubmit" + (fn ? "."+fn.guid : "") ); } }; } // change delegation, happens here so we have bind. if ( !jQuery.support.changeBubbles ) { var formElems = /textarea|input|select/i; function getVal( elem ) { var type = elem.type, val = elem.value; if ( type === "radio" || type === "checkbox" ) { val = elem.checked; } else if ( type === "select-multiple" ) { val = elem.selectedIndex > -1 ? jQuery.map( elem.options, function( elem ) { return elem.selected; }).join("-") : ""; } else if ( elem.nodeName.toLowerCase() === "select" ) { val = elem.selectedIndex; } return val; } function testChange( e ) { var elem = e.target, data, val; if ( !formElems.test( elem.nodeName ) || elem.readOnly ) { return; } data = jQuery.data( elem, "_change_data" ); val = getVal(elem); // the current data will be also retrieved by beforeactivate if ( e.type !== "focusout" || elem.type !== "radio" ) { jQuery.data( elem, "_change_data", val ); } if ( data === undefined || val === data ) { return; } if ( data != null || val ) { e.type = "change"; return jQuery.event.trigger( e, arguments[1], elem ); } } jQuery.event.special.change = { filters: { focusout: testChange, click: function( e ) { var elem = e.target, type = elem.type; if ( type === "radio" || type === "checkbox" || elem.nodeName.toLowerCase() === "select" ) { return testChange.call( this, e ); } }, // Change has to be called before submit // Keydown will be called before keypress, which is used in submit-event delegation keydown: function( e ) { var elem = e.target, type = elem.type; if ( (e.keyCode === 13 && elem.nodeName.toLowerCase() !== "textarea") || (e.keyCode === 32 && (type === "checkbox" || type === "radio")) || type === "select-multiple" ) { return testChange.call( this, e ); } }, // Beforeactivate happens also before the previous element is blurred // with this event you can't trigger a change event, but you can store // information/focus[in] is not needed anymore beforeactivate: function( e ) { var elem = e.target; if ( elem.nodeName.toLowerCase() === "input" && elem.type === "radio" ) { jQuery.data( elem, "_change_data", getVal(elem) ); } } }, setup: function( data, namespaces, fn ) { for ( var type in changeFilters ) { jQuery.event.add( this, type + ".specialChange." + fn.guid, changeFilters[type] ); } return formElems.test( this.nodeName ); }, remove: function( namespaces, fn ) { for ( var type in changeFilters ) { jQuery.event.remove( this, type + ".specialChange" + (fn ? "."+fn.guid : ""), changeFilters[type] ); } return formElems.test( this.nodeName ); } }; var changeFilters = jQuery.event.special.change.filters; } function trigger( type, elem, args ) { args[0].type = type; return jQuery.event.handle.apply( elem, args ); } // Create "bubbling" focus and blur events if ( document.addEventListener ) { jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { jQuery.event.special[ fix ] = { setup: function() { this.addEventListener( orig, handler, true ); }, teardown: function() { this.removeEventListener( orig, handler, true ); } }; function handler( e ) { e = jQuery.event.fix( e ); e.type = fix; return jQuery.event.handle.call( this, e ); } }); } jQuery.each(["bind", "one"], function( i, name ) { jQuery.fn[ name ] = function( type, data, fn ) { // Handle object literals if ( typeof type === "object" ) { for ( var key in type ) { this[ name ](key, data, type[key], fn); } return this; } if ( jQuery.isFunction( data ) ) { fn = data; data = undefined; } var handler = name === "one" ? jQuery.proxy( fn, function( event ) { jQuery( this ).unbind( event, handler ); return fn.apply( this, arguments ); }) : fn; return type === "unload" && name !== "one" ? this.one( type, data, fn ) : this.each(function() { jQuery.event.add( this, type, handler, data ); }); }; }); jQuery.fn.extend({ unbind: function( type, fn ) { // Handle object literals if ( typeof type === "object" && !type.preventDefault ) { for ( var key in type ) { this.unbind(key, type[key]); } return this; } return this.each(function() { jQuery.event.remove( this, type, fn ); }); }, trigger: function( type, data ) { return this.each(function() { jQuery.event.trigger( type, data, this ); }); }, triggerHandler: function( type, data ) { if ( this[0] ) { var event = jQuery.Event( type ); event.preventDefault(); event.stopPropagation(); jQuery.event.trigger( event, data, this[0] ); return event.result; } }, toggle: function( fn ) { // Save reference to arguments for access in closure var args = arguments, i = 1; // link all the functions, so any of them can unbind this click handler while ( i < args.length ) { jQuery.proxy( fn, args[ i++ ] ); } return this.click( jQuery.proxy( fn, function( event ) { // Figure out which function to execute var lastToggle = ( jQuery.data( this, "lastToggle" + fn.guid ) || 0 ) % i; jQuery.data( this, "lastToggle" + fn.guid, lastToggle + 1 ); // Make sure that clicks stop event.preventDefault(); // and execute the function return args[ lastToggle ].apply( this, arguments ) || false; })); }, hover: function( fnOver, fnOut ) { return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); } }); jQuery.each(["live", "die"], function( i, name ) { jQuery.fn[ name ] = function( types, data, fn ) { var type, i = 0; if ( jQuery.isFunction( data ) ) { fn = data; data = undefined; } types = (types || "").split( /\s+/ ); while ( (type = types[ i++ ]) != null ) { type = type === "focus" ? "focusin" : // focus --> focusin type === "blur" ? "focusout" : // blur --> focusout type === "hover" ? types.push("mouseleave") && "mouseenter" : // hover support type; if ( name === "live" ) { // bind live handler jQuery( this.context ).bind( liveConvert( type, this.selector ), { data: data, selector: this.selector, live: type }, fn ); } else { // unbind live handler jQuery( this.context ).unbind( liveConvert( type, this.selector ), fn ? { guid: fn.guid + this.selector + type } : null ); } } return this; } }); function liveHandler( event ) { var stop, elems = [], selectors = [], args = arguments, related, match, fn, elem, j, i, l, data, live = jQuery.extend({}, jQuery.data( this, "events" ).live); // Make sure we avoid non-left-click bubbling in Firefox (#3861) if ( event.button && event.type === "click" ) { return; } for ( j in live ) { fn = live[j]; if ( fn.live === event.type || fn.altLive && jQuery.inArray(event.type, fn.altLive) > -1 ) { data = fn.data; if ( !(data.beforeFilter && data.beforeFilter[event.type] && !data.beforeFilter[event.type](event)) ) { selectors.push( fn.selector ); } } else { delete live[j]; } } match = jQuery( event.target ).closest( selectors, event.currentTarget ); for ( i = 0, l = match.length; i < l; i++ ) { for ( j in live ) { fn = live[j]; elem = match[i].elem; related = null; if ( match[i].selector === fn.selector ) { // Those two events require additional checking if ( fn.live === "mouseenter" || fn.live === "mouseleave" ) { related = jQuery( event.relatedTarget ).closest( fn.selector )[0]; } if ( !related || related !== elem ) { elems.push({ elem: elem, fn: fn }); } } } } for ( i = 0, l = elems.length; i < l; i++ ) { match = elems[i]; event.currentTarget = match.elem; event.data = match.fn.data; if ( match.fn.apply( match.elem, args ) === false ) { stop = false; break; } } return stop; } function liveConvert( type, selector ) { return "live." + (type ? type + "." : "") + selector.replace(/\./g, "`").replace(/ /g, "&"); } jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + "change select submit keydown keypress keyup error").split(" "), function( i, name ) { // Handle event binding jQuery.fn[ name ] = function( fn ) { return fn ? this.bind( name, fn ) : this.trigger( name ); }; if ( jQuery.attrFn ) { jQuery.attrFn[ name ] = true; } }); // Prevent memory leaks in IE // Window isn't included so as not to unbind existing unload events // More info: // - http://isaacschlueter.com/2006/10/msie-memory-leaks/ if ( window.attachEvent && !window.addEventListener ) { window.attachEvent("onunload", function() { for ( var id in jQuery.cache ) { if ( jQuery.cache[ id ].handle ) { // Try/Catch is to handle iframes being unloaded, see #4280 try { jQuery.event.remove( jQuery.cache[ id ].handle.elem ); } catch(e) {} } } }); } /*! * Sizzle CSS Selector Engine - v1.0 * Copyright 2009, The Dojo Foundation * Released under the MIT, BSD, and GPL Licenses. * More information: http://sizzlejs.com/ */ (function(){ var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, done = 0, toString = Object.prototype.toString, hasDuplicate = false, baseHasDuplicate = true; // Here we check if the JavaScript engine is using some sort of // optimization where it does not always call our comparision // function. If that is the case, discard the hasDuplicate value. // Thus far that includes Google Chrome. [0, 0].sort(function(){ baseHasDuplicate = false; return 0; }); var Sizzle = function(selector, context, results, seed) { results = results || []; var origContext = context = context || document; if ( context.nodeType !== 1 && context.nodeType !== 9 ) { return []; } if ( !selector || typeof selector !== "string" ) { return results; } var parts = [], m, set, checkSet, extra, prune = true, contextXML = isXML(context), soFar = selector; // Reset the position of the chunker regexp (start from head) while ( (chunker.exec(""), m = chunker.exec(soFar)) !== null ) { soFar = m[3]; parts.push( m[1] ); if ( m[2] ) { extra = m[3]; break; } } if ( parts.length > 1 && origPOS.exec( selector ) ) { if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { set = posProcess( parts[0] + parts[1], context ); } else { set = Expr.relative[ parts[0] ] ? [ context ] : Sizzle( parts.shift(), context ); while ( parts.length ) { selector = parts.shift(); if ( Expr.relative[ selector ] ) { selector += parts.shift(); } set = posProcess( selector, set ); } } } else { // Take a shortcut and set the context if the root selector is an ID // (but not if it'll be faster if the inner selector is an ID) if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { var ret = Sizzle.find( parts.shift(), context, contextXML ); context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0]; } if ( context ) { var ret = seed ? { expr: parts.pop(), set: makeArray(seed) } : Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set; if ( parts.length > 0 ) { checkSet = makeArray(set); } else { prune = false; } while ( parts.length ) { var cur = parts.pop(), pop = cur; if ( !Expr.relative[ cur ] ) { cur = ""; } else { pop = parts.pop(); } if ( pop == null ) { pop = context; } Expr.relative[ cur ]( checkSet, pop, contextXML ); } } else { checkSet = parts = []; } } if ( !checkSet ) { checkSet = set; } if ( !checkSet ) { Sizzle.error( cur || selector ); } if ( toString.call(checkSet) === "[object Array]" ) { if ( !prune ) { results.push.apply( results, checkSet ); } else if ( context && context.nodeType === 1 ) { for ( var i = 0; checkSet[i] != null; i++ ) { if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) { results.push( set[i] ); } } } else { for ( var i = 0; checkSet[i] != null; i++ ) { if ( checkSet[i] && checkSet[i].nodeType === 1 ) { results.push( set[i] ); } } } } else { makeArray( checkSet, results ); } if ( extra ) { Sizzle( extra, origContext, results, seed ); Sizzle.uniqueSort( results ); } return results; }; Sizzle.uniqueSort = function(results){ if ( sortOrder ) { hasDuplicate = baseHasDuplicate; results.sort(sortOrder); if ( hasDuplicate ) { for ( var i = 1; i < results.length; i++ ) { if ( results[i] === results[i-1] ) { results.splice(i--, 1); } } } } return results; }; Sizzle.matches = function(expr, set){ return Sizzle(expr, null, null, set); }; Sizzle.find = function(expr, context, isXML){ var set, match; if ( !expr ) { return []; } for ( var i = 0, l = Expr.order.length; i < l; i++ ) { var type = Expr.order[i], match; if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { var left = match[1]; match.splice(1,1); if ( left.substr( left.length - 1 ) !== "\\" ) { match[1] = (match[1] || "").replace(/\\/g, ""); set = Expr.find[ type ]( match, context, isXML ); if ( set != null ) { expr = expr.replace( Expr.match[ type ], "" ); break; } } } } if ( !set ) { set = context.getElementsByTagName("*"); } return {set: set, expr: expr}; }; Sizzle.filter = function(expr, set, inplace, not){ var old = expr, result = [], curLoop = set, match, anyFound, isXMLFilter = set && set[0] && isXML(set[0]); while ( expr && set.length ) { for ( var type in Expr.filter ) { if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { var filter = Expr.filter[ type ], found, item, left = match[1]; anyFound = false; match.splice(1,1); if ( left.substr( left.length - 1 ) === "\\" ) { continue; } if ( curLoop === result ) { result = []; } if ( Expr.preFilter[ type ] ) { match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); if ( !match ) { anyFound = found = true; } else if ( match === true ) { continue; } } if ( match ) { for ( var i = 0; (item = curLoop[i]) != null; i++ ) { if ( item ) { found = filter( item, match, i, curLoop ); var pass = not ^ !!found; if ( inplace && found != null ) { if ( pass ) { anyFound = true; } else { curLoop[i] = false; } } else if ( pass ) { result.push( item ); anyFound = true; } } } } if ( found !== undefined ) { if ( !inplace ) { curLoop = result; } expr = expr.replace( Expr.match[ type ], "" ); if ( !anyFound ) { return []; } break; } } } // Improper expression if ( expr === old ) { if ( anyFound == null ) { Sizzle.error( expr ); } else { break; } } old = expr; } return curLoop; }; Sizzle.error = function( msg ) { throw "Syntax error, unrecognized expression: " + msg; }; var Expr = Sizzle.selectors = { order: [ "ID", "NAME", "TAG" ], match: { ID: /#((?:[\w\u00c0-\uFFFF-]|\\.)+)/, CLASS: /\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/, NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/, ATTR: /\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/, TAG: /^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/, CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/, POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/, PSEUDO: /:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ }, leftMatch: {}, attrMap: { "class": "className", "for": "htmlFor" }, attrHandle: { href: function(elem){ return elem.getAttribute("href"); } }, relative: { "+": function(checkSet, part){ var isPartStr = typeof part === "string", isTag = isPartStr && !/\W/.test(part), isPartStrNotTag = isPartStr && !isTag; if ( isTag ) { part = part.toLowerCase(); } for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { if ( (elem = checkSet[i]) ) { while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ? elem || false : elem === part; } } if ( isPartStrNotTag ) { Sizzle.filter( part, checkSet, true ); } }, ">": function(checkSet, part){ var isPartStr = typeof part === "string"; if ( isPartStr && !/\W/.test(part) ) { part = part.toLowerCase(); for ( var i = 0, l = checkSet.length; i < l; i++ ) { var elem = checkSet[i]; if ( elem ) { var parent = elem.parentNode; checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false; } } } else { for ( var i = 0, l = checkSet.length; i < l; i++ ) { var elem = checkSet[i]; if ( elem ) { checkSet[i] = isPartStr ? elem.parentNode : elem.parentNode === part; } } if ( isPartStr ) { Sizzle.filter( part, checkSet, true ); } } }, "": function(checkSet, part, isXML){ var doneName = done++, checkFn = dirCheck; if ( typeof part === "string" && !/\W/.test(part) ) { var nodeCheck = part = part.toLowerCase(); checkFn = dirNodeCheck; } checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML); }, "~": function(checkSet, part, isXML){ var doneName = done++, checkFn = dirCheck; if ( typeof part === "string" && !/\W/.test(part) ) { var nodeCheck = part = part.toLowerCase(); checkFn = dirNodeCheck; } checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML); } }, find: { ID: function(match, context, isXML){ if ( typeof context.getElementById !== "undefined" && !isXML ) { var m = context.getElementById(match[1]); return m ? [m] : []; } }, NAME: function(match, context){ if ( typeof context.getElementsByName !== "undefined" ) { var ret = [], results = context.getElementsByName(match[1]); for ( var i = 0, l = results.length; i < l; i++ ) { if ( results[i].getAttribute("name") === match[1] ) { ret.push( results[i] ); } } return ret.length === 0 ? null : ret; } }, TAG: function(match, context){ return context.getElementsByTagName(match[1]); } }, preFilter: { CLASS: function(match, curLoop, inplace, result, not, isXML){ match = " " + match[1].replace(/\\/g, "") + " "; if ( isXML ) { return match; } for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { if ( elem ) { if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n]/g, " ").indexOf(match) >= 0) ) { if ( !inplace ) { result.push( elem ); } } else if ( inplace ) { curLoop[i] = false; } } } return false; }, ID: function(match){ return match[1].replace(/\\/g, ""); }, TAG: function(match, curLoop){ return match[1].toLowerCase(); }, CHILD: function(match){ if ( match[1] === "nth" ) { // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec( match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); // calculate the numbers (first)n+(last) including if they are negative match[2] = (test[1] + (test[2] || 1)) - 0; match[3] = test[3] - 0; } // TODO: Move to normal caching system match[0] = done++; return match; }, ATTR: function(match, curLoop, inplace, result, not, isXML){ var name = match[1].replace(/\\/g, ""); if ( !isXML && Expr.attrMap[name] ) { match[1] = Expr.attrMap[name]; } if ( match[2] === "~=" ) { match[4] = " " + match[4] + " "; } return match; }, PSEUDO: function(match, curLoop, inplace, result, not){ if ( match[1] === "not" ) { // If we're dealing with a complex expression, or a simple one if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { match[3] = Sizzle(match[3], null, null, curLoop); } else { var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); if ( !inplace ) { result.push.apply( result, ret ); } return false; } } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { return true; } return match; }, POS: function(match){ match.unshift( true ); return match; } }, filters: { enabled: function(elem){ return elem.disabled === false && elem.type !== "hidden"; }, disabled: function(elem){ return elem.disabled === true; }, checked: function(elem){ return elem.checked === true; }, selected: function(elem){ // Accessing this property makes selected-by-default // options in Safari work properly elem.parentNode.selectedIndex; return elem.selected === true; }, parent: function(elem){ return !!elem.firstChild; }, empty: function(elem){ return !elem.firstChild; }, has: function(elem, i, match){ return !!Sizzle( match[3], elem ).length; }, header: function(elem){ return /h\d/i.test( elem.nodeName ); }, text: function(elem){ return "text" === elem.type; }, radio: function(elem){ return "radio" === elem.type; }, checkbox: function(elem){ return "checkbox" === elem.type; }, file: function(elem){ return "file" === elem.type; }, password: function(elem){ return "password" === elem.type; }, submit: function(elem){ return "submit" === elem.type; }, image: function(elem){ return "image" === elem.type; }, reset: function(elem){ return "reset" === elem.type; }, button: function(elem){ return "button" === elem.type || elem.nodeName.toLowerCase() === "button"; }, input: function(elem){ return /input|select|textarea|button/i.test(elem.nodeName); } }, setFilters: { first: function(elem, i){ return i === 0; }, last: function(elem, i, match, array){ return i === array.length - 1; }, even: function(elem, i){ return i % 2 === 0; }, odd: function(elem, i){ return i % 2 === 1; }, lt: function(elem, i, match){ return i < match[3] - 0; }, gt: function(elem, i, match){ return i > match[3] - 0; }, nth: function(elem, i, match){ return match[3] - 0 === i; }, eq: function(elem, i, match){ return match[3] - 0 === i; } }, filter: { PSEUDO: function(elem, match, i, array){ var name = match[1], filter = Expr.filters[ name ]; if ( filter ) { return filter( elem, i, match, array ); } else if ( name === "contains" ) { return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0; } else if ( name === "not" ) { var not = match[3]; for ( var i = 0, l = not.length; i < l; i++ ) { if ( not[i] === elem ) { return false; } } return true; } else { Sizzle.error( "Syntax error, unrecognized expression: " + name ); } }, CHILD: function(elem, match){ var type = match[1], node = elem; switch (type) { case 'only': case 'first': while ( (node = node.previousSibling) ) { if ( node.nodeType === 1 ) { return false; } } if ( type === "first" ) { return true; } node = elem; case 'last': while ( (node = node.nextSibling) ) { if ( node.nodeType === 1 ) { return false; } } return true; case 'nth': var first = match[2], last = match[3]; if ( first === 1 && last === 0 ) { return true; } var doneName = match[0], parent = elem.parentNode; if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) { var count = 0; for ( node = parent.firstChild; node; node = node.nextSibling ) { if ( node.nodeType === 1 ) { node.nodeIndex = ++count; } } parent.sizcache = doneName; } var diff = elem.nodeIndex - last; if ( first === 0 ) { return diff === 0; } else { return ( diff % first === 0 && diff / first >= 0 ); } } }, ID: function(elem, match){ return elem.nodeType === 1 && elem.getAttribute("id") === match; }, TAG: function(elem, match){ return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match; }, CLASS: function(elem, match){ return (" " + (elem.className || elem.getAttribute("class")) + " ") .indexOf( match ) > -1; }, ATTR: function(elem, match){ var name = match[1], result = Expr.attrHandle[ name ] ? Expr.attrHandle[ name ]( elem ) : elem[ name ] != null ? elem[ name ] : elem.getAttribute( name ), value = result + "", type = match[2], check = match[4]; return result == null ? type === "!=" : type === "=" ? value === check : type === "*=" ? value.indexOf(check) >= 0 : type === "~=" ? (" " + value + " ").indexOf(check) >= 0 : !check ? value && result !== false : type === "!=" ? value !== check : type === "^=" ? value.indexOf(check) === 0 : type === "$=" ? value.substr(value.length - check.length) === check : type === "|=" ? value === check || value.substr(0, check.length + 1) === check + "-" : false; }, POS: function(elem, match, i, array){ var name = match[2], filter = Expr.setFilters[ name ]; if ( filter ) { return filter( elem, i, match, array ); } } } }; var origPOS = Expr.match.POS; for ( var type in Expr.match ) { Expr.match[ type ] = new RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source ); Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, function(all, num){ return "\\" + (num - 0 + 1); })); } var makeArray = function(array, results) { array = Array.prototype.slice.call( array, 0 ); if ( results ) { results.push.apply( results, array ); return results; } return array; }; // Perform a simple check to determine if the browser is capable of // converting a NodeList to an array using builtin methods. try { Array.prototype.slice.call( document.documentElement.childNodes, 0 ); // Provide a fallback method if it does not work } catch(e){ makeArray = function(array, results) { var ret = results || []; if ( toString.call(array) === "[object Array]" ) { Array.prototype.push.apply( ret, array ); } else { if ( typeof array.length === "number" ) { for ( var i = 0, l = array.length; i < l; i++ ) { ret.push( array[i] ); } } else { for ( var i = 0; array[i]; i++ ) { ret.push( array[i] ); } } } return ret; }; } var sortOrder; if ( document.documentElement.compareDocumentPosition ) { sortOrder = function( a, b ) { if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { if ( a == b ) { hasDuplicate = true; } return a.compareDocumentPosition ? -1 : 1; } var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1; if ( ret === 0 ) { hasDuplicate = true; } return ret; }; } else if ( "sourceIndex" in document.documentElement ) { sortOrder = function( a, b ) { if ( !a.sourceIndex || !b.sourceIndex ) { if ( a == b ) { hasDuplicate = true; } return a.sourceIndex ? -1 : 1; } var ret = a.sourceIndex - b.sourceIndex; if ( ret === 0 ) { hasDuplicate = true; } return ret; }; } else if ( document.createRange ) { sortOrder = function( a, b ) { if ( !a.ownerDocument || !b.ownerDocument ) { if ( a == b ) { hasDuplicate = true; } return a.ownerDocument ? -1 : 1; } var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange(); aRange.setStart(a, 0); aRange.setEnd(a, 0); bRange.setStart(b, 0); bRange.setEnd(b, 0); var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange); if ( ret === 0 ) { hasDuplicate = true; } return ret; }; } // Utility function for retreiving the text value of an array of DOM nodes function getText( elems ) { var ret = "", elem; for ( var i = 0; elems[i]; i++ ) { elem = elems[i]; // Get the text from text nodes and CDATA nodes if ( elem.nodeType === 3 || elem.nodeType === 4 ) { ret += elem.nodeValue; // Traverse everything else, except comment nodes } else if ( elem.nodeType !== 8 ) { ret += getText( elem.childNodes ); } } return ret; } // Check to see if the browser returns elements by name when // querying by getElementById (and provide a workaround) (function(){ // We're going to inject a fake input element with a specified name var form = document.createElement("div"), id = "script" + (new Date).getTime(); form.innerHTML = ""; // Inject it into the root element, check its status, and remove it quickly var root = document.documentElement; root.insertBefore( form, root.firstChild ); // The workaround has to do additional checks after a getElementById // Which slows things down for other browsers (hence the branching) if ( document.getElementById( id ) ) { Expr.find.ID = function(match, context, isXML){ if ( typeof context.getElementById !== "undefined" && !isXML ) { var m = context.getElementById(match[1]); return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : []; } }; Expr.filter.ID = function(elem, match){ var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); return elem.nodeType === 1 && node && node.nodeValue === match; }; } root.removeChild( form ); root = form = null; // release memory in IE })(); (function(){ // Check to see if the browser returns only elements // when doing getElementsByTagName("*") // Create a fake element var div = document.createElement("div"); div.appendChild( document.createComment("") ); // Make sure no comments are found if ( div.getElementsByTagName("*").length > 0 ) { Expr.find.TAG = function(match, context){ var results = context.getElementsByTagName(match[1]); // Filter out possible comments if ( match[1] === "*" ) { var tmp = []; for ( var i = 0; results[i]; i++ ) { if ( results[i].nodeType === 1 ) { tmp.push( results[i] ); } } results = tmp; } return results; }; } // Check to see if an attribute returns normalized href attributes div.innerHTML = ""; if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && div.firstChild.getAttribute("href") !== "#" ) { Expr.attrHandle.href = function(elem){ return elem.getAttribute("href", 2); }; } div = null; // release memory in IE })(); if ( document.querySelectorAll ) { (function(){ var oldSizzle = Sizzle, div = document.createElement("div"); div.innerHTML = "

"; // Safari can't handle uppercase or unicode characters when // in quirks mode. if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { return; } Sizzle = function(query, context, extra, seed){ context = context || document; // Only use querySelectorAll on non-XML documents // (ID selectors don't work in non-HTML documents) if ( !seed && context.nodeType === 9 && !isXML(context) ) { try { return makeArray( context.querySelectorAll(query), extra ); } catch(e){} } return oldSizzle(query, context, extra, seed); }; for ( var prop in oldSizzle ) { Sizzle[ prop ] = oldSizzle[ prop ]; } div = null; // release memory in IE })(); } (function(){ var div = document.createElement("div"); div.innerHTML = "
"; // Opera can't find a second classname (in 9.6) // Also, make sure that getElementsByClassName actually exists if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) { return; } // Safari caches class attributes, doesn't catch changes (in 3.2) div.lastChild.className = "e"; if ( div.getElementsByClassName("e").length === 1 ) { return; } Expr.order.splice(1, 0, "CLASS"); Expr.find.CLASS = function(match, context, isXML) { if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { return context.getElementsByClassName(match[1]); } }; div = null; // release memory in IE })(); function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { for ( var i = 0, l = checkSet.length; i < l; i++ ) { var elem = checkSet[i]; if ( elem ) { elem = elem[dir]; var match = false; while ( elem ) { if ( elem.sizcache === doneName ) { match = checkSet[elem.sizset]; break; } if ( elem.nodeType === 1 && !isXML ){ elem.sizcache = doneName; elem.sizset = i; } if ( elem.nodeName.toLowerCase() === cur ) { match = elem; break; } elem = elem[dir]; } checkSet[i] = match; } } } function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { for ( var i = 0, l = checkSet.length; i < l; i++ ) { var elem = checkSet[i]; if ( elem ) { elem = elem[dir]; var match = false; while ( elem ) { if ( elem.sizcache === doneName ) { match = checkSet[elem.sizset]; break; } if ( elem.nodeType === 1 ) { if ( !isXML ) { elem.sizcache = doneName; elem.sizset = i; } if ( typeof cur !== "string" ) { if ( elem === cur ) { match = true; break; } } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { match = elem; break; } } elem = elem[dir]; } checkSet[i] = match; } } } var contains = document.compareDocumentPosition ? function(a, b){ return a.compareDocumentPosition(b) & 16; } : function(a, b){ return a !== b && (a.contains ? a.contains(b) : true); }; var isXML = function(elem){ // documentElement is verified for cases where it doesn't yet exist // (such as loading iframes in IE - #4833) var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; return documentElement ? documentElement.nodeName !== "HTML" : false; }; var posProcess = function(selector, context){ var tmpSet = [], later = "", match, root = context.nodeType ? [context] : context; // Position selectors must be done after the filter // And so must :not(positional) so we move all PSEUDOs to the end while ( (match = Expr.match.PSEUDO.exec( selector )) ) { later += match[0]; selector = selector.replace( Expr.match.PSEUDO, "" ); } selector = Expr.relative[selector] ? selector + "*" : selector; for ( var i = 0, l = root.length; i < l; i++ ) { Sizzle( selector, root[i], tmpSet ); } return Sizzle.filter( later, tmpSet ); }; // EXPOSE jQuery.find = Sizzle; jQuery.expr = Sizzle.selectors; jQuery.expr[":"] = jQuery.expr.filters; jQuery.unique = Sizzle.uniqueSort; jQuery.getText = getText; jQuery.isXMLDoc = isXML; jQuery.contains = contains; return; window.Sizzle = Sizzle; })(); var runtil = /Until$/, rparentsprev = /^(?:parents|prevUntil|prevAll)/, // Note: This RegExp should be improved, or likely pulled from Sizzle rmultiselector = /,/, slice = Array.prototype.slice; // Implement the identical functionality for filter and not var winnow = function( elements, qualifier, keep ) { if ( jQuery.isFunction( qualifier ) ) { return jQuery.grep(elements, function( elem, i ) { return !!qualifier.call( elem, i, elem ) === keep; }); } else if ( qualifier.nodeType ) { return jQuery.grep(elements, function( elem, i ) { return (elem === qualifier) === keep; }); } else if ( typeof qualifier === "string" ) { var filtered = jQuery.grep(elements, function( elem ) { return elem.nodeType === 1; }); if ( isSimple.test( qualifier ) ) { return jQuery.filter(qualifier, filtered, !keep); } else { qualifier = jQuery.filter( qualifier, filtered ); } } return jQuery.grep(elements, function( elem, i ) { return (jQuery.inArray( elem, qualifier ) >= 0) === keep; }); }; jQuery.fn.extend({ find: function( selector ) { var ret = this.pushStack( "", "find", selector ), length = 0; for ( var i = 0, l = this.length; i < l; i++ ) { length = ret.length; jQuery.find( selector, this[i], ret ); if ( i > 0 ) { // Make sure that the results are unique for ( var n = length; n < ret.length; n++ ) { for ( var r = 0; r < length; r++ ) { if ( ret[r] === ret[n] ) { ret.splice(n--, 1); break; } } } } } return ret; }, has: function( target ) { var targets = jQuery( target ); return this.filter(function() { for ( var i = 0, l = targets.length; i < l; i++ ) { if ( jQuery.contains( this, targets[i] ) ) { return true; } } }); }, not: function( selector ) { return this.pushStack( winnow(this, selector, false), "not", selector); }, filter: function( selector ) { return this.pushStack( winnow(this, selector, true), "filter", selector ); }, is: function( selector ) { return !!selector && jQuery.filter( selector, this ).length > 0; }, closest: function( selectors, context ) { if ( jQuery.isArray( selectors ) ) { var ret = [], cur = this[0], match, matches = {}, selector; if ( cur && selectors.length ) { for ( var i = 0, l = selectors.length; i < l; i++ ) { selector = selectors[i]; if ( !matches[selector] ) { matches[selector] = jQuery.expr.match.POS.test( selector ) ? jQuery( selector, context || this.context ) : selector; } } while ( cur && cur.ownerDocument && cur !== context ) { for ( selector in matches ) { match = matches[selector]; if ( match.jquery ? match.index(cur) > -1 : jQuery(cur).is(match) ) { ret.push({ selector: selector, elem: cur }); delete matches[selector]; } } cur = cur.parentNode; } } return ret; } var pos = jQuery.expr.match.POS.test( selectors ) ? jQuery( selectors, context || this.context ) : null; return this.map(function( i, cur ) { while ( cur && cur.ownerDocument && cur !== context ) { if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selectors) ) { return cur; } cur = cur.parentNode; } return null; }); }, // Determine the position of an element within // the matched set of elements index: function( elem ) { if ( !elem || typeof elem === "string" ) { return jQuery.inArray( this[0], // If it receives a string, the selector is used // If it receives nothing, the siblings are used elem ? jQuery( elem ) : this.parent().children() ); } // Locate the position of the desired element return jQuery.inArray( // If it receives a jQuery object, the first element is used elem.jquery ? elem[0] : elem, this ); }, add: function( selector, context ) { var set = typeof selector === "string" ? jQuery( selector, context || this.context ) : jQuery.makeArray( selector ), all = jQuery.merge( this.get(), set ); return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? all : jQuery.unique( all ) ); }, andSelf: function() { return this.add( this.prevObject ); } }); // A painfully simple check to see if an element is disconnected // from a document (should be improved, where feasible). function isDisconnected( node ) { return !node || !node.parentNode || node.parentNode.nodeType === 11; } jQuery.each({ parent: function( elem ) { var parent = elem.parentNode; return parent && parent.nodeType !== 11 ? parent : null; }, parents: function( elem ) { return jQuery.dir( elem, "parentNode" ); }, parentsUntil: function( elem, i, until ) { return jQuery.dir( elem, "parentNode", until ); }, next: function( elem ) { return jQuery.nth( elem, 2, "nextSibling" ); }, prev: function( elem ) { return jQuery.nth( elem, 2, "previousSibling" ); }, nextAll: function( elem ) { return jQuery.dir( elem, "nextSibling" ); }, prevAll: function( elem ) { return jQuery.dir( elem, "previousSibling" ); }, nextUntil: function( elem, i, until ) { return jQuery.dir( elem, "nextSibling", until ); }, prevUntil: function( elem, i, until ) { return jQuery.dir( elem, "previousSibling", until ); }, siblings: function( elem ) { return jQuery.sibling( elem.parentNode.firstChild, elem ); }, children: function( elem ) { return jQuery.sibling( elem.firstChild ); }, contents: function( elem ) { return jQuery.nodeName( elem, "iframe" ) ? elem.contentDocument || elem.contentWindow.document : jQuery.makeArray( elem.childNodes ); } }, function( name, fn ) { jQuery.fn[ name ] = function( until, selector ) { var ret = jQuery.map( this, fn, until ); if ( !runtil.test( name ) ) { selector = until; } if ( selector && typeof selector === "string" ) { ret = jQuery.filter( selector, ret ); } ret = this.length > 1 ? jQuery.unique( ret ) : ret; if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) { ret = ret.reverse(); } return this.pushStack( ret, name, slice.call(arguments).join(",") ); }; }); jQuery.extend({ filter: function( expr, elems, not ) { if ( not ) { expr = ":not(" + expr + ")"; } return jQuery.find.matches(expr, elems); }, dir: function( elem, dir, until ) { var matched = [], cur = elem[dir]; while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { if ( cur.nodeType === 1 ) { matched.push( cur ); } cur = cur[dir]; } return matched; }, nth: function( cur, result, dir, elem ) { result = result || 1; var num = 0; for ( ; cur; cur = cur[dir] ) { if ( cur.nodeType === 1 && ++num === result ) { break; } } return cur; }, sibling: function( n, elem ) { var r = []; for ( ; n; n = n.nextSibling ) { if ( n.nodeType === 1 && n !== elem ) { r.push( n ); } } return r; } }); var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, rleadingWhitespace = /^\s+/, rxhtmlTag = /(<([\w:]+)[^>]*?)\/>/g, rselfClosing = /^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i, rtagName = /<([\w:]+)/, rtbody = /"; }, wrapMap = { option: [ 1, "" ], legend: [ 1, "
", "
" ], thead: [ 1, "", "
" ], tr: [ 2, "", "
" ], td: [ 3, "", "
" ], col: [ 2, "", "
" ], area: [ 1, "", "" ], _default: [ 0, "", "" ] }; wrapMap.optgroup = wrapMap.option; wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; wrapMap.th = wrapMap.td; // IE can't serialize and ================================================ FILE: debug_toolbar/templates/debug_toolbar/panels/cache.html ================================================ {% load i18n %}
{% trans "Total Calls" %} {{ cache_calls }} {% trans "Total Time" %} {{ cache_time }}ms {% trans "Hits" %} {{ cache.hits }} {% trans "Misses" %} {{ cache.misses }}
gets {{ cache.gets }} sets {{ cache.sets }} deletes {{ cache.deletes }} get_many {{ cache.get_many }}
{% if cache.calls %}

{% trans "Breakdown" %}

{% for query in cache.calls %} {% endfor %}
{% trans "Time" %} (ms) {% trans "Type" %} {% trans "Parameters" %} {% trans "Function" %}
{{ query.0|floatformat:"4" }} {{ query.1|escape }} {{ query.2|escape }} {{ query.3.2|escape }}: {{ query.3.3.0|escape }}
{% endif %} ================================================ FILE: debug_toolbar/templates/debug_toolbar/panels/headers.html ================================================ {% load i18n %} {% for key, value in headers.iteritems %} {% endfor %}
{% trans "Key" %} {% trans "Value" %}
{{ key|escape }} {{ value|escape }}
================================================ FILE: debug_toolbar/templates/debug_toolbar/panels/logger.html ================================================ {% load i18n %} {% if records %} {% for record in records %} {% endfor %}
{% trans "Level" %} {% trans "Time" %} {% trans "Channel" %} {% trans "Message" %} {% trans "Location" %}
{{ record.level }} {{ record.time|date:"h:i:s m/d/Y" }} {{ record.channel|default:"-" }} {{ record.message }} {{ record.file }}:{{ record.line }}
{% else %}

{% trans "No messages logged" %}.

{% endif %} ================================================ FILE: debug_toolbar/templates/debug_toolbar/panels/profiling.html ================================================ {% load i18n %} {% for call in func_list %} {% endfor %}
{% trans "Call" %} {% trans "TotTime" %} {% trans "Per" %} {% trans "CumTime" %} {% trans "Per" %} {% trans "Count" %}
{% if call.has_subfuncs %} - {% else %} {% endif %} {{ call.func_std_string }}
{{ call.tottime|floatformat:3 }} {{ call.tottime_per_call|floatformat:3 }} {{ call.cumtime|floatformat:3 }} {{ call.cumtime_per_call|floatformat:3 }} {{ call.count }}
================================================ FILE: debug_toolbar/templates/debug_toolbar/panels/request_vars.html ================================================ {% load i18n %}

{% trans 'View information' %}

{% trans 'View Function' %} {% trans 'args' %} {% trans 'kwargs' %}
{{ view_func }} {{ view_args|default:"None" }} {% if view_kwargs.items %} {% for k, v in view_kwargs.items %} {{ k }}={{ v }}{% if not forloop.last %}, {% endif %} {% endfor %} {% else %} None {% endif %}

{% trans 'COOKIES Variables' %}

{% if cookies %} {% for key, value in cookies %} {% endfor %}
{% trans "Variable" %} {% trans "Value" %}
{{ key|escape }} {{ value|escape }}
{% else %}

{% trans "No COOKIE data" %}

{% endif %}

{% trans 'SESSION Variables' %}

{% if session %} {% for key, value in session %} {% endfor %}
{% trans "Variable" %} {% trans "Value" %}
{{ key|escape }} {{ value|escape }}
{% else %}

{% trans "No SESSION data" %}

{% endif %}

{% trans 'GET Variables' %}

{% if get %} {% for key, value in get %} {% endfor %}
{% trans "Variable" %} {% trans "Value" %}
{{ key|escape }} {{ value|join:", "|escape }}
{% else %}

{% trans "No GET data" %}

{% endif %}

{% trans 'POST Variables' %}

{% if post %} {% for key, value in post %} {% endfor %}
{% trans "Variable" %} {% trans "Value" %}
{{ key|escape }} {{ value|join:", "|escape }}
{% else %}

{% trans "No POST data" %}

{% endif %} ================================================ FILE: debug_toolbar/templates/debug_toolbar/panels/settings_vars.html ================================================ {% load i18n %} {% for var in settings.items|dictsort:"0" %} {% endfor %}
{% trans "Setting" %} {% trans "Value" %}
{{ var.0 }} {{ var.1|pprint }}
================================================ FILE: debug_toolbar/templates/debug_toolbar/panels/signals.html ================================================ {% load i18n %} {% for name, signal, receivers in signals %} {% endfor %}
{% trans "Signal" %} {% trans 'Providing Args' %} {% trans 'Receivers' %}
{{ name|escape }} {{ signal.providing_args|join:", " }} {{ receivers|join:", " }}
================================================ FILE: debug_toolbar/templates/debug_toolbar/panels/sql.html ================================================ {% load i18n %}
    {% for alias, info in databases %}
  •   {{ alias }} {{ info.time_spent|floatformat:"2" }} ms ({% blocktrans count info.num_queries as num %}{{ num }} query{% plural %}{{ num }} queries{% endblocktrans %})
  • {% endfor %}
{% if queries %} {% for query in queries %} {% endfor %}
  {% trans 'Query' %} {% trans 'Timeline' %} {% trans 'Time (ms)' %} {% trans "Action" %}
  +
{{ query.sql|safe }}
{{ query.width_ratio }}%
{{ query.duration|floatformat:"2" }} {% if query.params %} {% if query.is_select %} Sel Expl {% ifequal query.engine 'mysql' %} Prof {% endifequal %} {% endif %} {% endif %}

Connection: {{ query.alias }}

{% if query.iso_level %}

Isolation Level: {{ query.iso_level }}

{% endif %} {% if query.trans_status %}

Transaction Status: {{ query.trans_status }}

{% endif %} {% if query.stacktrace %}
{{ query.stacktrace }}
{% endif %} {% if query.template_info %} {% for line in query.template_info.context %} {% endfor %}
{{ line.num }} {{ line.content }}

{{ query.template_info.name|default:"(unknown)" }}

{% endif %}
{% else %}

No SQL queries were recorded during this request.

{% endif %} ================================================ FILE: debug_toolbar/templates/debug_toolbar/panels/sql_explain.html ================================================ {% load i18n %}
{% trans "Back" %}

{% trans "SQL Explained" %}

{% trans "Executed SQL" %}
{{ sql|safe }}
{% trans "Time" %}
{{ duration }} ms
{% for h in headers %} {% endfor %} {% for row in result %} {% for column in row %} {% endfor %} {% endfor %}
{{ h|upper }}
{{ column|escape }}
================================================ FILE: debug_toolbar/templates/debug_toolbar/panels/sql_profile.html ================================================ {% load i18n %}
{% trans "Back" %}

{% trans "SQL Profiled" %}

{% if result %}
{% trans "Executed SQL" %}
{{ sql|safe }}
{% trans "Time" %}
{{ duration }} ms
{% for h in headers %} {% endfor %} {% for row in result %} {% for column in row %} {% endfor %} {% endfor %}
{{ h|upper }}
{{ column|escape }}
{% else %}
{% trans 'Error' %}
{{ result_error }}
{% endif %}
================================================ FILE: debug_toolbar/templates/debug_toolbar/panels/sql_select.html ================================================ {% load i18n %}
{% trans "Back" %}

{% trans "SQL Selected" %}

{% trans "Executed SQL" %}
{{ sql|safe }}
{% trans "Time" %}
{{ duration }} ms
{% if result %} {% for h in headers %} {% endfor %} {% for row in result %} {% for column in row %} {% endfor %} {% endfor %}
{{ h|upper }}
{{ column|escape }}
{% else %}

{% trans "Empty set" %}

{% endif %}
================================================ FILE: debug_toolbar/templates/debug_toolbar/panels/template_source.html ================================================ {% load i18n %}
{% trans "Back" %}

{% trans 'Template Source' %}: {{ template_name }}

{% if not source.pygmentized %} {{ source }} {% else %} {{ source }} {% endif %}
================================================ FILE: debug_toolbar/templates/debug_toolbar/panels/templates.html ================================================ {% load i18n %}

{% trans 'Template path' %}{{ template_dirs|length|pluralize }}

{% if template_dirs %}
    {% for template in template_dirs %}
  1. {{ template }}
  2. {% endfor %}
{% else %}

None

{% endif %}

{% trans "Template" %}{{ templates|length|pluralize }}

{% if templates %}
{% for template in templates %}
{{ template.template.name|addslashes }}
{{ template.template.origin_name|addslashes }}
{% if template.context %}
{% endif %} {% endfor %}
{% else %}

{% trans 'None' %}

{% endif %}

{% trans 'Context processor' %}{{ context_processors|length|pluralize }}

{% if context_processors %}
{% for key, value in context_processors.iteritems %}
{{ key|escape }}
{% endfor %}
{% else %}

{% trans 'None' %}

{% endif %} ================================================ FILE: debug_toolbar/templates/debug_toolbar/panels/timer.html ================================================ {% load i18n %} {% for key, value in rows %} {% endfor %}
{% trans "Resource" %} {% trans "Value" %}
{{ key|escape }} {{ value|escape }}
================================================ FILE: debug_toolbar/templates/debug_toolbar/panels/versions.html ================================================ {% load i18n %} {% for package, version in versions.iteritems %} {% endfor %}
{% trans "Package" %} {% trans "Version" %}
{{ package }} {{ version }}
================================================ FILE: debug_toolbar/templates/debug_toolbar/redirect.html ================================================ {% load i18n %}

HttpResponseRedirect

{% trans 'Location' %}: {{ redirect_to }}

{% trans "The Django Debug Toolbar has intercepted a redirect to the above URL for debug viewing purposes. You can click the above link to continue with the redirect as normal. If you'd like to disable this feature, set the DEBUG_TOOLBAR_CONFIG dictionary's key INTERCEPT_REDIRECTS to False." %}

================================================ FILE: debug_toolbar/tests/__init__.py ================================================ from tests import * ================================================ FILE: debug_toolbar/tests/templates/404.html ================================================ ================================================ FILE: debug_toolbar/tests/tests.py ================================================ from debug_toolbar.middleware import DebugToolbarMiddleware from debug_toolbar.panels.sql import SQLDebugPanel from debug_toolbar.toolbar.loader import DebugToolbar from debug_toolbar.utils.tracking import pre_dispatch, post_dispatch, callbacks from django.contrib.auth.models import User from django.test import TestCase from dingus import Dingus import thread class BaseTestCase(TestCase): def setUp(self): request = Dingus('request') toolbar = DebugToolbar(request) DebugToolbarMiddleware.debug_toolbars[thread.get_ident()] = toolbar self.toolbar = toolbar class DebugToolbarTestCase(BaseTestCase): urls = 'debug_toolbar.tests.urls' def test_middleware(self): resp = self.client.get('/execute_sql/') self.assertEquals(resp.status_code, 200) class SQLPanelTestCase(BaseTestCase): def test_recording(self): panel = self.toolbar.get_panel(SQLDebugPanel) self.assertEquals(len(panel._queries), 0) list(User.objects.all()) # ensure query was logged self.assertEquals(len(panel._queries), 1) query = panel._queries[0] self.assertEquals(query[0], 'default') self.assertTrue('sql' in query[1]) self.assertTrue('duration' in query[1]) self.assertTrue('stacktrace' in query[1]) def module_func(*args, **kwargs): """Used by dispatch tests""" return 'blah' class TrackingTestCase(BaseTestCase): @classmethod def class_method(cls, *args, **kwargs): return 'blah' def class_func(self, *args, **kwargs): """Used by dispatch tests""" return 'blah' def test_pre_hook(self): foo = {} @pre_dispatch(module_func) def test(**kwargs): foo.update(kwargs) self.assertTrue(hasattr(module_func, '__wrapped__')) self.assertEquals(len(callbacks['before']), 1) module_func('hi', foo='bar') self.assertTrue('sender' in foo, foo) # best we can do self.assertEquals(foo['sender'].__name__, 'module_func') self.assertTrue('start' in foo, foo) self.assertTrue(foo['start'] > 0) self.assertTrue('stop' not in foo, foo) self.assertTrue('args' in foo, foo) self.assertTrue(len(foo['args']), 1) self.assertEquals(foo['args'][0], 'hi') self.assertTrue('kwargs' in foo, foo) self.assertTrue(len(foo['kwargs']), 1) self.assertTrue('foo' in foo['kwargs']) self.assertEquals(foo['kwargs']['foo'], 'bar') callbacks['before'] = {} @pre_dispatch(TrackingTestCase.class_func) def test(**kwargs): foo.update(kwargs) self.assertTrue(hasattr(TrackingTestCase.class_func, '__wrapped__')) self.assertEquals(len(callbacks['before']), 1) self.class_func('hello', foo='bar') self.assertTrue('sender' in foo, foo) # best we can do self.assertEquals(foo['sender'].__name__, 'class_func') self.assertTrue('start' in foo, foo) self.assertTrue(foo['start'] > 0) self.assertTrue('stop' not in foo, foo) self.assertTrue('args' in foo, foo) self.assertTrue(len(foo['args']), 2) self.assertEquals(foo['args'][1], 'hello') self.assertTrue('kwargs' in foo, foo) self.assertTrue(len(foo['kwargs']), 1) self.assertTrue('foo' in foo['kwargs']) self.assertEquals(foo['kwargs']['foo'], 'bar') # callbacks['before'] = {} # # @pre_dispatch(TrackingTestCase.class_method) # def test(**kwargs): # foo.update(kwargs) # # self.assertTrue(hasattr(TrackingTestCase.class_method, '__wrapped__')) # self.assertEquals(len(callbacks['before']), 1) # # TrackingTestCase.class_method() # # self.assertTrue('sender' in foo, foo) # # best we can do # self.assertEquals(foo['sender'].__name__, 'class_method') # self.assertTrue('start' in foo, foo) # self.assertTrue('stop' not in foo, foo) # self.assertTrue('args' in foo, foo) def test_post_hook(self): foo = {} @post_dispatch(module_func) def test(**kwargs): foo.update(kwargs) self.assertTrue(hasattr(module_func, '__wrapped__')) self.assertEquals(len(callbacks['after']), 1) module_func('hi', foo='bar') self.assertTrue('sender' in foo, foo) # best we can do self.assertEquals(foo['sender'].__name__, 'module_func') self.assertTrue('start' in foo, foo) self.assertTrue(foo['start'] > 0) self.assertTrue('stop' in foo, foo) self.assertTrue(foo['stop'] > foo['start']) self.assertTrue('args' in foo, foo) self.assertTrue(len(foo['args']), 1) self.assertEquals(foo['args'][0], 'hi') self.assertTrue('kwargs' in foo, foo) self.assertTrue(len(foo['kwargs']), 1) self.assertTrue('foo' in foo['kwargs']) self.assertEquals(foo['kwargs']['foo'], 'bar') callbacks['after'] = {} @post_dispatch(TrackingTestCase.class_func) def test(**kwargs): foo.update(kwargs) self.assertTrue(hasattr(TrackingTestCase.class_func, '__wrapped__')) self.assertEquals(len(callbacks['after']), 1) self.class_func('hello', foo='bar') self.assertTrue('sender' in foo, foo) # best we can do self.assertEquals(foo['sender'].__name__, 'class_func') self.assertTrue('start' in foo, foo) self.assertTrue(foo['start'] > 0) self.assertTrue('stop' in foo, foo) self.assertTrue(foo['stop'] > foo['start']) self.assertTrue('args' in foo, foo) self.assertTrue(len(foo['args']), 2) self.assertEquals(foo['args'][1], 'hello') self.assertTrue('kwargs' in foo, foo) self.assertTrue(len(foo['kwargs']), 1) self.assertTrue('foo' in foo['kwargs']) self.assertEquals(foo['kwargs']['foo'], 'bar') ================================================ FILE: debug_toolbar/tests/urls.py ================================================ """ URLpatterns for the debug toolbar. These should not be loaded explicitly; the debug toolbar middleware will patch this into the urlconf for the request. """ from django.conf.urls.defaults import * from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', url(r'^execute_sql/$', 'debug_toolbar.tests.views.execute_sql'), ) ================================================ FILE: debug_toolbar/tests/views.py ================================================ from django.contrib.auth.models import User from django.http import HttpResponse def execute_sql(request): list(User.objects.all()) return HttpResponse() ================================================ FILE: debug_toolbar/toolbar/__init__.py ================================================ ================================================ FILE: debug_toolbar/toolbar/loader.py ================================================ """ The main DebugToolbar class that loads and renders the Toolbar. """ import os.path, os from django.conf import settings from django.template.loader import render_to_string from django.utils.datastructures import SortedDict from django.utils.safestring import mark_safe class DebugToolbar(object): def __init__(self, request): self.request = request self._panels = SortedDict() base_url = self.request.META.get('SCRIPT_NAME', '') self.config = { 'INTERCEPT_REDIRECTS': True, 'MEDIA_URL': u'%s/__debug__/m/' % base_url } # Check if settings has a DEBUG_TOOLBAR_CONFIG and updated config self.config.update(getattr(settings, 'DEBUG_TOOLBAR_CONFIG', {})) self.template_context = { 'BASE_URL': base_url, # for backwards compatibility 'DEBUG_TOOLBAR_MEDIA_URL': self.config.get('MEDIA_URL'), } # Override this tuple by copying to settings.py as `DEBUG_TOOLBAR_PANELS` self.default_panels = ( 'debug_toolbar.panels.version.VersionDebugPanel', 'debug_toolbar.panels.timer.TimerDebugPanel', 'debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel', 'debug_toolbar.panels.headers.HeaderDebugPanel', 'debug_toolbar.panels.request_vars.RequestVarsDebugPanel', 'debug_toolbar.panels.sql.SQLDebugPanel', 'debug_toolbar.panels.template.TemplateDebugPanel', #'debug_toolbar.panels.cache.CacheDebugPanel', 'debug_toolbar.panels.signals.SignalDebugPanel', 'debug_toolbar.panels.logger.LoggingPanel', ) self.load_panels() def _get_panels(self): return self._panels.values() panels = property(_get_panels) def get_panel(self, cls): return self._panels[cls] def load_panels(self): """ Populate debug panels """ from django.conf import settings from django.core import exceptions # Check if settings has a DEBUG_TOOLBAR_PANELS, otherwise use default if hasattr(settings, 'DEBUG_TOOLBAR_PANELS'): self.default_panels = settings.DEBUG_TOOLBAR_PANELS for panel_path in self.default_panels: try: dot = panel_path.rindex('.') except ValueError: raise exceptions.ImproperlyConfigured, '%s isn\'t a debug panel module' % panel_path panel_module, panel_classname = panel_path[:dot], panel_path[dot+1:] try: mod = __import__(panel_module, {}, {}, ['']) except ImportError, e: raise exceptions.ImproperlyConfigured, 'Error importing debug panel %s: "%s"' % (panel_module, e) try: panel_class = getattr(mod, panel_classname) except AttributeError: raise exceptions.ImproperlyConfigured, 'Toolbar Panel module "%s" does not define a "%s" class' % (panel_module, panel_classname) try: panel_instance = panel_class(context=self.template_context) except: raise # Bubble up problem loading panel self._panels[panel_class] = panel_instance def render_toolbar(self): """ Renders the overall Toolbar with panels inside. """ media_path = os.path.join(os.path.dirname(__file__), os.pardir, 'media', 'debug_toolbar') context = self.template_context.copy() context.update({ 'panels': self.panels, 'js': mark_safe(open(os.path.join(media_path, 'js', 'toolbar.min.js'), 'r').read()), 'css': mark_safe(open(os.path.join(media_path, 'css', 'toolbar.min.css'), 'r').read()), }) return render_to_string('debug_toolbar/base.html', context) ================================================ FILE: debug_toolbar/urls.py ================================================ """ URLpatterns for the debug toolbar. These should not be loaded explicitly; the debug toolbar middleware will patch this into the urlconf for the request. """ from django.conf.urls.defaults import * from django.conf import settings _PREFIX = '__debug__' urlpatterns = patterns('', url(r'^%s/m/(.*)$' % _PREFIX, 'debug_toolbar.views.debug_media'), url(r'^%s/sql_select/$' % _PREFIX, 'debug_toolbar.views.sql_select', name='sql_select'), url(r'^%s/sql_explain/$' % _PREFIX, 'debug_toolbar.views.sql_explain', name='sql_explain'), url(r'^%s/sql_profile/$' % _PREFIX, 'debug_toolbar.views.sql_profile', name='sql_profile'), url(r'^%s/template_source/$' % _PREFIX, 'debug_toolbar.views.template_source', name='template_source'), ) ================================================ FILE: debug_toolbar/utils/__init__.py ================================================ import os.path import django import SocketServer from django.conf import settings from django.views.debug import linebreak_iter # Figure out some paths django_path = os.path.realpath(os.path.dirname(django.__file__)) socketserver_path = os.path.realpath(os.path.dirname(SocketServer.__file__)) def ms_from_timedelta(td): """ Given a timedelta object, returns a float representing milliseconds """ return (td.seconds * 1000) + (td.microseconds / 1000.0) def tidy_stacktrace(strace): """ Clean up stacktrace and remove all entries that: 1. Are part of Django (except contrib apps) 2. Are part of SocketServer (used by Django's dev server) 3. Are the last entry (which is part of our stacktracing code) """ trace = [] for s in strace[:-1]: s_path = os.path.realpath(s[0]) if getattr(settings, 'DEBUG_TOOLBAR_CONFIG', {}).get('HIDE_DJANGO_SQL', True) \ and django_path in s_path and not 'django/contrib' in s_path: continue if socketserver_path in s_path: continue trace.append((s[0], s[1], s[2], s[3])) return trace def get_template_info(source, context_lines=3): line = 0 upto = 0 source_lines = [] before = during = after = "" origin, (start, end) = source template_source = origin.reload() for num, next in enumerate(linebreak_iter(template_source)): if start >= upto and end <= next: line = num before = template_source[upto:start] during = template_source[start:end] after = template_source[end:next] source_lines.append((num, template_source[upto:next])) upto = next top = max(1, line - context_lines) bottom = min(len(source_lines), line + 1 + context_lines) context = [] for num, content in source_lines[top:bottom]: context.append({ 'num': num, 'content': content, 'highlight': (num == line), }) return { 'name': origin.name, 'context': context, } ================================================ FILE: debug_toolbar/utils/compat/__init__.py ================================================ ================================================ FILE: debug_toolbar/utils/compat/db.py ================================================ from django.conf import settings try: from django.db import connections dbconf = settings.DATABASES except ImportError: # Compat with < Django 1.2 from django.db import connection connections = {'default': connection} dbconf = { 'default': { 'ENGINE': settings.DATABASE_ENGINE, } } ================================================ FILE: debug_toolbar/utils/sqlparse/__init__.py ================================================ # Copyright (C) 2008 Andi Albrecht, albrecht.andi@gmail.com # # This module is part of python-sqlparse and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php. """Parse SQL statements.""" __version__ = '0.1.1' import os class SQLParseError(Exception): """Base class for exceptions in this module.""" # Setup namespace from debug_toolbar.utils.sqlparse import engine from debug_toolbar.utils.sqlparse import filters from debug_toolbar.utils.sqlparse import formatter def parse(sql): """Parse sql and return a list of statements. *sql* is a single string containting one or more SQL statements. Returns a tuple of :class:`~sqlparse.sql.Statement` instances. """ stack = engine.FilterStack() stack.full_analyze() return tuple(stack.run(sql)) def format(sql, **options): """Format *sql* according to *options*. Available options are documented in :ref:`formatting`. Returns the formatted SQL statement as string. """ stack = engine.FilterStack() options = formatter.validate_options(options) stack = formatter.build_filter_stack(stack, options) stack.postprocess.append(filters.SerializerUnicode()) return ''.join(stack.run(sql)) def split(sql): """Split *sql* into single statements. Returns a list of strings. """ stack = engine.FilterStack() stack.split_statements = True return [unicode(stmt) for stmt in stack.run(sql)] ================================================ FILE: debug_toolbar/utils/sqlparse/engine/__init__.py ================================================ # Copyright (C) 2008 Andi Albrecht, albrecht.andi@gmail.com # # This module is part of python-sqlparse and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php. """filter""" import re from debug_toolbar.utils.sqlparse import lexer, SQLParseError from debug_toolbar.utils.sqlparse.engine import grouping from debug_toolbar.utils.sqlparse.engine.filter import StatementFilter # XXX remove this when cleanup is complete Filter = object class FilterStack(object): def __init__(self): self.preprocess = [] self.stmtprocess = [] self.postprocess = [] self.split_statements = False self._grouping = False def _flatten(self, stream): for token in stream: if token.is_group(): for t in self._flatten(token.tokens): yield t else: yield token def enable_grouping(self): self._grouping = True def full_analyze(self): self.enable_grouping() def run(self, sql): stream = lexer.tokenize(sql) # Process token stream if self.preprocess: for filter_ in self.preprocess: stream = filter_.process(self, stream) if (self.stmtprocess or self.postprocess or self.split_statements or self._grouping): splitter = StatementFilter() stream = splitter.process(self, stream) if self._grouping: def _group(stream): for stmt in stream: grouping.group(stmt) yield stmt stream = _group(stream) if self.stmtprocess: def _run(stream): ret = [] for stmt in stream: for filter_ in self.stmtprocess: filter_.process(self, stmt) ret.append(stmt) return ret stream = _run(stream) if self.postprocess: def _run(stream): for stmt in stream: stmt.tokens = list(self._flatten(stmt.tokens)) for filter_ in self.postprocess: stmt = filter_.process(self, stmt) yield stmt stream = _run(stream) return stream ================================================ FILE: debug_toolbar/utils/sqlparse/engine/filter.py ================================================ # -*- coding: utf-8 -*- from debug_toolbar.utils.sqlparse import tokens as T from debug_toolbar.utils.sqlparse.engine.grouping import Statement, Token class TokenFilter(object): def __init__(self, **options): self.options = options def process(self, stack, stream): """Process token stream.""" raise NotImplementedError class StatementFilter(TokenFilter): def __init__(self): TokenFilter.__init__(self) self._in_declare = False self._in_dbldollar = False self._is_create = False def _reset(self): self._in_declare = False self._in_dbldollar = False self._is_create = False def _change_splitlevel(self, ttype, value): # PostgreSQL if (ttype == T.Name.Builtin and value.startswith('$') and value.endswith('$')): if self._in_dbldollar: self._in_dbldollar = False return -1 else: self._in_dbldollar = True return 1 elif self._in_dbldollar: return 0 # ANSI if ttype is not T.Keyword: return 0 unified = value.upper() if unified == 'DECLARE': self._in_declare = True return 1 if unified == 'BEGIN': if self._in_declare: return 0 return 0 if unified == 'END': # Should this respect a preceeding BEGIN? # In CASE ... WHEN ... END this results in a split level -1. return -1 if ttype is T.Keyword.DDL and unified.startswith('CREATE'): self._is_create = True if unified in ('IF', 'FOR') and self._is_create: return 1 # Default return 0 def process(self, stack, stream): splitlevel = 0 stmt = None consume_ws = False stmt_tokens = [] for ttype, value in stream: # Before appending the token if (consume_ws and ttype is not T.Whitespace and ttype is not T.Comment.Single): consume_ws = False stmt.tokens = stmt_tokens yield stmt self._reset() stmt = None splitlevel = 0 if stmt is None: stmt = Statement() stmt_tokens = [] splitlevel += self._change_splitlevel(ttype, value) # Append the token stmt_tokens.append(Token(ttype, value)) # After appending the token if (splitlevel <= 0 and ttype is T.Punctuation and value == ';'): consume_ws = True if stmt is not None: stmt.tokens = stmt_tokens yield stmt ================================================ FILE: debug_toolbar/utils/sqlparse/engine/grouping.py ================================================ # -*- coding: utf-8 -*- import itertools import re import types from debug_toolbar.utils.sqlparse import tokens as T from debug_toolbar.utils.sqlparse.sql import * def _group_left_right(tlist, ttype, value, cls, check_right=lambda t: True, include_semicolon=False): [_group_left_right(sgroup, ttype, value, cls, check_right, include_semicolon) for sgroup in tlist.get_sublists() if not isinstance(sgroup, cls)] idx = 0 token = tlist.token_next_match(idx, ttype, value) while token: right = tlist.token_next(tlist.token_index(token)) left = tlist.token_prev(tlist.token_index(token)) if (right is None or not check_right(right) or left is None): token = tlist.token_next_match(tlist.token_index(token)+1, ttype, value) else: if include_semicolon: right = tlist.token_next_match(tlist.token_index(right), T.Punctuation, ';') tokens = tlist.tokens_between(left, right)[1:] if not isinstance(left, cls): new = cls([left]) new_idx = tlist.token_index(left) tlist.tokens.remove(left) tlist.tokens.insert(new_idx, new) left = new left.tokens.extend(tokens) for t in tokens: tlist.tokens.remove(t) token = tlist.token_next_match(tlist.token_index(left)+1, ttype, value) def _group_matching(tlist, start_ttype, start_value, end_ttype, end_value, cls, include_semicolon=False, recurse=False): def _find_matching(i, tl, stt, sva, ett, eva): depth = 1 for t in tl.tokens[i:]: if t.match(stt, sva): depth += 1 elif t.match(ett, eva): depth -= 1 if depth == 1: return t return None [_group_matching(sgroup, start_ttype, start_value, end_ttype, end_value, cls, include_semicolon) for sgroup in tlist.get_sublists() if recurse] if isinstance(tlist, cls): idx = 1 else: idx = 0 token = tlist.token_next_match(idx, start_ttype, start_value) while token: tidx = tlist.token_index(token) end = _find_matching(tidx, tlist, start_ttype, start_value, end_ttype, end_value) if end is None: idx = tidx+1 else: if include_semicolon: next_ = tlist.token_next(tlist.token_index(end)) if next_ and next_.match(T.Punctuation, ';'): end = next_ group = tlist.group_tokens(cls, tlist.tokens_between(token, end)) _group_matching(group, start_ttype, start_value, end_ttype, end_value, cls, include_semicolon) idx = tlist.token_index(group)+1 token = tlist.token_next_match(idx, start_ttype, start_value) def group_if(tlist): _group_matching(tlist, T.Keyword, 'IF', T.Keyword, 'END IF', If, True) def group_for(tlist): _group_matching(tlist, T.Keyword, 'FOR', T.Keyword, 'END LOOP', For, True) def group_as(tlist): _group_left_right(tlist, T.Keyword, 'AS', Identifier) def group_assignment(tlist): _group_left_right(tlist, T.Assignment, ':=', Assignment, include_semicolon=True) def group_comparsion(tlist): _group_left_right(tlist, T.Operator, None, Comparsion) def group_case(tlist): _group_matching(tlist, T.Keyword, 'CASE', T.Keyword, 'END', Case, include_semicolon=True, recurse=True) def group_identifier(tlist): def _consume_cycle(tl, i): x = itertools.cycle((lambda y: y.match(T.Punctuation, '.'), lambda y: y.ttype in (T.String.Symbol, T.Name, T.Wildcard))) for t in tl.tokens[i:]: if x.next()(t): yield t else: raise StopIteration # bottom up approach: group subgroups first [group_identifier(sgroup) for sgroup in tlist.get_sublists() if not isinstance(sgroup, Identifier)] # real processing idx = 0 token = tlist.token_next_by_type(idx, (T.String.Symbol, T.Name)) while token: identifier_tokens = [token]+list( _consume_cycle(tlist, tlist.token_index(token)+1)) group = tlist.group_tokens(Identifier, identifier_tokens) idx = tlist.token_index(group)+1 token = tlist.token_next_by_type(idx, (T.String.Symbol, T.Name)) def group_identifier_list(tlist): [group_identifier_list(sgroup) for sgroup in tlist.get_sublists() if not isinstance(sgroup, (Identifier, IdentifierList))] idx = 0 # Allowed list items fend1_funcs = [lambda t: isinstance(t, Identifier), lambda t: t.is_whitespace(), lambda t: t.ttype == T.Wildcard, lambda t: t.match(T.Keyword, 'null'), lambda t: t.ttype == T.Number.Integer, lambda t: t.ttype == T.String.Single, lambda t: isinstance(t, Comparsion), ] tcomma = tlist.token_next_match(idx, T.Punctuation, ',') start = None while tcomma is not None: before = tlist.token_prev(tcomma) after = tlist.token_next(tcomma) # Check if the tokens around tcomma belong to a list bpassed = apassed = False for func in fend1_funcs: if before is not None and func(before): bpassed = True if after is not None and func(after): apassed = True if not bpassed or not apassed: # Something's wrong here, skip ahead to next "," start = None tcomma = tlist.token_next_match(tlist.token_index(tcomma)+1, T.Punctuation, ',') else: if start is None: start = before next_ = tlist.token_next(after) if next_ is None or not next_.match(T.Punctuation, ','): # Reached the end of the list tokens = tlist.tokens_between(start, after) group = tlist.group_tokens(IdentifierList, tokens) start = None tcomma = tlist.token_next_match(tlist.token_index(group)+1, T.Punctuation, ',') else: tcomma = next_ def group_parenthesis(tlist): _group_matching(tlist, T.Punctuation, '(', T.Punctuation, ')', Parenthesis) def group_comments(tlist): [group_comments(sgroup) for sgroup in tlist.get_sublists() if not isinstance(sgroup, Comment)] idx = 0 token = tlist.token_next_by_type(idx, T.Comment) while token: tidx = tlist.token_index(token) end = tlist.token_not_matching(tidx+1, [lambda t: t.ttype in T.Comment, lambda t: t.is_whitespace()]) if end is None: idx = tidx + 1 else: eidx = tlist.token_index(end) grp_tokens = tlist.tokens_between(token, tlist.token_prev(eidx, False)) group = tlist.group_tokens(Comment, grp_tokens) idx = tlist.token_index(group) token = tlist.token_next_by_type(idx, T.Comment) def group_where(tlist): [group_where(sgroup) for sgroup in tlist.get_sublists() if not isinstance(sgroup, Where)] idx = 0 token = tlist.token_next_match(idx, T.Keyword, 'WHERE') stopwords = ('ORDER', 'GROUP', 'LIMIT', 'UNION') while token: tidx = tlist.token_index(token) end = tlist.token_next_match(tidx+1, T.Keyword, stopwords) if end is None: end = tlist.tokens[-1] else: end = tlist.tokens[tlist.token_index(end)-1] group = tlist.group_tokens(Where, tlist.tokens_between(token, end)) idx = tlist.token_index(group) token = tlist.token_next_match(idx, T.Keyword, 'WHERE') def group_aliased(tlist): [group_aliased(sgroup) for sgroup in tlist.get_sublists() if not isinstance(sgroup, Identifier)] idx = 0 token = tlist.token_next_by_instance(idx, Identifier) while token: next_ = tlist.token_next(tlist.token_index(token)) if next_ is not None and isinstance(next_, Identifier): grp = tlist.tokens_between(token, next_)[1:] token.tokens.extend(grp) for t in grp: tlist.tokens.remove(t) idx = tlist.token_index(token)+1 token = tlist.token_next_by_instance(idx, Identifier) def group_typecasts(tlist): _group_left_right(tlist, T.Punctuation, '::', Identifier) def group(tlist): for func in [group_parenthesis, group_comments, group_where, group_case, group_identifier, group_typecasts, group_as, group_aliased, group_assignment, group_comparsion, group_identifier_list, group_if, group_for,]: func(tlist) ================================================ FILE: debug_toolbar/utils/sqlparse/filters.py ================================================ # -*- coding: utf-8 -*- import re from debug_toolbar.utils.sqlparse.engine import grouping from debug_toolbar.utils.sqlparse import tokens as T from debug_toolbar.utils.sqlparse import sql class Filter(object): def process(self, *args): raise NotImplementedError class TokenFilter(Filter): def process(self, stack, stream): raise NotImplementedError # FIXME: Should be removed def rstrip(stream): buff = [] for token in stream: if token.is_whitespace() and '\n' in token.value: # assuming there's only one \n in value before, rest = token.value.split('\n', 1) token.value = '\n%s' % rest buff = [] yield token elif token.is_whitespace(): buff.append(token) elif token.is_group(): token.tokens = list(rstrip(token.tokens)) # process group and look if it starts with a nl if token.tokens and token.tokens[0].is_whitespace(): before, rest = token.tokens[0].value.split('\n', 1) token.tokens[0].value = '\n%s' % rest buff = [] while buff: yield buff.pop(0) yield token else: while buff: yield buff.pop(0) yield token # -------------------------- # token process class _CaseFilter(TokenFilter): ttype = None def __init__(self, case=None): if case is None: case = 'upper' assert case in ['lower', 'upper', 'capitalize'] self.convert = getattr(unicode, case) def process(self, stack, stream): for ttype, value in stream: if ttype in self.ttype: value = self.convert(value) yield ttype, value class KeywordCaseFilter(_CaseFilter): ttype = T.Keyword class IdentifierCaseFilter(_CaseFilter): ttype = (T.Name, T.String.Symbol) # ---------------------- # statement process class StripCommentsFilter(Filter): def _process(self, tlist): idx = 0 clss = set([x.__class__ for x in tlist.tokens]) while grouping.Comment in clss: token = tlist.token_next_by_instance(0, grouping.Comment) tidx = tlist.token_index(token) prev = tlist.token_prev(tidx, False) next_ = tlist.token_next(tidx, False) # Replace by whitespace if prev and next exist and if they're not # whitespaces. This doesn't apply if prev or next is a paranthesis. if (prev is not None and next_ is not None and not prev.is_whitespace() and not next_.is_whitespace() and not (prev.match(T.Punctuation, '(') or next_.match(T.Punctuation, ')'))): tlist.tokens[tidx] = grouping.Token(T.Whitespace, ' ') else: tlist.tokens.pop(tidx) clss = set([x.__class__ for x in tlist.tokens]) def process(self, stack, stmt): [self.process(stack, sgroup) for sgroup in stmt.get_sublists()] self._process(stmt) class StripWhitespaceFilter(Filter): def _stripws(self, tlist): func_name = '_stripws_%s' % tlist.__class__.__name__.lower() func = getattr(self, func_name, self._stripws_default) func(tlist) def _stripws_default(self, tlist): last_was_ws = False for token in tlist.tokens: if token.is_whitespace(): if last_was_ws: token.value = '' else: token.value = ' ' last_was_ws = token.is_whitespace() def _stripws_parenthesis(self, tlist): if tlist.tokens[1].is_whitespace(): tlist.tokens.pop(1) if tlist.tokens[-2].is_whitespace(): tlist.tokens.pop(-2) self._stripws_default(tlist) def process(self, stack, stmt): [self.process(stack, sgroup) for sgroup in stmt.get_sublists()] self._stripws(stmt) if stmt.tokens[-1].is_whitespace(): stmt.tokens.pop(-1) class ReindentFilter(Filter): def __init__(self, width=2, char=' ', line_width=None): self.width = width self.char = char self.indent = 0 self.offset = 0 self.line_width = line_width self._curr_stmt = None self._last_stmt = None def _get_offset(self, token): all_ = list(self._curr_stmt.flatten()) idx = all_.index(token) raw = ''.join(unicode(x) for x in all_[:idx+1]) line = raw.splitlines()[-1] # Now take current offset into account and return relative offset. full_offset = len(line)-(len(self.char*(self.width*self.indent))) return full_offset - self.offset def nl(self): # TODO: newline character should be configurable ws = '\n'+(self.char*((self.indent*self.width)+self.offset)) return grouping.Token(T.Whitespace, ws) def _split_kwds(self, tlist): split_words = ('FROM', 'JOIN$', 'AND', 'OR', 'GROUP', 'ORDER', 'UNION', 'VALUES', 'SET') idx = 0 token = tlist.token_next_match(idx, T.Keyword, split_words, regex=True) while token: prev = tlist.token_prev(tlist.token_index(token), False) offset = 1 if prev and prev.is_whitespace(): tlist.tokens.pop(tlist.token_index(prev)) offset += 1 if (prev and isinstance(prev, sql.Comment) and (str(prev).endswith('\n') or str(prev).endswith('\r'))): nl = tlist.token_next(token) else: nl = self.nl() tlist.insert_before(token, nl) token = tlist.token_next_match(tlist.token_index(nl)+offset, T.Keyword, split_words, regex=True) def _split_statements(self, tlist): idx = 0 token = tlist.token_next_by_type(idx, (T.Keyword.DDL, T.Keyword.DML)) while token: prev = tlist.token_prev(tlist.token_index(token), False) if prev and prev.is_whitespace(): tlist.tokens.pop(tlist.token_index(prev)) # only break if it's not the first token if prev: nl = self.nl() tlist.insert_before(token, nl) token = tlist.token_next_by_type(tlist.token_index(token)+1, (T.Keyword.DDL, T.Keyword.DML)) def _process(self, tlist): func_name = '_process_%s' % tlist.__class__.__name__.lower() func = getattr(self, func_name, self._process_default) func(tlist) def _process_where(self, tlist): token = tlist.token_next_match(0, T.Keyword, 'WHERE') tlist.insert_before(token, self.nl()) self.indent += 1 self._process_default(tlist) self.indent -= 1 def _process_parenthesis(self, tlist): first = tlist.token_next(0) indented = False if first and first.ttype in (T.Keyword.DML, T.Keyword.DDL): self.indent += 1 tlist.tokens.insert(0, self.nl()) indented = True num_offset = self._get_offset(tlist.token_next_match(0, T.Punctuation, '(')) self.offset += num_offset self._process_default(tlist, stmts=not indented) if indented: self.indent -= 1 self.offset -= num_offset def _process_identifierlist(self, tlist): identifiers = tlist.get_identifiers() if len(identifiers) > 1: first = list(identifiers[0].flatten())[0] num_offset = self._get_offset(first)-len(first.value) self.offset += num_offset for token in identifiers[1:]: tlist.insert_before(token, self.nl()) self.offset -= num_offset self._process_default(tlist) def _process_case(self, tlist): cases = tlist.get_cases() is_first = True num_offset = None case = tlist.tokens[0] outer_offset = self._get_offset(case)-len(case.value) self.offset += outer_offset for cond, value in tlist.get_cases(): if is_first: is_first = False num_offset = self._get_offset(cond[0])-len(cond[0].value) self.offset += num_offset continue if cond is None: token = value[0] else: token = cond[0] tlist.insert_before(token, self.nl()) # Line breaks on group level are done. Now let's add an offset of # 5 (=length of "when", "then", "else") and process subgroups. self.offset += 5 self._process_default(tlist) self.offset -= 5 if num_offset is not None: self.offset -= num_offset end = tlist.token_next_match(0, T.Keyword, 'END') tlist.insert_before(end, self.nl()) self.offset -= outer_offset def _process_default(self, tlist, stmts=True, kwds=True): if stmts: self._split_statements(tlist) if kwds: self._split_kwds(tlist) [self._process(sgroup) for sgroup in tlist.get_sublists()] def process(self, stack, stmt): if isinstance(stmt, grouping.Statement): self._curr_stmt = stmt self._process(stmt) if isinstance(stmt, grouping.Statement): if self._last_stmt is not None: if self._last_stmt.to_unicode().endswith('\n'): nl = '\n' else: nl = '\n\n' stmt.tokens.insert(0, grouping.Token(T.Whitespace, nl)) if self._last_stmt != stmt: self._last_stmt = stmt # FIXME: Doesn't work ;) class RightMarginFilter(Filter): keep_together = ( # grouping.TypeCast, grouping.Identifier, grouping.Alias, ) def __init__(self, width=79): self.width = width self.line = '' def _process(self, stack, group, stream): for token in stream: if token.is_whitespace() and '\n' in token.value: if token.value.endswith('\n'): self.line = '' else: self.line = token.value.splitlines()[-1] elif (token.is_group() and not token.__class__ in self.keep_together): token.tokens = self._process(stack, token, token.tokens) else: val = token.to_unicode() if len(self.line) + len(val) > self.width: match = re.search('^ +', self.line) if match is not None: indent = match.group() else: indent = '' yield grouping.Token(T.Whitespace, '\n%s' % indent) self.line = indent self.line += val yield token def process(self, stack, group): return group.tokens = self._process(stack, group, group.tokens) # --------------------------- # postprocess class SerializerUnicode(Filter): def process(self, stack, stmt): raw = stmt.to_unicode() add_nl = raw.endswith('\n') res = '\n'.join(line.rstrip() for line in raw.splitlines()) if add_nl: res += '\n' return res class OutputPythonFilter(Filter): def __init__(self, varname='sql'): self.varname = varname self.cnt = 0 def _process(self, stream, varname, count, has_nl): if count > 1: yield grouping.Token(T.Whitespace, '\n') yield grouping.Token(T.Name, varname) yield grouping.Token(T.Whitespace, ' ') yield grouping.Token(T.Operator, '=') yield grouping.Token(T.Whitespace, ' ') if has_nl: yield grouping.Token(T.Operator, '(') yield grouping.Token(T.Text, "'") cnt = 0 for token in stream: cnt += 1 if token.is_whitespace() and '\n' in token.value: if cnt == 1: continue after_lb = token.value.split('\n', 1)[1] yield grouping.Token(T.Text, " '") yield grouping.Token(T.Whitespace, '\n') for i in range(len(varname)+4): yield grouping.Token(T.Whitespace, ' ') yield grouping.Token(T.Text, "'") if after_lb: # it's the indendation yield grouping.Token(T.Whitespace, after_lb) continue elif token.value and "'" in token.value: token.value = token.value.replace("'", "\\'") yield grouping.Token(T.Text, token.value or '') yield grouping.Token(T.Text, "'") if has_nl: yield grouping.Token(T.Operator, ')') def process(self, stack, stmt): self.cnt += 1 if self.cnt > 1: varname = '%s%d' % (self.varname, self.cnt) else: varname = self.varname has_nl = len(stmt.to_unicode().strip().splitlines()) > 1 stmt.tokens = self._process(stmt.tokens, varname, self.cnt, has_nl) return stmt class OutputPHPFilter(Filter): def __init__(self, varname='sql'): self.varname = '$%s' % varname self.count = 0 def _process(self, stream, varname): if self.count > 1: yield grouping.Token(T.Whitespace, '\n') yield grouping.Token(T.Name, varname) yield grouping.Token(T.Whitespace, ' ') yield grouping.Token(T.Operator, '=') yield grouping.Token(T.Whitespace, ' ') yield grouping.Token(T.Text, '"') cnt = 0 for token in stream: if token.is_whitespace() and '\n' in token.value: # cnt += 1 # if cnt == 1: # continue after_lb = token.value.split('\n', 1)[1] yield grouping.Token(T.Text, ' "') yield grouping.Token(T.Operator, ';') yield grouping.Token(T.Whitespace, '\n') yield grouping.Token(T.Name, varname) yield grouping.Token(T.Whitespace, ' ') yield grouping.Token(T.Punctuation, '.') yield grouping.Token(T.Operator, '=') yield grouping.Token(T.Whitespace, ' ') yield grouping.Token(T.Text, '"') if after_lb: yield grouping.Token(T.Text, after_lb) continue elif '"' in token.value: token.value = token.value.replace('"', '\\"') yield grouping.Token(T.Text, token.value) yield grouping.Token(T.Text, '"') yield grouping.Token(T.Punctuation, ';') def process(self, stack, stmt): self.count += 1 if self.count > 1: varname = '%s%d' % (self.varname, self.count) else: varname = self.varname stmt.tokens = tuple(self._process(stmt.tokens, varname)) return stmt ================================================ FILE: debug_toolbar/utils/sqlparse/formatter.py ================================================ # Copyright (C) 2008 Andi Albrecht, albrecht.andi@gmail.com # # This module is part of python-sqlparse and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php. """SQL formatter""" from debug_toolbar.utils.sqlparse import SQLParseError from debug_toolbar.utils.sqlparse import filters def validate_options(options): """Validates options.""" kwcase = options.get('keyword_case', None) if kwcase not in [None, 'upper', 'lower', 'capitalize']: raise SQLParseError('Invalid value for keyword_case: %r' % kwcase) idcase = options.get('identifier_case', None) if idcase not in [None, 'upper', 'lower', 'capitalize']: raise SQLParseError('Invalid value for identifier_case: %r' % idcase) ofrmt = options.get('output_format', None) if ofrmt not in [None, 'sql', 'python', 'php']: raise SQLParseError('Unknown output format: %r' % ofrmt) strip_comments = options.get('strip_comments', False) if strip_comments not in [True, False]: raise SQLParseError('Invalid value for strip_comments: %r' % strip_comments) strip_ws = options.get('strip_whitespace', False) if strip_ws not in [True, False]: raise SQLParseError('Invalid value for strip_whitespace: %r' % strip_ws) reindent = options.get('reindent', False) if reindent not in [True, False]: raise SQLParseError('Invalid value for reindent: %r' % reindent) elif reindent: options['strip_whitespace'] = True indent_tabs = options.get('indent_tabs', False) if indent_tabs not in [True, False]: raise SQLParseError('Invalid value for indent_tabs: %r' % indent_tabs) elif indent_tabs: options['indent_char'] = '\t' else: options['indent_char'] = ' ' indent_width = options.get('indent_width', 2) try: indent_width = int(indent_width) except (TypeError, ValueError): raise SQLParseError('indent_width requires an integer') if indent_width < 1: raise SQLParseError('indent_width requires an positive integer') options['indent_width'] = indent_width right_margin = options.get('right_margin', None) if right_margin is not None: try: right_margin = int(right_margin) except (TypeError, ValueError): raise SQLParseError('right_margin requires an integer') if right_margin < 10: raise SQLParseError('right_margin requires an integer > 10') options['right_margin'] = right_margin return options def build_filter_stack(stack, options): """Setup and return a filter stack. Args: stack: :class:`~sqlparse.filters.FilterStack` instance options: Dictionary with options validated by validate_options. """ # Token filter if 'keyword_case' in options: stack.preprocess.append( filters.KeywordCaseFilter(options['keyword_case'])) if 'identifier_case' in options: stack.preprocess.append( filters.IdentifierCaseFilter(options['identifier_case'])) # After grouping if options.get('strip_comments', False): stack.enable_grouping() stack.stmtprocess.append(filters.StripCommentsFilter()) if (options.get('strip_whitespace', False) or options.get('reindent', False)): stack.enable_grouping() stack.stmtprocess.append(filters.StripWhitespaceFilter()) if options.get('reindent', False): stack.enable_grouping() stack.stmtprocess.append( filters.ReindentFilter(char=options['indent_char'], width=options['indent_width'])) if options.get('right_margin', False): stack.enable_grouping() stack.stmtprocess.append( filters.RightMarginFilter(width=options['right_margin'])) # Serializer if options.get('output_format'): frmt = options['output_format'] if frmt.lower() == 'php': fltr = filters.OutputPHPFilter() elif frmt.lower() == 'python': fltr = filters.OutputPythonFilter() else: fltr = None if fltr is not None: stack.postprocess.append(fltr) return stack ================================================ FILE: debug_toolbar/utils/sqlparse/keywords.py ================================================ from debug_toolbar.utils.sqlparse.tokens import * KEYWORDS = { 'ABORT': Keyword, 'ABS': Keyword, 'ABSOLUTE': Keyword, 'ACCESS': Keyword, 'ADA': Keyword, 'ADD': Keyword, 'ADMIN': Keyword, 'AFTER': Keyword, 'AGGREGATE': Keyword, 'ALIAS': Keyword, 'ALL': Keyword, 'ALLOCATE': Keyword, 'ANALYSE': Keyword, 'ANALYZE': Keyword, 'AND': Keyword, 'ANY': Keyword, 'ARE': Keyword, 'AS': Keyword, 'ASC': Keyword, 'ASENSITIVE': Keyword, 'ASSERTION': Keyword, 'ASSIGNMENT': Keyword, 'ASYMMETRIC': Keyword, 'AT': Keyword, 'ATOMIC': Keyword, 'AUTHORIZATION': Keyword, 'AVG': Keyword, 'BACKWARD': Keyword, 'BEFORE': Keyword, 'BEGIN': Keyword, 'BETWEEN': Keyword, 'BITVAR': Keyword, 'BIT_LENGTH': Keyword, 'BOTH': Keyword, 'BREADTH': Keyword, 'BY': Keyword, # 'C': Keyword, # most likely this is an alias 'CACHE': Keyword, 'CALL': Keyword, 'CALLED': Keyword, 'CARDINALITY': Keyword, 'CASCADE': Keyword, 'CASCADED': Keyword, 'CASE': Keyword, 'CAST': Keyword, 'CATALOG': Keyword, 'CATALOG_NAME': Keyword, 'CHAIN': Keyword, 'CHARACTERISTICS': Keyword, 'CHARACTER_LENGTH': Keyword, 'CHARACTER_SET_CATALOG': Keyword, 'CHARACTER_SET_NAME': Keyword, 'CHARACTER_SET_SCHEMA': Keyword, 'CHAR_LENGTH': Keyword, 'CHECK': Keyword, 'CHECKED': Keyword, 'CHECKPOINT': Keyword, 'CLASS': Keyword, 'CLASS_ORIGIN': Keyword, 'CLOB': Keyword, 'CLOSE': Keyword, 'CLUSTER': Keyword, 'COALSECE': Keyword, 'COBOL': Keyword, 'COLLATE': Keyword, 'COLLATION': Keyword, 'COLLATION_CATALOG': Keyword, 'COLLATION_NAME': Keyword, 'COLLATION_SCHEMA': Keyword, 'COLUMN': Keyword, 'COLUMN_NAME': Keyword, 'COMMAND_FUNCTION': Keyword, 'COMMAND_FUNCTION_CODE': Keyword, 'COMMENT': Keyword, 'COMMIT': Keyword, 'COMMITTED': Keyword, 'COMPLETION': Keyword, 'CONDITION_NUMBER': Keyword, 'CONNECT': Keyword, 'CONNECTION': Keyword, 'CONNECTION_NAME': Keyword, 'CONSTRAINT': Keyword, 'CONSTRAINTS': Keyword, 'CONSTRAINT_CATALOG': Keyword, 'CONSTRAINT_NAME': Keyword, 'CONSTRAINT_SCHEMA': Keyword, 'CONSTRUCTOR': Keyword, 'CONTAINS': Keyword, 'CONTINUE': Keyword, 'CONVERSION': Keyword, 'CONVERT': Keyword, 'COPY': Keyword, 'CORRESPONTING': Keyword, 'COUNT': Keyword, 'CREATEDB': Keyword, 'CREATEUSER': Keyword, 'CROSS': Keyword, 'CUBE': Keyword, 'CURRENT': Keyword, 'CURRENT_DATE': Keyword, 'CURRENT_PATH': Keyword, 'CURRENT_ROLE': Keyword, 'CURRENT_TIME': Keyword, 'CURRENT_TIMESTAMP': Keyword, 'CURRENT_USER': Keyword, 'CURSOR': Keyword, 'CURSOR_NAME': Keyword, 'CYCLE': Keyword, 'DATA': Keyword, 'DATABASE': Keyword, 'DATETIME_INTERVAL_CODE': Keyword, 'DATETIME_INTERVAL_PRECISION': Keyword, 'DAY': Keyword, 'DEALLOCATE': Keyword, 'DECLARE': Keyword, 'DEFAULT': Keyword, 'DEFAULTS': Keyword, 'DEFERRABLE': Keyword, 'DEFERRED': Keyword, 'DEFINED': Keyword, 'DEFINER': Keyword, 'DELIMITER': Keyword, 'DELIMITERS': Keyword, 'DEREF': Keyword, 'DESC': Keyword, 'DESCRIBE': Keyword, 'DESCRIPTOR': Keyword, 'DESTROY': Keyword, 'DESTRUCTOR': Keyword, 'DETERMINISTIC': Keyword, 'DIAGNOSTICS': Keyword, 'DICTIONARY': Keyword, 'DISCONNECT': Keyword, 'DISPATCH': Keyword, 'DISTINCT': Keyword, 'DO': Keyword, 'DOMAIN': Keyword, 'DYNAMIC': Keyword, 'DYNAMIC_FUNCTION': Keyword, 'DYNAMIC_FUNCTION_CODE': Keyword, 'EACH': Keyword, 'ELSE': Keyword, 'ENCODING': Keyword, 'ENCRYPTED': Keyword, 'END': Keyword, 'END-EXEC': Keyword, 'EQUALS': Keyword, 'ESCAPE': Keyword, 'EVERY': Keyword, 'EXCEPT': Keyword, 'ESCEPTION': Keyword, 'EXCLUDING': Keyword, 'EXCLUSIVE': Keyword, 'EXEC': Keyword, 'EXECUTE': Keyword, 'EXISTING': Keyword, 'EXISTS': Keyword, 'EXTERNAL': Keyword, 'EXTRACT': Keyword, 'FALSE': Keyword, 'FETCH': Keyword, 'FINAL': Keyword, 'FIRST': Keyword, 'FOR': Keyword, 'FORCE': Keyword, 'FOREIGN': Keyword, 'FORTRAN': Keyword, 'FORWARD': Keyword, 'FOUND': Keyword, 'FREE': Keyword, 'FREEZE': Keyword, 'FROM': Keyword, 'FULL': Keyword, 'FUNCTION': Keyword, 'G': Keyword, 'GENERAL': Keyword, 'GENERATED': Keyword, 'GET': Keyword, 'GLOBAL': Keyword, 'GO': Keyword, 'GOTO': Keyword, 'GRANT': Keyword, 'GRANTED': Keyword, 'GROUP': Keyword, 'GROUPING': Keyword, 'HANDLER': Keyword, 'HAVING': Keyword, 'HIERARCHY': Keyword, 'HOLD': Keyword, 'HOST': Keyword, 'IDENTITY': Keyword, 'IF': Keyword, 'IGNORE': Keyword, 'ILIKE': Keyword, 'IMMEDIATE': Keyword, 'IMMUTABLE': Keyword, 'IMPLEMENTATION': Keyword, 'IMPLICIT': Keyword, 'IN': Keyword, 'INCLUDING': Keyword, 'INCREMENT': Keyword, 'INDEX': Keyword, 'INDITCATOR': Keyword, 'INFIX': Keyword, 'INHERITS': Keyword, 'INITIALIZE': Keyword, 'INITIALLY': Keyword, 'INNER': Keyword, 'INOUT': Keyword, 'INPUT': Keyword, 'INSENSITIVE': Keyword, 'INSTANTIABLE': Keyword, 'INSTEAD': Keyword, 'INTERSECT': Keyword, 'INTO': Keyword, 'INVOKER': Keyword, 'IS': Keyword, 'ISNULL': Keyword, 'ISOLATION': Keyword, 'ITERATE': Keyword, 'JOIN': Keyword, 'K': Keyword, 'KEY': Keyword, 'KEY_MEMBER': Keyword, 'KEY_TYPE': Keyword, 'LANCOMPILER': Keyword, 'LANGUAGE': Keyword, 'LARGE': Keyword, 'LAST': Keyword, 'LATERAL': Keyword, 'LEADING': Keyword, 'LEFT': Keyword, 'LENGTH': Keyword, 'LESS': Keyword, 'LEVEL': Keyword, 'LIKE': Keyword, 'LIMIT': Keyword, 'LISTEN': Keyword, 'LOAD': Keyword, 'LOCAL': Keyword, 'LOCALTIME': Keyword, 'LOCALTIMESTAMP': Keyword, 'LOCATION': Keyword, 'LOCATOR': Keyword, 'LOCK': Keyword, 'LOWER': Keyword, 'M': Keyword, 'MAP': Keyword, 'MATCH': Keyword, 'MAX': Keyword, 'MAXVALUE': Keyword, 'MESSAGE_LENGTH': Keyword, 'MESSAGE_OCTET_LENGTH': Keyword, 'MESSAGE_TEXT': Keyword, 'METHOD': Keyword, 'MIN': Keyword, 'MINUTE': Keyword, 'MINVALUE': Keyword, 'MOD': Keyword, 'MODE': Keyword, 'MODIFIES': Keyword, 'MODIFY': Keyword, 'MONTH': Keyword, 'MORE': Keyword, 'MOVE': Keyword, 'MUMPS': Keyword, 'NAMES': Keyword, 'NATIONAL': Keyword, 'NATURAL': Keyword, 'NCHAR': Keyword, 'NCLOB': Keyword, 'NEW': Keyword, 'NEXT': Keyword, 'NO': Keyword, 'NOCREATEDB': Keyword, 'NOCREATEUSER': Keyword, 'NONE': Keyword, 'NOT': Keyword, 'NOTHING': Keyword, 'NOTIFY': Keyword, 'NOTNULL': Keyword, 'NULL': Keyword, 'NULLABLE': Keyword, 'NULLIF': Keyword, 'OBJECT': Keyword, 'OCTET_LENGTH': Keyword, 'OF': Keyword, 'OFF': Keyword, 'OFFSET': Keyword, 'OIDS': Keyword, 'OLD': Keyword, 'ON': Keyword, 'ONLY': Keyword, 'OPEN': Keyword, 'OPERATION': Keyword, 'OPERATOR': Keyword, 'OPTION': Keyword, 'OPTIONS': Keyword, 'OR': Keyword, 'ORDER': Keyword, 'ORDINALITY': Keyword, 'OUT': Keyword, 'OUTER': Keyword, 'OUTPUT': Keyword, 'OVERLAPS': Keyword, 'OVERLAY': Keyword, 'OVERRIDING': Keyword, 'OWNER': Keyword, 'PAD': Keyword, 'PARAMETER': Keyword, 'PARAMETERS': Keyword, 'PARAMETER_MODE': Keyword, 'PARAMATER_NAME': Keyword, 'PARAMATER_ORDINAL_POSITION': Keyword, 'PARAMETER_SPECIFIC_CATALOG': Keyword, 'PARAMETER_SPECIFIC_NAME': Keyword, 'PARAMATER_SPECIFIC_SCHEMA': Keyword, 'PARTIAL': Keyword, 'PASCAL': Keyword, 'PENDANT': Keyword, 'PLACING': Keyword, 'PLI': Keyword, 'POSITION': Keyword, 'POSTFIX': Keyword, 'PRECISION': Keyword, 'PREFIX': Keyword, 'PREORDER': Keyword, 'PREPARE': Keyword, 'PRESERVE': Keyword, 'PRIMARY': Keyword, 'PRIOR': Keyword, 'PRIVILEGES': Keyword, 'PROCEDURAL': Keyword, 'PROCEDURE': Keyword, 'PUBLIC': Keyword, 'RAISE': Keyword, 'READ': Keyword, 'READS': Keyword, 'RECHECK': Keyword, 'RECURSIVE': Keyword, 'REF': Keyword, 'REFERENCES': Keyword, 'REFERENCING': Keyword, 'REINDEX': Keyword, 'RELATIVE': Keyword, 'RENAME': Keyword, 'REPEATABLE': Keyword, 'REPLACE': Keyword, 'RESET': Keyword, 'RESTART': Keyword, 'RESTRICT': Keyword, 'RESULT': Keyword, 'RETURN': Keyword, 'RETURNED_LENGTH': Keyword, 'RETURNED_OCTET_LENGTH': Keyword, 'RETURNED_SQLSTATE': Keyword, 'RETURNS': Keyword, 'REVOKE': Keyword, 'RIGHT': Keyword, 'ROLE': Keyword, 'ROLLBACK': Keyword, 'ROLLUP': Keyword, 'ROUTINE': Keyword, 'ROUTINE_CATALOG': Keyword, 'ROUTINE_NAME': Keyword, 'ROUTINE_SCHEMA': Keyword, 'ROW': Keyword, 'ROWS': Keyword, 'ROW_COUNT': Keyword, 'RULE': Keyword, 'SAVE_POINT': Keyword, 'SCALE': Keyword, 'SCHEMA': Keyword, 'SCHEMA_NAME': Keyword, 'SCOPE': Keyword, 'SCROLL': Keyword, 'SEARCH': Keyword, 'SECOND': Keyword, 'SECURITY': Keyword, 'SELF': Keyword, 'SENSITIVE': Keyword, 'SERIALIZABLE': Keyword, 'SERVER_NAME': Keyword, 'SESSION': Keyword, 'SESSION_USER': Keyword, 'SETOF': Keyword, 'SETS': Keyword, 'SHARE': Keyword, 'SHOW': Keyword, 'SIMILAR': Keyword, 'SIMPLE': Keyword, 'SIZE': Keyword, 'SOME': Keyword, 'SOURCE': Keyword, 'SPACE': Keyword, 'SPECIFIC': Keyword, 'SPECIFICTYPE': Keyword, 'SPECIFIC_NAME': Keyword, 'SQL': Keyword, 'SQLCODE': Keyword, 'SQLERROR': Keyword, 'SQLEXCEPTION': Keyword, 'SQLSTATE': Keyword, 'SQLWARNINIG': Keyword, 'STABLE': Keyword, 'START': Keyword, 'STATE': Keyword, 'STATEMENT': Keyword, 'STATIC': Keyword, 'STATISTICS': Keyword, 'STDIN': Keyword, 'STDOUT': Keyword, 'STORAGE': Keyword, 'STRICT': Keyword, 'STRUCTURE': Keyword, 'STYPE': Keyword, 'SUBCLASS_ORIGIN': Keyword, 'SUBLIST': Keyword, 'SUBSTRING': Keyword, 'SUM': Keyword, 'SYMMETRIC': Keyword, 'SYSID': Keyword, 'SYSTEM': Keyword, 'SYSTEM_USER': Keyword, 'TABLE': Keyword, 'TABLE_NAME': Keyword, ' TEMP': Keyword, 'TEMPLATE': Keyword, 'TEMPORARY': Keyword, 'TERMINATE': Keyword, 'THAN': Keyword, 'THEN': Keyword, 'TIMESTAMP': Keyword, 'TIMEZONE_HOUR': Keyword, 'TIMEZONE_MINUTE': Keyword, 'TO': Keyword, 'TOAST': Keyword, 'TRAILING': Keyword, 'TRANSATION': Keyword, 'TRANSACTIONS_COMMITTED': Keyword, 'TRANSACTIONS_ROLLED_BACK': Keyword, 'TRANSATION_ACTIVE': Keyword, 'TRANSFORM': Keyword, 'TRANSFORMS': Keyword, 'TRANSLATE': Keyword, 'TRANSLATION': Keyword, 'TREAT': Keyword, 'TRIGGER': Keyword, 'TRIGGER_CATALOG': Keyword, 'TRIGGER_NAME': Keyword, 'TRIGGER_SCHEMA': Keyword, 'TRIM': Keyword, 'TRUE': Keyword, 'TRUNCATE': Keyword, 'TRUSTED': Keyword, 'TYPE': Keyword, 'UNCOMMITTED': Keyword, 'UNDER': Keyword, 'UNENCRYPTED': Keyword, 'UNION': Keyword, 'UNIQUE': Keyword, 'UNKNOWN': Keyword, 'UNLISTEN': Keyword, 'UNNAMED': Keyword, 'UNNEST': Keyword, 'UNTIL': Keyword, 'UPPER': Keyword, 'USAGE': Keyword, 'USER': Keyword, 'USER_DEFINED_TYPE_CATALOG': Keyword, 'USER_DEFINED_TYPE_NAME': Keyword, 'USER_DEFINED_TYPE_SCHEMA': Keyword, 'USING': Keyword, 'VACUUM': Keyword, 'VALID': Keyword, 'VALIDATOR': Keyword, 'VALUES': Keyword, 'VARIABLE': Keyword, 'VERBOSE': Keyword, 'VERSION': Keyword, 'VIEW': Keyword, 'VOLATILE': Keyword, 'WHEN': Keyword, 'WHENEVER': Keyword, 'WHERE': Keyword, 'WITH': Keyword, 'WITHOUT': Keyword, 'WORK': Keyword, 'WRITE': Keyword, 'YEAR': Keyword, 'ZONE': Keyword, 'ARRAY': Name.Builtin, 'BIGINT': Name.Builtin, 'BINARY': Name.Builtin, 'BIT': Name.Builtin, 'BLOB': Name.Builtin, 'BOOLEAN': Name.Builtin, 'CHAR': Name.Builtin, 'CHARACTER': Name.Builtin, 'DATE': Name.Builtin, 'DEC': Name.Builtin, 'DECIMAL': Name.Builtin, 'FLOAT': Name.Builtin, 'INT': Name.Builtin, 'INTEGER': Name.Builtin, 'INTERVAL': Name.Builtin, 'NUMBER': Name.Builtin, 'NUMERIC': Name.Builtin, 'REAL': Name.Builtin, 'SERIAL': Name.Builtin, 'SMALLINT': Name.Builtin, 'VARCHAR': Name.Builtin, 'VARYING': Name.Builtin, 'INT8': Name.Builtin, 'SERIAL8': Name.Builtin, 'TEXT': Name.Builtin, } KEYWORDS_COMMON = { 'SELECT': Keyword.DML, 'INSERT': Keyword.DML, 'DELETE': Keyword.DML, 'UPDATE': Keyword.DML, 'DROP': Keyword.DDL, 'CREATE': Keyword.DDL, 'ALTER': Keyword.DDL, 'WHERE': Keyword, 'FROM': Keyword, 'INNER': Keyword, 'JOIN': Keyword, 'AND': Keyword, 'OR': Keyword, 'LIKE': Keyword, 'ON': Keyword, 'IN': Keyword, 'SET': Keyword, 'BY': Keyword, 'GROUP': Keyword, 'ORDER': Keyword, 'LEFT': Keyword, 'OUTER': Keyword, 'IF': Keyword, 'END': Keyword, 'THEN': Keyword, 'LOOP': Keyword, 'AS': Keyword, 'ELSE': Keyword, 'FOR': Keyword, 'CASE': Keyword, 'WHEN': Keyword, 'MIN': Keyword, 'MAX': Keyword, 'DISTINCT': Keyword, } ================================================ FILE: debug_toolbar/utils/sqlparse/lexer.py ================================================ # -*- coding: utf-8 -*- # Copyright (C) 2008 Andi Albrecht, albrecht.andi@gmail.com # # This module is part of python-sqlparse and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php. """SQL Lexer""" # This code is based on the SqlLexer in pygments. # http://pygments.org/ # It's separated from the rest of pygments to increase performance # and to allow some customizations. import re from debug_toolbar.utils.sqlparse.keywords import KEYWORDS, KEYWORDS_COMMON from debug_toolbar.utils.sqlparse.tokens import * from debug_toolbar.utils.sqlparse.tokens import _TokenType class include(str): pass class combined(tuple): """Indicates a state combined from multiple states.""" def __new__(cls, *args): return tuple.__new__(cls, args) def __init__(self, *args): # tuple.__init__ doesn't do anything pass def is_keyword(value): test = value.upper() return KEYWORDS_COMMON.get(test, KEYWORDS.get(test, Name)), value def apply_filters(stream, filters, lexer=None): """ Use this method to apply an iterable of filters to a stream. If lexer is given it's forwarded to the filter, otherwise the filter receives `None`. """ def _apply(filter_, stream): for token in filter_.filter(lexer, stream): yield token for filter_ in filters: stream = _apply(filter_, stream) return stream class LexerMeta(type): """ Metaclass for Lexer, creates the self._tokens attribute from self.tokens on the first instantiation. """ def _process_state(cls, unprocessed, processed, state): assert type(state) is str, "wrong state name %r" % state assert state[0] != '#', "invalid state name %r" % state if state in processed: return processed[state] tokens = processed[state] = [] rflags = cls.flags for tdef in unprocessed[state]: if isinstance(tdef, include): # it's a state reference assert tdef != state, "circular state reference %r" % state tokens.extend(cls._process_state(unprocessed, processed, str(tdef))) continue assert type(tdef) is tuple, "wrong rule def %r" % tdef try: rex = re.compile(tdef[0], rflags).match except Exception, err: raise ValueError("uncompilable regex %r in state %r of %r: %s" % (tdef[0], state, cls, err)) assert type(tdef[1]) is _TokenType or callable(tdef[1]), \ 'token type must be simple type or callable, not %r' % (tdef[1],) if len(tdef) == 2: new_state = None else: tdef2 = tdef[2] if isinstance(tdef2, str): # an existing state if tdef2 == '#pop': new_state = -1 elif tdef2 in unprocessed: new_state = (tdef2,) elif tdef2 == '#push': new_state = tdef2 elif tdef2[:5] == '#pop:': new_state = -int(tdef2[5:]) else: assert False, 'unknown new state %r' % tdef2 elif isinstance(tdef2, combined): # combine a new state from existing ones new_state = '_tmp_%d' % cls._tmpname cls._tmpname += 1 itokens = [] for istate in tdef2: assert istate != state, 'circular state ref %r' % istate itokens.extend(cls._process_state(unprocessed, processed, istate)) processed[new_state] = itokens new_state = (new_state,) elif isinstance(tdef2, tuple): # push more than one state for state in tdef2: assert (state in unprocessed or state in ('#pop', '#push')), \ 'unknown new state ' + state new_state = tdef2 else: assert False, 'unknown new state def %r' % tdef2 tokens.append((rex, tdef[1], new_state)) return tokens def process_tokendef(cls): cls._all_tokens = {} cls._tmpname = 0 processed = cls._all_tokens[cls.__name__] = {} #tokendefs = tokendefs or cls.tokens[name] for state in cls.tokens.keys(): cls._process_state(cls.tokens, processed, state) return processed def __call__(cls, *args, **kwds): if not hasattr(cls, '_tokens'): cls._all_tokens = {} cls._tmpname = 0 if hasattr(cls, 'token_variants') and cls.token_variants: # don't process yet pass else: cls._tokens = cls.process_tokendef() return type.__call__(cls, *args, **kwds) class Lexer: __metaclass__ = LexerMeta encoding = 'utf-8' stripall = False stripnl = False tabsize = 0 flags = re.IGNORECASE tokens = { 'root': [ (r'--.*?(\r|\n|\r\n)', Comment.Single), (r'(\r|\n|\r\n)', Newline), (r'\s+', Whitespace), (r'/\*', Comment.Multiline, 'multiline-comments'), (r':=', Assignment), (r'::', Punctuation), (r'[*]', Wildcard), (r"`(``|[^`])*`", Name), (r"´(´´|[^´])*´", Name), (r'@[a-zA-Z_][a-zA-Z0-9_]+', Name), (r'[+/<>=~!@#%^&|`?^-]', Operator), (r'[0-9]+', Number.Integer), # TODO: Backslash escapes? (r"'(''|[^'])*'", String.Single), (r'"(""|[^"])*"', String.Symbol), # not a real string literal in ANSI SQL (r'(LEFT |RIGHT )?(INNER |OUTER )?JOIN', Keyword), (r'END( IF| LOOP)?', Keyword), (r'CREATE( OR REPLACE)?', Keyword.DDL), (r'[a-zA-Z_][a-zA-Z0-9_]*', is_keyword), (r'\$([a-zA-Z_][a-zA-Z0-9_]*)?\$', Name.Builtin), (r'[;:()\[\],\.]', Punctuation), ], 'multiline-comments': [ (r'/\*', Comment.Multiline, 'multiline-comments'), (r'\*/', Comment.Multiline, '#pop'), (r'[^/\*]+', Comment.Multiline), (r'[/*]', Comment.Multiline) ] } def __init__(self): self.filters = [] def add_filter(self, filter_, **options): from sqlparse.filters import Filter if not isinstance(filter_, Filter): filter_ = filter_(**options) self.filters.append(filter_) def get_tokens(self, text, unfiltered=False): """ Return an iterable of (tokentype, value) pairs generated from `text`. If `unfiltered` is set to `True`, the filtering mechanism is bypassed even if filters are defined. Also preprocess the text, i.e. expand tabs and strip it if wanted and applies registered filters. """ if not isinstance(text, unicode): if self.encoding == 'guess': try: text = text.decode('utf-8') if text.startswith(u'\ufeff'): text = text[len(u'\ufeff'):] except UnicodeDecodeError: text = text.decode('latin1') elif self.encoding == 'chardet': try: import chardet except ImportError: raise ImportError('To enable chardet encoding guessing, ' 'please install the chardet library ' 'from http://chardet.feedparser.org/') enc = chardet.detect(text) text = text.decode(enc['encoding']) else: text = text.decode(self.encoding) if self.stripall: text = text.strip() elif self.stripnl: text = text.strip('\n') if self.tabsize > 0: text = text.expandtabs(self.tabsize) # if not text.endswith('\n'): # text += '\n' def streamer(): for i, t, v in self.get_tokens_unprocessed(text): yield t, v stream = streamer() if not unfiltered: stream = apply_filters(stream, self.filters, self) return stream def get_tokens_unprocessed(self, text, stack=('root',)): """ Split ``text`` into (tokentype, text) pairs. ``stack`` is the inital stack (default: ``['root']``) """ pos = 0 tokendefs = self._tokens statestack = list(stack) statetokens = tokendefs[statestack[-1]] known_names = {} while 1: for rexmatch, action, new_state in statetokens: m = rexmatch(text, pos) if m: # print rex.pattern value = m.group() if value in known_names: yield pos, known_names[value], value elif type(action) is _TokenType: yield pos, action, value elif hasattr(action, '__call__'): ttype, value = action(value) known_names[value] = ttype yield pos, ttype, value else: for item in action(self, m): yield item pos = m.end() if new_state is not None: # state transition if isinstance(new_state, tuple): for state in new_state: if state == '#pop': statestack.pop() elif state == '#push': statestack.append(statestack[-1]) else: statestack.append(state) elif isinstance(new_state, int): # pop del statestack[new_state:] elif new_state == '#push': statestack.append(statestack[-1]) else: assert False, "wrong state def: %r" % new_state statetokens = tokendefs[statestack[-1]] break else: try: if text[pos] == '\n': # at EOL, reset state to "root" pos += 1 statestack = ['root'] statetokens = tokendefs['root'] yield pos, Text, u'\n' continue yield pos, Error, text[pos] pos += 1 except IndexError: break def tokenize(sql): """Tokenize sql. Tokenize *sql* using the :class:`Lexer` and return a 2-tuple stream of ``(token type, value)`` items. """ lexer = Lexer() return lexer.get_tokens(sql) ================================================ FILE: debug_toolbar/utils/sqlparse/sql.py ================================================ # -*- coding: utf-8 -*- """This module contains classes representing syntactical elements of SQL.""" import re import types from debug_toolbar.utils.sqlparse import tokens as T class Token(object): """Base class for all other classes in this module. It represents a single token and has two instance attributes: ``value`` is the unchange value of the token and ``ttype`` is the type of the token. """ __slots__ = ('value', 'ttype',) def __init__(self, ttype, value): self.value = value self.ttype = ttype def __str__(self): return unicode(self).encode('latin-1') def __repr__(self): short = self._get_repr_value() return '<%s \'%s\' at 0x%07x>' % (self._get_repr_name(), short, id(self)) def __unicode__(self): return self.value or '' def to_unicode(self): """Returns a unicode representation of this object.""" return unicode(self) def _get_repr_name(self): return str(self.ttype).split('.')[-1] def _get_repr_value(self): raw = unicode(self) if len(raw) > 7: short = raw[:6]+u'...' else: short = raw return re.sub('\s+', ' ', short) def flatten(self): """Resolve subgroups.""" yield self def match(self, ttype, values, regex=False): """Checks whether the token matches the given arguments. *ttype* is a token type. If this token doesn't match the given token type. *values* is a list of possible values for this token. The values are OR'ed together so if only one of the values matches ``True`` is returned. Except for keyword tokens the comparsion is case-sensitive. For convenience it's ok to pass in a single string. If *regex* is ``True`` (default is ``False``) the given values are treated as regular expressions. """ type_matched = self.ttype in ttype if not type_matched or values is None: return type_matched if isinstance(values, basestring): values = set([values]) if regex: if self.ttype is T.Keyword: values = set([re.compile(v, re.IGNORECASE) for v in values]) else: values = set([re.compile(v) for v in values]) for pattern in values: if pattern.search(self.value): return True return False else: if self.ttype is T.Keyword: values = set([v.upper() for v in values]) return self.value.upper() in values else: return self.value in values def is_group(self): """Returns ``True`` if this object has children.""" return False def is_whitespace(self): """Return ``True`` if this token is a whitespace token.""" return self.ttype and self.ttype in T.Whitespace class TokenList(Token): """A group of tokens. It has an additional instance attribute ``tokens`` which holds a list of child-tokens. """ __slots__ = ('value', 'ttype', 'tokens') def __init__(self, tokens=None): if tokens is None: tokens = [] self.tokens = tokens Token.__init__(self, None, None) def __unicode__(self): return ''.join(unicode(x) for x in self.flatten()) def __str__(self): return unicode(self).encode('latin-1') def _get_repr_name(self): return self.__class__.__name__ ## def _pprint_tree(self, max_depth=None, depth=0): ## """Pretty-print the object tree.""" ## indent = ' '*(depth*2) ## for token in self.tokens: ## if token.is_group(): ## pre = ' | ' ## else: ## pre = ' | ' ## print '%s%s%s \'%s\'' % (indent, pre, token._get_repr_name(), ## token._get_repr_value()) ## if (token.is_group() and max_depth is not None ## and depth < max_depth): ## token._pprint_tree(max_depth, depth+1) def flatten(self): """Generator yielding ungrouped tokens. This method is recursively called for all child tokens. """ for token in self.tokens: if isinstance(token, TokenList): for item in token.flatten(): yield item else: yield token def is_group(self): return True def get_sublists(self): return [x for x in self.tokens if isinstance(x, TokenList)] def token_first(self, ignore_whitespace=True): """Returns the first child token. If *ignore_whitespace* is ``True`` (the default), whitespace tokens are ignored. """ for token in self.tokens: if ignore_whitespace and token.is_whitespace(): continue return token return None def token_next_by_instance(self, idx, clss): """Returns the next token matching a class. *idx* is where to start searching in the list of child tokens. *clss* is a list of classes the token should be an instance of. If no matching token can be found ``None`` is returned. """ if isinstance(clss, (list, tuple)): clss = (clss,) if isinstance(clss, tuple): clss = tuple(clss) for token in self.tokens[idx:]: if isinstance(token, clss): return token return None def token_next_by_type(self, idx, ttypes): """Returns next matching token by it's token type.""" if not isinstance(ttypes, (list, tuple)): ttypes = [ttypes] for token in self.tokens[idx:]: if token.ttype in ttypes: return token return None def token_next_match(self, idx, ttype, value, regex=False): """Returns next token where it's ``match`` method returns ``True``.""" if type(idx) != types.IntType: idx = self.token_index(idx) for token in self.tokens[idx:]: if token.match(ttype, value, regex): return token return None def token_not_matching(self, idx, funcs): for token in self.tokens[idx:]: passed = False for func in funcs: if func(token): passed = True break if not passed: return token return None def token_matching(self, idx, funcs): for token in self.tokens[idx:]: for i, func in enumerate(funcs): if func(token): return token return None def token_prev(self, idx, skip_ws=True): """Returns the previous token relative to *idx*. If *skip_ws* is ``True`` (the default) whitespace tokens are ignored. ``None`` is returned if there's no previous token. """ if idx is None: return None if not isinstance(idx, int): idx = self.token_index(idx) while idx != 0: idx -= 1 if self.tokens[idx].is_whitespace() and skip_ws: continue return self.tokens[idx] def token_next(self, idx, skip_ws=True): """Returns the next token relative to *idx*. If *skip_ws* is ``True`` (the default) whitespace tokens are ignored. ``None`` is returned if there's no next token. """ if idx is None: return None if not isinstance(idx, int): idx = self.token_index(idx) while idx < len(self.tokens)-1: idx += 1 if self.tokens[idx].is_whitespace() and skip_ws: continue return self.tokens[idx] def token_index(self, token): """Return list index of token.""" return self.tokens.index(token) def tokens_between(self, start, end, exclude_end=False): """Return all tokens between (and including) start and end. If *exclude_end* is ``True`` (default is ``False``) the end token is included too. """ if exclude_end: offset = 0 else: offset = 1 return self.tokens[self.token_index(start):self.token_index(end)+offset] def group_tokens(self, grp_cls, tokens): """Replace tokens by an instance of *grp_cls*.""" idx = self.token_index(tokens[0]) for t in tokens: self.tokens.remove(t) grp = grp_cls(tokens) self.tokens.insert(idx, grp) return grp def insert_before(self, where, token): """Inserts *token* before *where*.""" self.tokens.insert(self.token_index(where), token) class Statement(TokenList): """Represents a SQL statement.""" __slots__ = ('value', 'ttype', 'tokens') def get_type(self): """Returns the type of a statement. The returned value is a string holding an upper-cased reprint of the first DML or DDL keyword. If the first token in this group isn't a DML or DDL keyword "UNKNOWN" is returned. """ first_token = self.token_first() if first_token.ttype in (T.Keyword.DML, T.Keyword.DDL): return first_token.value.upper() else: return 'UNKNOWN' class Identifier(TokenList): """Represents an identifier. Identifiers may have aliases or typecasts. """ __slots__ = ('value', 'ttype', 'tokens') def has_alias(self): """Returns ``True`` if an alias is present.""" return self.get_alias() is not None def get_alias(self): """Returns the alias for this identifier or ``None``.""" kw = self.token_next_match(0, T.Keyword, 'AS') if kw is not None: alias = self.token_next(self.token_index(kw)) if alias is None: return None else: next_ = self.token_next(0) if next_ is None or not isinstance(next_, Identifier): return None alias = next_ if isinstance(alias, Identifier): return alias.get_name() else: return alias.to_unicode() def get_name(self): """Returns the name of this identifier. This is either it's alias or it's real name. The returned valued can be considered as the name under which the object corresponding to this identifier is known within the current statement. """ alias = self.get_alias() if alias is not None: return alias return self.get_real_name() def get_real_name(self): """Returns the real name (object name) of this identifier.""" # a.b dot = self.token_next_match(0, T.Punctuation, '.') if dot is None: return self.token_next_by_type(0, T.Name).value else: next_ = self.token_next_by_type(self.token_index(dot), (T.Name, T.Wildcard)) if next_ is None: # invalid identifier, e.g. "a." return None return next_.value def get_parent_name(self): """Return name of the parent object if any. A parent object is identified by the first occuring dot. """ dot = self.token_next_match(0, T.Punctuation, '.') if dot is None: return None prev_ = self.token_prev(self.token_index(dot)) if prev_ is None: # something must be verry wrong here.. return None return prev_.value def is_wildcard(self): """Return ``True`` if this identifier contains a wildcard.""" token = self.token_next_by_type(0, T.Wildcard) return token is not None def get_typecast(self): """Returns the typecast or ``None`` of this object as a string.""" marker = self.token_next_match(0, T.Punctuation, '::') if marker is None: return None next_ = self.token_next(self.token_index(marker), False) if next_ is None: return None return next_.to_unicode() class IdentifierList(TokenList): """A list of :class:`~sqlparse.sql.Identifier`\'s.""" __slots__ = ('value', 'ttype', 'tokens') def get_identifiers(self): """Returns the identifiers. Whitespaces and punctuations are not included in this list. """ return [x for x in self.tokens if not x.is_whitespace() and not x.match(T.Punctuation, ',')] class Parenthesis(TokenList): """Tokens between parenthesis.""" __slots__ = ('value', 'ttype', 'tokens') class Assignment(TokenList): """An assignment like 'var := val;'""" __slots__ = ('value', 'ttype', 'tokens') class If(TokenList): """An 'if' clause with possible 'else if' or 'else' parts.""" __slots__ = ('value', 'ttype', 'tokens') class For(TokenList): """A 'FOR' loop.""" __slots__ = ('value', 'ttype', 'tokens') class Comparsion(TokenList): """A comparsion used for example in WHERE clauses.""" __slots__ = ('value', 'ttype', 'tokens') class Comment(TokenList): """A comment.""" __slots__ = ('value', 'ttype', 'tokens') class Where(TokenList): """A WHERE clause.""" __slots__ = ('value', 'ttype', 'tokens') class Case(TokenList): """A CASE statement with one or more WHEN and possibly an ELSE part.""" __slots__ = ('value', 'ttype', 'tokens') def get_cases(self): """Returns a list of 2-tuples (condition, value). If an ELSE exists condition is None. """ ret = [] in_condition = in_value = False for token in self.tokens: if token.match(T.Keyword, 'WHEN'): ret.append(([], [])) in_condition = True in_value = False elif token.match(T.Keyword, 'ELSE'): ret.append((None, [])) in_condition = False in_value = True elif token.match(T.Keyword, 'THEN'): in_condition = False in_value = True elif token.match(T.Keyword, 'END'): in_condition = False in_value = False if in_condition: ret[-1][0].append(token) elif in_value: ret[-1][1].append(token) return ret ================================================ FILE: debug_toolbar/utils/sqlparse/tokens.py ================================================ # Copyright (C) 2008 Andi Albrecht, albrecht.andi@gmail.com # # This module is part of python-sqlparse and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php. # The Token implementation is based on pygment's token system written # by Georg Brandl. # http://pygments.org/ """Tokens""" try: set except NameError: from sets import Set as set class _TokenType(tuple): parent = None def split(self): buf = [] node = self while node is not None: buf.append(node) node = node.parent buf.reverse() return buf def __init__(self, *args): # no need to call super.__init__ self.subtypes = set() def __contains__(self, val): return self is val or ( type(val) is self.__class__ and val[:len(self)] == self ) def __getattr__(self, val): if not val or not val[0].isupper(): return tuple.__getattribute__(self, val) new = _TokenType(self + (val,)) setattr(self, val, new) self.subtypes.add(new) new.parent = self return new def __hash__(self): return hash(tuple(self)) def __repr__(self): return 'Token' + (self and '.' or '') + '.'.join(self) Token = _TokenType() # Special token types Text = Token.Text Whitespace = Text.Whitespace Newline = Whitespace.Newline Error = Token.Error # Text that doesn't belong to this lexer (e.g. HTML in PHP) Other = Token.Other # Common token types for source code Keyword = Token.Keyword Name = Token.Name Literal = Token.Literal String = Literal.String Number = Literal.Number Punctuation = Token.Punctuation Operator = Token.Operator Wildcard = Token.Wildcard Comment = Token.Comment Assignment = Token.Assignement # Generic types for non-source code Generic = Token.Generic # String and some others are not direct childs of Token. # alias them: Token.Token = Token Token.String = String Token.Number = Number # SQL specific tokens DML = Keyword.DML DDL = Keyword.DDL Command = Keyword.Command Group = Token.Group Group.Parenthesis = Token.Group.Parenthesis Group.Comment = Token.Group.Comment Group.Where = Token.Group.Where def is_token_subtype(ttype, other): """ Return True if ``ttype`` is a subtype of ``other``. exists for backwards compatibility. use ``ttype in other`` now. """ return ttype in other def string_to_tokentype(s): """ Convert a string into a token type:: >>> string_to_token('String.Double') Token.Literal.String.Double >>> string_to_token('Token.Literal.Number') Token.Literal.Number >>> string_to_token('') Token Tokens that are already tokens are returned unchanged: >>> string_to_token(String) Token.Literal.String """ if isinstance(s, _TokenType): return s if not s: return Token node = Token for item in s.split('.'): node = getattr(node, item) return node ================================================ FILE: debug_toolbar/utils/tracking/__init__.py ================================================ import logging import time import types def post_dispatch(func): def wrapped(callback): register_hook(func, 'after', callback) return callback return wrapped def pre_dispatch(func): def wrapped(callback): register_hook(func, 'before', callback) return callback return wrapped def replace_call(func): def inner(callback): def wrapped(*args, **kwargs): return callback(func, *args, **kwargs) actual = getattr(func, '__wrapped__', func) wrapped.__wrapped__ = actual wrapped.__doc__ = getattr(actual, '__doc__', None) wrapped.__name__ = actual.__name__ _replace_function(func, wrapped) return wrapped return inner def fire_hook(hook, sender, **kwargs): try: for callback in callbacks[hook].get(id(sender), []): callback(sender=sender, **kwargs) except Exception, e: # Log the exception, dont mess w/ the underlying function logging.exception(e) def _replace_function(func, wrapped): if isinstance(func, types.FunctionType): if func.__module__ == '__builtin__': # oh shit __builtins__[func] = wrapped else: module = __import__(func.__module__, {}, {}, [func.__module__], 0) setattr(module, func.__name__, wrapped) elif getattr(func, 'im_self', None): # TODO: classmethods raise NotImplementedError elif hasattr(func, 'im_class'): # for unbound methods setattr(func.im_class, func.__name__, wrapped) else: raise NotImplementedError callbacks = { 'before': {}, 'after': {}, } def register_hook(func, hook, callback): """ def myhook(sender, args, kwargs): print func, "executed print "args:", args print "kwargs:", kwargs register_hook(BaseDatabaseWrapper.cursor, 'before', myhook) """ assert hook in ('before', 'after') def wrapped(*args, **kwargs): start = time.time() fire_hook('before', sender=wrapped.__wrapped__, args=args, kwargs=kwargs, start=start) result = wrapped.__wrapped__(*args, **kwargs) stop = time.time() fire_hook('after', sender=wrapped.__wrapped__, args=args, kwargs=kwargs, result=result, start=start, stop=stop) actual = getattr(func, '__wrapped__', func) wrapped.__wrapped__ = actual wrapped.__doc__ = getattr(actual, '__doc__', None) wrapped.__name__ = actual.__name__ id_ = id(actual) if id_ not in callbacks[hook]: callbacks[hook][id_] = [] callbacks[hook][id_].append(callback) _replace_function(func, wrapped) ================================================ FILE: debug_toolbar/utils/tracking/db.py ================================================ import sys import traceback from datetime import datetime from django.conf import settings from django.template import Node from django.utils import simplejson from django.utils.encoding import force_unicode from django.utils.hashcompat import sha_constructor from debug_toolbar.utils import ms_from_timedelta, tidy_stacktrace, get_template_info from debug_toolbar.utils.compat.db import connections # TODO:This should be set in the toolbar loader as a default and panels should # get a copy of the toolbar object with access to its config dictionary SQL_WARNING_THRESHOLD = getattr(settings, 'DEBUG_TOOLBAR_CONFIG', {}) \ .get('SQL_WARNING_THRESHOLD', 500) class CursorWrapper(object): """ Wraps a cursor and logs queries. """ def __init__(self, cursor, db, logger): self.cursor = cursor # Instance of a BaseDatabaseWrapper subclass self.db = db # logger must implement a ``record`` method self.logger = logger def execute(self, sql, params=()): start = datetime.now() try: return self.cursor.execute(sql, params) finally: stop = datetime.now() duration = ms_from_timedelta(stop - start) stacktrace = tidy_stacktrace(traceback.extract_stack()) _params = '' try: _params = simplejson.dumps([force_unicode(x, strings_only=True) for x in params]) except TypeError: pass # object not JSON serializable template_info = None cur_frame = sys._getframe().f_back try: while cur_frame is not None: if cur_frame.f_code.co_name == 'render': node = cur_frame.f_locals['self'] if isinstance(node, Node): template_info = get_template_info(node.source) break cur_frame = cur_frame.f_back except: pass del cur_frame alias = getattr(self, 'alias', 'default') conn = connections[alias].connection # HACK: avoid imports if conn: engine = conn.__class__.__module__.split('.', 1)[0] else: engine = 'unknown' params = { 'engine': engine, 'alias': alias, 'sql': self.db.ops.last_executed_query(self.cursor, sql, params), 'duration': duration, 'raw_sql': sql, 'params': _params, 'hash': sha_constructor(settings.SECRET_KEY + sql + _params).hexdigest(), 'stacktrace': stacktrace, 'start_time': start, 'stop_time': stop, 'is_slow': (duration > SQL_WARNING_THRESHOLD), 'is_select': sql.lower().strip().startswith('select'), 'template_info': template_info, } if engine == 'psycopg2': params.update({ 'trans_id': self.logger.get_transaction_id(alias), 'trans_status': conn.get_transaction_status(), 'iso_level': conn.isolation_level, 'encoding': conn.encoding, }) # We keep `sql` to maintain backwards compatibility self.logger.record(**params) def executemany(self, sql, param_list): return self.cursor.executemany(sql, param_list) def __getattr__(self, attr): if attr in self.__dict__: return self.__dict__[attr] else: return getattr(self.cursor, attr) def __iter__(self): return iter(self.cursor) ================================================ FILE: debug_toolbar/views.py ================================================ """ Helper views for the debug toolbar. These are dynamically installed when the debug toolbar is displayed, and typically can do Bad Things, so hooking up these views in any other way is generally not advised. """ import os import django.views.static from django.conf import settings from django.db import connection from django.http import HttpResponseBadRequest from django.shortcuts import render_to_response from django.utils import simplejson from django.utils.hashcompat import sha_constructor class InvalidSQLError(Exception): def __init__(self, value): self.value = value def __str__(self): return repr(self.value) def debug_media(request, path): root = getattr(settings, 'DEBUG_TOOLBAR_MEDIA_ROOT', None) if root is None: parent = os.path.abspath(os.path.dirname(__file__)) root = os.path.join(parent, 'media', 'debug_toolbar') return django.views.static.serve(request, path, root) def sql_select(request): """ Returns the output of the SQL SELECT statement. Expected GET variables: sql: urlencoded sql with positional arguments params: JSON encoded parameter values duration: time for SQL to execute passed in from toolbar just for redisplay hash: the hash of (secret + sql + params) for tamper checking """ from debug_toolbar.panels.sql import reformat_sql sql = request.GET.get('sql', '') params = request.GET.get('params', '') hash = sha_constructor(settings.SECRET_KEY + sql + params).hexdigest() if hash != request.GET.get('hash', ''): return HttpResponseBadRequest('Tamper alert') # SQL Tampering alert if sql.lower().strip().startswith('select'): params = simplejson.loads(params) cursor = connection.cursor() cursor.execute(sql, params) headers = [d[0] for d in cursor.description] result = cursor.fetchall() cursor.close() context = { 'result': result, 'sql': reformat_sql(cursor.db.ops.last_executed_query(cursor, sql, params)), 'duration': request.GET.get('duration', 0.0), 'headers': headers, } return render_to_response('debug_toolbar/panels/sql_select.html', context) raise InvalidSQLError("Only 'select' queries are allowed.") def sql_explain(request): """ Returns the output of the SQL EXPLAIN on the given query. Expected GET variables: sql: urlencoded sql with positional arguments params: JSON encoded parameter values duration: time for SQL to execute passed in from toolbar just for redisplay hash: the hash of (secret + sql + params) for tamper checking """ from debug_toolbar.panels.sql import reformat_sql sql = request.GET.get('sql', '') params = request.GET.get('params', '') hash = sha_constructor(settings.SECRET_KEY + sql + params).hexdigest() if hash != request.GET.get('hash', ''): return HttpResponseBadRequest('Tamper alert') # SQL Tampering alert if sql.lower().strip().startswith('select'): params = simplejson.loads(params) cursor = connection.cursor() if settings.DATABASE_ENGINE == "sqlite3": # SQLite's EXPLAIN dumps the low-level opcodes generated for a query; # EXPLAIN QUERY PLAN dumps a more human-readable summary # See http://www.sqlite.org/lang_explain.html for details cursor.execute("EXPLAIN QUERY PLAN %s" % (sql,), params) else: cursor.execute("EXPLAIN %s" % (sql,), params) headers = [d[0] for d in cursor.description] result = cursor.fetchall() cursor.close() context = { 'result': result, 'sql': reformat_sql(cursor.db.ops.last_executed_query(cursor, sql, params)), 'duration': request.GET.get('duration', 0.0), 'headers': headers, } return render_to_response('debug_toolbar/panels/sql_explain.html', context) raise InvalidSQLError("Only 'select' queries are allowed.") def sql_profile(request): """ Returns the output of running the SQL and getting the profiling statistics. Expected GET variables: sql: urlencoded sql with positional arguments params: JSON encoded parameter values duration: time for SQL to execute passed in from toolbar just for redisplay hash: the hash of (secret + sql + params) for tamper checking """ from debug_toolbar.panels.sql import reformat_sql sql = request.GET.get('sql', '') params = request.GET.get('params', '') hash = sha_constructor(settings.SECRET_KEY + sql + params).hexdigest() if hash != request.GET.get('hash', ''): return HttpResponseBadRequest('Tamper alert') # SQL Tampering alert if sql.lower().strip().startswith('select'): params = simplejson.loads(params) cursor = connection.cursor() result = None headers = None result_error = None try: cursor.execute("SET PROFILING=1") # Enable profiling cursor.execute(sql, params) # Execute SELECT cursor.execute("SET PROFILING=0") # Disable profiling # The Query ID should always be 1 here but I'll subselect to get the last one just in case... cursor.execute("SELECT * FROM information_schema.profiling WHERE query_id=(SELECT query_id FROM information_schema.profiling ORDER BY query_id DESC LIMIT 1)") headers = [d[0] for d in cursor.description] result = cursor.fetchall() except: result_error = "Profiling is either not available or not supported by your database." cursor.close() context = { 'result': result, 'result_error': result_error, 'sql': reformat_sql(cursor.db.ops.last_executed_query(cursor, sql, params)), 'duration': request.GET.get('duration', 0.0), 'headers': headers, } return render_to_response('debug_toolbar/panels/sql_profile.html', context) raise InvalidSQLError("Only 'select' queries are allowed.") def template_source(request): """ Return the source of a template, syntax-highlighted by Pygments if it's available. """ from django.template import TemplateDoesNotExist from django.utils.safestring import mark_safe from django.conf import settings template_name = request.GET.get('template', None) if template_name is None: return HttpResponseBadRequest('"template" key is required') try: # Django 1.2 ... from django.template.loader import find_template_loader, make_origin loaders = [] for loader_name in settings.TEMPLATE_LOADERS: loader = find_template_loader(loader_name) if loader is not None: loaders.append(loader) for loader in loaders: try: source, display_name = loader.load_template_source(template_name) origin = make_origin(display_name, loader, template_name, settings.TEMPLATE_DIRS) break except TemplateDoesNotExist: source = "Template Does Not Exist: %s" % (template_name,) except (ImportError, AttributeError): # Django 1.1 ... from django.template.loader import find_template_source source, origin = find_template_source(template_name) try: from pygments import highlight from pygments.lexers import HtmlDjangoLexer from pygments.formatters import HtmlFormatter source = highlight(source, HtmlDjangoLexer(), HtmlFormatter()) source = mark_safe(source) source.pygmentized = True except ImportError: pass return render_to_response('debug_toolbar/panels/template_source.html', { 'source': source, 'template_name': template_name }) ================================================ FILE: example/__init__.py ================================================ ================================================ FILE: example/manage.py ================================================ #!/usr/bin/env python from django.core.management import execute_manager try: import settings # Assumed to be in the same directory. except ImportError: import sys sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__) sys.exit(1) if __name__ == "__main__": execute_manager(settings) ================================================ FILE: example/media/js/jquery.js ================================================ (function(){ /* * jQuery 1.2.6 - New Wave Javascript * * Copyright (c) 2008 John Resig (jquery.com) * Dual licensed under the MIT (MIT-LICENSE.txt) * and GPL (GPL-LICENSE.txt) licenses. * * $Date: 2008/05/26 $ * $Rev: 5685 $ */ // Map over jQuery in case of overwrite var _jQuery = window.jQuery, // Map over the $ in case of overwrite _$ = window.$; var jQuery = window.jQuery = window.$ = function( selector, context ) { // The jQuery object is actually just the init constructor 'enhanced' return new jQuery.fn.init( selector, context ); }; // A simple way to check for HTML strings or ID strings // (both of which we optimize for) var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/, // Is it a simple selector isSimple = /^.[^:#\[\.]*$/, // Will speed up references to undefined, and allows munging its name. undefined; jQuery.fn = jQuery.prototype = { init: function( selector, context ) { // Make sure that a selection was provided selector = selector || document; // Handle $(DOMElement) if ( selector.nodeType ) { this[0] = selector; this.length = 1; return this; } // Handle HTML strings if ( typeof selector == "string" ) { // Are we dealing with HTML string or an ID? var match = quickExpr.exec( selector ); // Verify a match, and that no context was specified for #id if ( match && (match[1] || !context) ) { // HANDLE: $(html) -> $(array) if ( match[1] ) selector = jQuery.clean( [ match[1] ], context ); // HANDLE: $("#id") else { var elem = document.getElementById( match[3] ); // Make sure an element was located if ( elem ){ // Handle the case where IE and Opera return items // by name instead of ID if ( elem.id != match[3] ) return jQuery().find( selector ); // Otherwise, we inject the element directly into the jQuery object return jQuery( elem ); } selector = []; } // HANDLE: $(expr, [context]) // (which is just equivalent to: $(content).find(expr) } else return jQuery( context ).find( selector ); // HANDLE: $(function) // Shortcut for document ready } else if ( jQuery.isFunction( selector ) ) return jQuery( document )[ jQuery.fn.ready ? "ready" : "load" ]( selector ); return this.setArray(jQuery.makeArray(selector)); }, // The current version of jQuery being used jquery: "1.2.6", // The number of elements contained in the matched element set size: function() { return this.length; }, // The number of elements contained in the matched element set length: 0, // Get the Nth element in the matched element set OR // Get the whole matched element set as a clean array get: function( num ) { return num == undefined ? // Return a 'clean' array jQuery.makeArray( this ) : // Return just the object this[ num ]; }, // Take an array of elements and push it onto the stack // (returning the new matched element set) pushStack: function( elems ) { // Build a new jQuery matched element set var ret = jQuery( elems ); // Add the old object onto the stack (as a reference) ret.prevObject = this; // Return the newly-formed element set return ret; }, // Force the current matched set of elements to become // the specified array of elements (destroying the stack in the process) // You should use pushStack() in order to do this, but maintain the stack setArray: function( elems ) { // Resetting the length to 0, then using the native Array push // is a super-fast way to populate an object with array-like properties this.length = 0; Array.prototype.push.apply( this, elems ); return this; }, // Execute a callback for every element in the matched set. // (You can seed the arguments with an array of args, but this is // only used internally.) each: function( callback, args ) { return jQuery.each( this, callback, args ); }, // Determine the position of an element within // the matched set of elements index: function( elem ) { var ret = -1; // Locate the position of the desired element return jQuery.inArray( // If it receives a jQuery object, the first element is used elem && elem.jquery ? elem[0] : elem , this ); }, attr: function( name, value, type ) { var options = name; // Look for the case where we're accessing a style value if ( name.constructor == String ) if ( value === undefined ) return this[0] && jQuery[ type || "attr" ]( this[0], name ); else { options = {}; options[ name ] = value; } // Check to see if we're setting style values return this.each(function(i){ // Set all the styles for ( name in options ) jQuery.attr( type ? this.style : this, name, jQuery.prop( this, options[ name ], type, i, name ) ); }); }, css: function( key, value ) { // ignore negative width and height values if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 ) value = undefined; return this.attr( key, value, "curCSS" ); }, text: function( text ) { if ( typeof text != "object" && text != null ) return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) ); var ret = ""; jQuery.each( text || this, function(){ jQuery.each( this.childNodes, function(){ if ( this.nodeType != 8 ) ret += this.nodeType != 1 ? this.nodeValue : jQuery.fn.text( [ this ] ); }); }); return ret; }, wrapAll: function( html ) { if ( this[0] ) // The elements to wrap the target around jQuery( html, this[0].ownerDocument ) .clone() .insertBefore( this[0] ) .map(function(){ var elem = this; while ( elem.firstChild ) elem = elem.firstChild; return elem; }) .append(this); return this; }, wrapInner: function( html ) { return this.each(function(){ jQuery( this ).contents().wrapAll( html ); }); }, wrap: function( html ) { return this.each(function(){ jQuery( this ).wrapAll( html ); }); }, append: function() { return this.domManip(arguments, true, false, function(elem){ if (this.nodeType == 1) this.appendChild( elem ); }); }, prepend: function() { return this.domManip(arguments, true, true, function(elem){ if (this.nodeType == 1) this.insertBefore( elem, this.firstChild ); }); }, before: function() { return this.domManip(arguments, false, false, function(elem){ this.parentNode.insertBefore( elem, this ); }); }, after: function() { return this.domManip(arguments, false, true, function(elem){ this.parentNode.insertBefore( elem, this.nextSibling ); }); }, end: function() { return this.prevObject || jQuery( [] ); }, find: function( selector ) { var elems = jQuery.map(this, function(elem){ return jQuery.find( selector, elem ); }); return this.pushStack( /[^+>] [^+>]/.test( selector ) || selector.indexOf("..") > -1 ? jQuery.unique( elems ) : elems ); }, clone: function( events ) { // Do the clone var ret = this.map(function(){ if ( jQuery.browser.msie && !jQuery.isXMLDoc(this) ) { // IE copies events bound via attachEvent when // using cloneNode. Calling detachEvent on the // clone will also remove the events from the orignal // In order to get around this, we use innerHTML. // Unfortunately, this means some modifications to // attributes in IE that are actually only stored // as properties will not be copied (such as the // the name attribute on an input). var clone = this.cloneNode(true), container = document.createElement("div"); container.appendChild(clone); return jQuery.clean([container.innerHTML])[0]; } else return this.cloneNode(true); }); // Need to set the expando to null on the cloned set if it exists // removeData doesn't work here, IE removes it from the original as well // this is primarily for IE but the data expando shouldn't be copied over in any browser var clone = ret.find("*").andSelf().each(function(){ if ( this[ expando ] != undefined ) this[ expando ] = null; }); // Copy the events from the original to the clone if ( events === true ) this.find("*").andSelf().each(function(i){ if (this.nodeType == 3) return; var events = jQuery.data( this, "events" ); for ( var type in events ) for ( var handler in events[ type ] ) jQuery.event.add( clone[ i ], type, events[ type ][ handler ], events[ type ][ handler ].data ); }); // Return the cloned set return ret; }, filter: function( selector ) { return this.pushStack( jQuery.isFunction( selector ) && jQuery.grep(this, function(elem, i){ return selector.call( elem, i ); }) || jQuery.multiFilter( selector, this ) ); }, not: function( selector ) { if ( selector.constructor == String ) // test special case where just one selector is passed in if ( isSimple.test( selector ) ) return this.pushStack( jQuery.multiFilter( selector, this, true ) ); else selector = jQuery.multiFilter( selector, this ); var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType; return this.filter(function() { return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector; }); }, add: function( selector ) { return this.pushStack( jQuery.unique( jQuery.merge( this.get(), typeof selector == 'string' ? jQuery( selector ) : jQuery.makeArray( selector ) ))); }, is: function( selector ) { return !!selector && jQuery.multiFilter( selector, this ).length > 0; }, hasClass: function( selector ) { return this.is( "." + selector ); }, val: function( value ) { if ( value == undefined ) { if ( this.length ) { var elem = this[0]; // We need to handle select boxes special if ( jQuery.nodeName( elem, "select" ) ) { var index = elem.selectedIndex, values = [], options = elem.options, one = elem.type == "select-one"; // Nothing was selected if ( index < 0 ) return null; // Loop through all the selected options for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { var option = options[ i ]; if ( option.selected ) { // Get the specifc value for the option value = jQuery.browser.msie && !option.attributes.value.specified ? option.text : option.value; // We don't need an array for one selects if ( one ) return value; // Multi-Selects return an array values.push( value ); } } return values; // Everything else, we just grab the value } else return (this[0].value || "").replace(/\r/g, ""); } return undefined; } if( value.constructor == Number ) value += ''; return this.each(function(){ if ( this.nodeType != 1 ) return; if ( value.constructor == Array && /radio|checkbox/.test( this.type ) ) this.checked = (jQuery.inArray(this.value, value) >= 0 || jQuery.inArray(this.name, value) >= 0); else if ( jQuery.nodeName( this, "select" ) ) { var values = jQuery.makeArray(value); jQuery( "option", this ).each(function(){ this.selected = (jQuery.inArray( this.value, values ) >= 0 || jQuery.inArray( this.text, values ) >= 0); }); if ( !values.length ) this.selectedIndex = -1; } else this.value = value; }); }, html: function( value ) { return value == undefined ? (this[0] ? this[0].innerHTML : null) : this.empty().append( value ); }, replaceWith: function( value ) { return this.after( value ).remove(); }, eq: function( i ) { return this.slice( i, i + 1 ); }, slice: function() { return this.pushStack( Array.prototype.slice.apply( this, arguments ) ); }, map: function( callback ) { return this.pushStack( jQuery.map(this, function(elem, i){ return callback.call( elem, i, elem ); })); }, andSelf: function() { return this.add( this.prevObject ); }, data: function( key, value ){ var parts = key.split("."); parts[1] = parts[1] ? "." + parts[1] : ""; if ( value === undefined ) { var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); if ( data === undefined && this.length ) data = jQuery.data( this[0], key ); return data === undefined && parts[1] ? this.data( parts[0] ) : data; } else return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){ jQuery.data( this, key, value ); }); }, removeData: function( key ){ return this.each(function(){ jQuery.removeData( this, key ); }); }, domManip: function( args, table, reverse, callback ) { var clone = this.length > 1, elems; return this.each(function(){ if ( !elems ) { elems = jQuery.clean( args, this.ownerDocument ); if ( reverse ) elems.reverse(); } var obj = this; if ( table && jQuery.nodeName( this, "table" ) && jQuery.nodeName( elems[0], "tr" ) ) obj = this.getElementsByTagName("tbody")[0] || this.appendChild( this.ownerDocument.createElement("tbody") ); var scripts = jQuery( [] ); jQuery.each(elems, function(){ var elem = clone ? jQuery( this ).clone( true )[0] : this; // execute all scripts after the elements have been injected if ( jQuery.nodeName( elem, "script" ) ) scripts = scripts.add( elem ); else { // Remove any inner scripts for later evaluation if ( elem.nodeType == 1 ) scripts = scripts.add( jQuery( "script", elem ).remove() ); // Inject the elements into the document callback.call( obj, elem ); } }); scripts.each( evalScript ); }); } }; // Give the init function the jQuery prototype for later instantiation jQuery.fn.init.prototype = jQuery.fn; function evalScript( i, elem ) { if ( elem.src ) jQuery.ajax({ url: elem.src, async: false, dataType: "script" }); else jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" ); if ( elem.parentNode ) elem.parentNode.removeChild( elem ); } function now(){ return +new Date; } jQuery.extend = jQuery.fn.extend = function() { // copy reference to target object var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options; // Handle a deep copy situation if ( target.constructor == Boolean ) { deep = target; target = arguments[1] || {}; // skip the boolean and the target i = 2; } // Handle case when target is a string or something (possible in deep copy) if ( typeof target != "object" && typeof target != "function" ) target = {}; // extend jQuery itself if only one argument is passed if ( length == i ) { target = this; --i; } for ( ; i < length; i++ ) // Only deal with non-null/undefined values if ( (options = arguments[ i ]) != null ) // Extend the base object for ( var name in options ) { var src = target[ name ], copy = options[ name ]; // Prevent never-ending loop if ( target === copy ) continue; // Recurse if we're merging object values if ( deep && copy && typeof copy == "object" && !copy.nodeType ) target[ name ] = jQuery.extend( deep, // Never move original objects, clone them src || ( copy.length != null ? [ ] : { } ) , copy ); // Don't bring in undefined values else if ( copy !== undefined ) target[ name ] = copy; } // Return the modified object return target; }; var expando = "jQuery" + now(), uuid = 0, windowData = {}, // exclude the following css properties to add px exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i, // cache defaultView defaultView = document.defaultView || {}; jQuery.extend({ noConflict: function( deep ) { window.$ = _$; if ( deep ) window.jQuery = _jQuery; return jQuery; }, // See test/unit/core.js for details concerning this function. isFunction: function( fn ) { return !!fn && typeof fn != "string" && !fn.nodeName && fn.constructor != Array && /^[\s[]?function/.test( fn + "" ); }, // check if an element is in a (or is an) XML document isXMLDoc: function( elem ) { return elem.documentElement && !elem.body || elem.tagName && elem.ownerDocument && !elem.ownerDocument.body; }, // Evalulates a script in a global context globalEval: function( data ) { data = jQuery.trim( data ); if ( data ) { // Inspired by code by Andrea Giammarchi // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html var head = document.getElementsByTagName("head")[0] || document.documentElement, script = document.createElement("script"); script.type = "text/javascript"; if ( jQuery.browser.msie ) script.text = data; else script.appendChild( document.createTextNode( data ) ); // Use insertBefore instead of appendChild to circumvent an IE6 bug. // This arises when a base node is used (#2709). head.insertBefore( script, head.firstChild ); head.removeChild( script ); } }, nodeName: function( elem, name ) { return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase(); }, cache: {}, data: function( elem, name, data ) { elem = elem == window ? windowData : elem; var id = elem[ expando ]; // Compute a unique ID for the element if ( !id ) id = elem[ expando ] = ++uuid; // Only generate the data cache if we're // trying to access or manipulate it if ( name && !jQuery.cache[ id ] ) jQuery.cache[ id ] = {}; // Prevent overriding the named cache with undefined values if ( data !== undefined ) jQuery.cache[ id ][ name ] = data; // Return the named cache data, or the ID for the element return name ? jQuery.cache[ id ][ name ] : id; }, removeData: function( elem, name ) { elem = elem == window ? windowData : elem; var id = elem[ expando ]; // If we want to remove a specific section of the element's data if ( name ) { if ( jQuery.cache[ id ] ) { // Remove the section of cache data delete jQuery.cache[ id ][ name ]; // If we've removed all the data, remove the element's cache name = ""; for ( name in jQuery.cache[ id ] ) break; if ( !name ) jQuery.removeData( elem ); } // Otherwise, we want to remove all of the element's data } else { // Clean up the element expando try { delete elem[ expando ]; } catch(e){ // IE has trouble directly removing the expando // but it's ok with using removeAttribute if ( elem.removeAttribute ) elem.removeAttribute( expando ); } // Completely remove the data cache delete jQuery.cache[ id ]; } }, // args is for internal usage only each: function( object, callback, args ) { var name, i = 0, length = object.length; if ( args ) { if ( length == undefined ) { for ( name in object ) if ( callback.apply( object[ name ], args ) === false ) break; } else for ( ; i < length; ) if ( callback.apply( object[ i++ ], args ) === false ) break; // A special, fast, case for the most common use of each } else { if ( length == undefined ) { for ( name in object ) if ( callback.call( object[ name ], name, object[ name ] ) === false ) break; } else for ( var value = object[0]; i < length && callback.call( value, i, value ) !== false; value = object[++i] ){} } return object; }, prop: function( elem, value, type, i, name ) { // Handle executable functions if ( jQuery.isFunction( value ) ) value = value.call( elem, i ); // Handle passing in a number to a CSS property return value && value.constructor == Number && type == "curCSS" && !exclude.test( name ) ? value + "px" : value; }, className: { // internal only, use addClass("class") add: function( elem, classNames ) { jQuery.each((classNames || "").split(/\s+/), function(i, className){ if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) ) elem.className += (elem.className ? " " : "") + className; }); }, // internal only, use removeClass("class") remove: function( elem, classNames ) { if (elem.nodeType == 1) elem.className = classNames != undefined ? jQuery.grep(elem.className.split(/\s+/), function(className){ return !jQuery.className.has( classNames, className ); }).join(" ") : ""; }, // internal only, use hasClass("class") has: function( elem, className ) { return jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1; } }, // A method for quickly swapping in/out CSS properties to get correct calculations swap: function( elem, options, callback ) { var old = {}; // Remember the old values, and insert the new ones for ( var name in options ) { old[ name ] = elem.style[ name ]; elem.style[ name ] = options[ name ]; } callback.call( elem ); // Revert the old values for ( var name in options ) elem.style[ name ] = old[ name ]; }, css: function( elem, name, force ) { if ( name == "width" || name == "height" ) { var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ]; function getWH() { val = name == "width" ? elem.offsetWidth : elem.offsetHeight; var padding = 0, border = 0; jQuery.each( which, function() { padding += parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0; border += parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0; }); val -= Math.round(padding + border); } if ( jQuery(elem).is(":visible") ) getWH(); else jQuery.swap( elem, props, getWH ); return Math.max(0, val); } return jQuery.curCSS( elem, name, force ); }, curCSS: function( elem, name, force ) { var ret, style = elem.style; // A helper method for determining if an element's values are broken function color( elem ) { if ( !jQuery.browser.safari ) return false; // defaultView is cached var ret = defaultView.getComputedStyle( elem, null ); return !ret || ret.getPropertyValue("color") == ""; } // We need to handle opacity special in IE if ( name == "opacity" && jQuery.browser.msie ) { ret = jQuery.attr( style, "opacity" ); return ret == "" ? "1" : ret; } // Opera sometimes will give the wrong display answer, this fixes it, see #2037 if ( jQuery.browser.opera && name == "display" ) { var save = style.outline; style.outline = "0 solid black"; style.outline = save; } // Make sure we're using the right name for getting the float value if ( name.match( /float/i ) ) name = styleFloat; if ( !force && style && style[ name ] ) ret = style[ name ]; else if ( defaultView.getComputedStyle ) { // Only "float" is needed here if ( name.match( /float/i ) ) name = "float"; name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase(); var computedStyle = defaultView.getComputedStyle( elem, null ); if ( computedStyle && !color( elem ) ) ret = computedStyle.getPropertyValue( name ); // If the element isn't reporting its values properly in Safari // then some display: none elements are involved else { var swap = [], stack = [], a = elem, i = 0; // Locate all of the parent display: none elements for ( ; a && color(a); a = a.parentNode ) stack.unshift(a); // Go through and make them visible, but in reverse // (It would be better if we knew the exact display type that they had) for ( ; i < stack.length; i++ ) if ( color( stack[ i ] ) ) { swap[ i ] = stack[ i ].style.display; stack[ i ].style.display = "block"; } // Since we flip the display style, we have to handle that // one special, otherwise get the value ret = name == "display" && swap[ stack.length - 1 ] != null ? "none" : ( computedStyle && computedStyle.getPropertyValue( name ) ) || ""; // Finally, revert the display styles back for ( i = 0; i < swap.length; i++ ) if ( swap[ i ] != null ) stack[ i ].style.display = swap[ i ]; } // We should always get a number back from opacity if ( name == "opacity" && ret == "" ) ret = "1"; } else if ( elem.currentStyle ) { var camelCase = name.replace(/\-(\w)/g, function(all, letter){ return letter.toUpperCase(); }); ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ]; // From the awesome hack by Dean Edwards // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 // If we're not dealing with a regular pixel number // but a number that has a weird ending, we need to convert it to pixels if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) { // Remember the original values var left = style.left, rsLeft = elem.runtimeStyle.left; // Put in the new values to get a computed value out elem.runtimeStyle.left = elem.currentStyle.left; style.left = ret || 0; ret = style.pixelLeft + "px"; // Revert the changed values style.left = left; elem.runtimeStyle.left = rsLeft; } } return ret; }, clean: function( elems, context ) { var ret = []; context = context || document; // !context.createElement fails in IE with an error but returns typeof 'object' if (typeof context.createElement == 'undefined') context = context.ownerDocument || context[0] && context[0].ownerDocument || document; jQuery.each(elems, function(i, elem){ if ( !elem ) return; if ( elem.constructor == Number ) elem += ''; // Convert html string into DOM nodes if ( typeof elem == "string" ) { // Fix "XHTML"-style tags in all browsers elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){ return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ? all : front + ">"; }); // Trim whitespace, otherwise indexOf won't work as expected var tags = jQuery.trim( elem ).toLowerCase(), div = context.createElement("div"); var wrap = // option or optgroup !tags.indexOf("", "" ] || !tags.indexOf("", "" ] || tags.match(/^<(thead|tbody|tfoot|colg|cap)/) && [ 1, "", "
" ] || !tags.indexOf("", "" ] || // matched above (!tags.indexOf("", "" ] || !tags.indexOf("", "" ] || // IE can't serialize and {% endblock %} ================================================ FILE: example/templates/index.html ================================================ Index of Tests

Index of Tests

================================================ FILE: example/templates/jquery/index.html ================================================ Old jQuery Test

jQuery Test

If you see this, jQuery is working.

================================================ FILE: example/templates/mootools/index.html ================================================ MooTools Test

MooTools Test

If you see this, MooTools is working.

================================================ FILE: example/templates/prototype/index.html ================================================ Prototype Test

Prototype Test

If you see this, Prototype is working.

================================================ FILE: example/urls.py ================================================ from django.conf import settings from django.conf.urls.defaults import * from django.contrib import admin from django.views.generic.simple import direct_to_template admin.autodiscover() urlpatterns = patterns('', (r'^$', direct_to_template, {'template': 'index.html'}), (r'^jquery/index/$', direct_to_template, {'template': 'jquery/index.html'}), (r'^mootools/index/$', direct_to_template, {'template': 'mootools/index.html'}), (r'^prototype/index/$', direct_to_template, {'template': 'prototype/index.html'}), (r'^admin/', include(admin.site.urls)), ) if settings.DEBUG: urlpatterns += patterns('', (r'^media/(.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}) ) ================================================ FILE: setup.cfg ================================================ [egg_info] tag_svn_revision = false ================================================ FILE: setup.py ================================================ from setuptools import setup, find_packages setup( name='django-debug-toolbar', version=__import__('debug_toolbar').__version__, description='A configurable set of panels that display various debug information about the current request/response.', long_description=open('README.rst').read(), # Get more strings from http://www.python.org/pypi?:action=list_classifiers author='Rob Hudson', author_email='rob@cogit8.org', url='https://github.com/django-debug-toolbar/django-debug-toolbar', download_url='https://github.com/django-debug-toolbar/django-debug-toolbar/downloads', license='BSD', packages=find_packages(exclude=['ez_setup']), tests_require=[ 'django', 'dingus', ], test_suite='debug_toolbar.runtests.runtests', include_package_data=True, zip_safe=False, # because we're including media that Django needs classifiers=[ 'Development Status :: 4 - Beta', 'Environment :: Web Environment', 'Framework :: Django', 'Intended Audience :: Developers', 'License :: OSI Approved :: BSD License', 'Operating System :: OS Independent', 'Programming Language :: Python', 'Topic :: Software Development :: Libraries :: Python Modules', ], )