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
Failed to install index for gis.GeoNote model: AddGeometryColumns() - invalid SRID | |
CONTEXT: SQL statement "SELECT AddGeometryColumn('','',$1,$2,$3,$4,$5)" | |
PL/pgSQL function "addgeometrycolumn" line 5 at SQL statement | |
Problem installing fixture '/home/joshbohde/code/django-tastypie/tests/gis/fixtures/initial_data.json': Traceback (most recent call last): | |
File "/home/joshbohde/.virtualenvs/tastypie/local/lib/python2.7/site-packages/django/core/management/commands/loaddata.py", line 174, in handle | |
obj.save(using=using) | |
File "/home/joshbohde/.virtualenvs/tastypie/local/lib/python2.7/site-packages/django/core/serializers/base.py", line 165, in save | |
models.Model.save_base(self.object, using=using, raw=True) | |
File "/home/joshbohde/.virtualenvs/tastypie/local/lib/python2.7/site-packages/django/db/models/base.py", line 553, in save_base |
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
cd ~ | |
# Install the required JDK | |
sudo apt-get install openjdk-6-jre-headless | |
# Download, extract and move ElasticSearch | |
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.17.6.tar.gz -O elasticsearch.tar.gz | |
tar -xf elasticsearch.tar.gz | |
rm elasticsearch.tar.gz | |
sudo mv elasticsearch-* elasticsearch |
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
(tastypie)joshbohde@mu:~/code/django-tastypie/tests $ which django-admin.py branch: (patch_related_resource) | |
/home/joshbohde/.virtualenvs/tastypie/bin/django-admin.py |
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
class CustomDepthField(ToOneField): | |
def should_be_full(bundle): | |
if not bundle.request: | |
return self.full | |
if bundle.request.GET.get('with_entities', self.full) in (True, 'true', 'True', '1'): | |
return True | |
return False | |
def dehydrate_related(self, bundle, related_resource): |
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
op(490, infix_right, "+"). | |
op(470, infix_right, "*"). | |
op(460, infix, "/"). | |
op(460, infix, "mod"). | |
op(390, prefix, "-"). | |
assign(domain_size, 10). % domain is {0,1,2,3,4,5,6,7,8,9}. | |
% S E N D |
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
class TestResource(ModelResource): | |
def is_authorized(self, *args, **kwarg): | |
super(TestResource, self).is_authorized(*args, **kwargs) | |
print 'is_authorized passed' | |
def is_authenticated(self, *args, **kwarg): | |
super(TestResource, self).is_authenticated(*args, **kwargs) | |
print 'is_authenticated passed' | |
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
class MyResource(ModelResource): | |
def dehydrate(self, bundle): | |
try: | |
del bundle.data['text_to_subscribe'] | |
except KeyError: | |
pass | |
return bundle | |
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
_SUPPORTED_TRANSFORMS = set(['PUT', 'DELETE', 'PATCH']) | |
_MIDDLEWARE_KEY = 'real_method' | |
class HttpMethodsMiddleware(object): | |
def process_request(self, request): | |
if request.GET and request.GET.has_key(_MIDDLEWARE_KEY): | |
new_method = request.GET[_MIDDLEWARE_KEY].upper() | |
if new_method in _SUPPORTED_TRANSFORMS: | |
request.method = new_method | |
return None |
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
(match n | |
0 1 | |
_ (* n (factorial (- n 1)))) | |
;;expands to | |
(try | |
(cond (= n 0) 1 :else (throw backtrack)) | |
(catch | |
java.lang.Exception | |
e__7660__auto__ |
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
class MyResource(ModelResource): | |
# Normal stuff here... | |
def build_filters(self, filters=None): | |
print filters | |
ret = super(MyResource, self).build_filters(filters=filters) | |
print ret | |
return ret |