This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Based on | |
| http://www.bitbucket.org/mitsuhiko/jinja2-main/src/tip/ext/djangojinja2.py | |
| """ | |
| import jinja2 | |
| from django.conf import settings | |
| from django.core.exceptions import ImproperlyConfigured | |
| from django.template import TemplateDoesNotExist | |
| from django.template.loader import BaseLoader |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function! EnableVirtualEnv() | |
| python << EOF | |
| import vim | |
| import os | |
| import sys | |
| if 'VIRTUAL_ENV' in os.environ: | |
| vim.command('let g:virtualenv_found = 1') | |
| # enable virtualenv environment within vimruntime | |
| activate_this = os.path.join(os.environ['VIRTUAL_ENV'], 'bin/activate_this.py') | |
| if os.path.isfile(activate_this): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # HG changeset patch | |
| # Parent b83d4a597f5fefe33a4eb0a7a4d4027402140870 | |
| # User Rolando Espinoza La fuente <[email protected]> | |
| diff --git a/django/test/testcases.py b/django/test/testcases.py | |
| --- a/django/test/testcases.py | |
| +++ b/django/test/testcases.py | |
| @@ -7,7 +7,7 @@ from django.conf import settings | |
| from django.core import mail | |
| from django.core.management import call_command |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from scrapy.spider import BaseSpider | |
| from scrapy.http import FormRequest, Request | |
| from scrapy.selector import HtmlXPathSelector | |
| class DjangoSpider(BaseSpider): | |
| domain_name = "django.local" | |
| start_urls = ["http://localhost:8000/admin/"] | |
| extra_domain_names = ["localhost"] | |
| def parse(self, response): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/django/contrib/sites/management.py b/django/contrib/sites/management.py | |
| index 1987274..40f93ae 100644 | |
| --- a/django/contrib/sites/management.py | |
| +++ b/django/contrib/sites/management.py | |
| @@ -8,9 +8,15 @@ from django.contrib.sites import models as site_app | |
| def create_default_site(app, created_models, verbosity, db, **kwargs): | |
| if Site in created_models: | |
| + domain = "example.com" | |
| + if kwargs.get('interactive', True): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from scrapy.core import signals | |
| from scrapy import log | |
| from scrapy.xlib.pydispatch import dispatcher | |
| import time | |
| class ElapsedTimeMiddleware(object): | |
| def __init__(self): | |
| self._registry = {} | |
| dispatcher.connect(self.spider_opened, signal=signals.spider_opened) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cookies = {} | |
| for cs in response.headers['set-cookie'].split(';'): | |
| data = cs.split('=') | |
| cookies[data[0]] = data[1] if len(data) > 1 else data[0] | |
| sessid = cookies['PHPSESSID'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Django settings for myproject project. | |
| import os | |
| import sys | |
| DEBUG = True | |
| TEMPLATE_DEBUG = DEBUG | |
| ADMINS = ( | |
| # ('Your Name', '[email protected]'), | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SetHandler python-program | |
| PythonHandler django.core.handlers.modpython | |
| SetEnv DJANGO_SETTINGS_MODULE myproject.settings | |
| PythonDebug On | |
| PythonPAth "['/home/darkrho/django_sites'] + sys.path" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from __future__ import with_statement # python2.5 | |
| """ | |
| Project root holds virtual environment | |
| """ | |
| from fabric.api import * | |
| import os.path | |
| # globals | |
| env.project_name = 'myproject' |