This file contains 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
import re | |
def replace(url, key, value): | |
p = re.compile('%s=[^=&]*' % key, re.VERBOSE) | |
return p.sub('%s=%s' % (key, value), url) | |
url = 'http://www.google.com/?a=b&c=d&d=f' | |
print replace(url, 'a', 'test') | |
print replace(url, 'c', 'test') | |
print replace(url, 'd', 'test') |
This file contains 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
<?xml version="1.0" encoding="UTF-8" ?> | |
<config> | |
<abortOnConfigurationError>${solr.abortOnConfigurationError:true}</abortOnConfigurationError> | |
<luceneMatchVersion>LUCENE_31</luceneMatchVersion> | |
<lib dir="../../contrib/extraction/lib" /> | |
<lib dir="../../dist/" regex="apache-solr-cell-\d.*\.jar" /> | |
<lib dir="../../dist/" regex="apache-solr-clustering-\d.*\.jar" /> | |
<lib dir="../../dist/" regex="apache-solr-dataimporthandler-\d.*\.jar" /> | |
<lib dir="../../contrib/clustering/lib/" /> | |
This file contains 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 django.core.handlers.base import BaseHandler | |
from django.test.client import RequestFactory | |
class RequestMock(RequestFactory): | |
def request(self, **request): | |
"Construct a generic request object." | |
request = RequestFactory.request(self, **request) | |
handler = BaseHandler() | |
handler.load_middleware() | |
for middleware_method in handler._request_middleware: |
NewerOlder