Skip to content

Instantly share code, notes, and snippets.

View zopyx's full-sized avatar

Andreas Jung zopyx

View GitHub Profile
from functools import wraps
import json
from pyramid.httpexceptions import HTTPBadRequest
import validictory
def validate_json(inbound_schema=None, outbound_schema=None):
"""
Validate the request's JSON input and output using JSON schemas
Based on http://www.alexconrad.org/2013/02/loggingexception.html.
sucmac:plone43 ajung$ bin/instance fg
2013-04-24 13:29:14 INFO ZServer HTTP server started at Wed Apr 24 13:29:14 2013
Hostname: 0.0.0.0
Port: 8080
/Users/ajung/.buildout/eggs/zope.configuration-3.7.4-py2.6.egg/zope/configuration/fields.py:417: UserWarning: You did not specify an i18n translation domain for the 'title' field in /Users/ajung/.buildout/eggs/Products.CMFDynamicViewFTI-4.0.4-py2.6.egg/Products/CMFDynamicViewFTI/configure.zcml
"'%s' field in %s" % (self.getName(), context.info.file )
Traceback (most recent call last):
File "/Users/ajung/sandboxes/plone43/parts/instance/bin/interpreter", line 280, in <module>
execfile(__file__)
File "/Users/ajung/.buildout/eggs/Zope2-2.13.19-py2.6.egg/Zope2/Startup/run.py", line 76, in <module>
=========================================================================== 1 failed, 9 deselected in 4.49 seconds ===========================================================================
ajung@mib3:~/sandboxes/mib.portal$ bin/py.test src/mib.portal/mib/portal/tests/test_journal.py -k blog_entry_with_images
==================================================================================== test session starts =====================================================================================
platform linux2 -- Python 2.7.3 -- pytest-2.3.4
plugins: cov, flakes, pep8, cache
collected 10 items
src/mib.portal/mib/portal/tests/test_journal.py F
========================================================================================== FAILURES ==========================================================================================
from five import grok
from zope import schema
from zope.interface import implements
from plone.supermodel import model
from plone.dexterity.content import Container
from plone.app.textfield import RichText
from pp.ae import _
The version, 2.3.8, is not consistent with the requirement, 'plone.app.portlets>=2.4.0'.
While:
Installing instance.
Error: Bad version 2.3.8
Unused options for buildout: 'download-directory'.
Updating _mr.developer.
Installing instance.
While:
Installing instance.
Error: There is a version conflict.
We already have: zope.configuration 3.7.4
but z3c.unconfigure 1.1 requires 'zope.configuration>=3.8.0'.
*************** PICKED VERSIONS ****************
[versions]
{'query': {'bool': {'must': {'prefix': {u'title': u'bread'},
'range': {u'protein': {'from': '1',
'to': '2'}}}}},
'size': 15,
'sort': {'position': {'title': 'asc'}}}
ElasticHttpError: (500, u'SearchPhaseExecutionException[Failed to execute phase [query], total failure; shardFailures {[MG6BRnNeRLy8c2rLTv_TFw][food][2]: SearchParseException[[food][2]: from[-1],size[-1],sort[<custom:"position": org.elasticsearch.index.field.data.longs.LongFieldDataType$1@5512520e>]: Parse Failure [Failed to parse source [{"sort": {"position": {"title": "asc"}}, "query": {"bool": {"must": {"range": {"protein": {"to": "2", "from": "1"}}, "prefix": {"title": "bread"}}}}, "size": 15}]]]; nested: QueryParsingException[[food] [_na] query malformed, no field after start_object]; }{[MG6BRnNeRLy8c2rLTv_TFw][food][4]: SearchParseException[[food][4]: from[-1],size[-1],sort[<custom:"position": org.elasticsearch.index.field.data.longs.LongFieldDataType$1@17249
@zopyx
zopyx / gist:9432065
Created March 8, 2014 15:15
keybase.md
### Keybase proof
I hereby claim:
* I am zopyx on github.
* I am andreasjung (https://keybase.io/andreasjung) on keybase.
* I have a public key whose fingerprint is 1BA1 A581 53D5 D64C 9EF4 2F04 C2F0 707B 66ED 097A
To claim this, I am signing this object:
2014-03-25T12:13:32 WARNING Plone Deprecation Warning
The icon for the 'site_actions/sitemap' action was obtained from the action icons tool. The action icons tool has been deprecated and will be removed in Plone 5. You should register action icons directly on the action now, using the 'icon_expr' setting.
------
2014-03-25T12:13:32 WARNING Plone Deprecation Warning
The icon for the 'site_actions/accessibility' action was obtained from the action icons tool. The action icons tool has been deprecated and will be removed in Plone 5. You should register action icons directly on the action now, using the 'icon_expr' setting.
------
2014-03-25T12:13:32 WARNING Plone Deprecation Warning
The icon for the 'site_actions/contact' action was obtained from the action icons tool. The action icons tool has been deprecated and will be removed in Plone 5. You should register action icons directly on the action now, using the 'icon_expr' setting.
def linked_object_obj(self, obj):
print obj
try:
o = obj.getObject()
except Exception:
o = None
return o