Problem with gaesessions (django+GAE) - python

I'm using gaesessions on gae with django. When I run the application Following error occurs while loading gaesessions.DjangoSessionMiddleware.
Traceback (most recent call last):
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 4053, in _HandleRequest
self._Dispatch(dispatcher, self.rfile, outfile, env_dict)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 3977, in _Dispatch
base_env_dict=env_dict)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 588, in Dispatch
base_env_dict=base_env_dict)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 3050, in Dispatch
self._module_dict)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2954, in ExecuteCGI
reset_modules = exec_script(handler_path, cgi_path, hook)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2836, in ExecuteOrImportScript
script_module.main()
File "D:\projects\tutorial\selftutor.py", line 35, in main
util.run_wsgi_app(application)
File "C:\Program Files\Google\google_appengine\google\appengine\ext\webapp\util.py", line 98, in run_wsgi_app
run_bare_wsgi_app(add_wsgi_middleware(application))
File "C:\Program Files\Google\google_appengine\google\appengine\ext\webapp\util.py", line 116, in run_bare_wsgi_app
result = application(env, _start_response)
File "C:\Program Files\Google\google_appengine\lib\django_1_2\django\core\handlers\wsgi.py", line 252, in __call__
response = middleware_method(request, response)
File "D:\projects\tutorial\gaesessions\__init__.py", line 493, in process_response
patch_vary_headers(response, ('Cookie',))
File "C:\Program Files\Google\google_appengine\lib\django_1_2\django\utils\cache.py", line 127, in patch_vary_headers
if response.has_header('Vary'):
AttributeError: 'NoneType' object has no attribute 'has_header'
Please help me on this.

The middleware does not get handed a response. Check your request handler.

Related

DataError 'invalid syntax for type timestamp' - Odoo v8

I'm trying to load, all sale.order objects on draft state, and also trying to filter all these drafts by dates, so far, this is what I have:
#api.multi
#api.depends('sale_order')
def _compute_amount_total(self):
draft_orders = self.env['sale.order'].search([('state', '=', 'draft'),('date_order','<=', time.strftime('%%Y-12-31')),('date_order','>=',time.strftime('%%Y-09-01'))])
amount_total = sum(draft_orders.mapped('amount_total'))
for record in self:
record.amount_total = amount_total
But when I try to access this on my view, this is the error i get:
2017-08-26 23:34:35,292 4868 ERROR bsi_def openerp.http: Exception during JSON request handling.
Traceback (most recent call last):
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\http.py", line 546, in _handle_exception
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\http.py", line 583, in dispatch
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\http.py", line 319, in _call_function
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\service\model.py", line 118, in wrapper
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\http.py", line 316, in checked_call
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\http.py", line 812, in __call__
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\http.py", line 412, in response_wrap
File "C:\Program Files\Odoo 8.0-20170809\server\openerp\addons\web\controllers\main.py", line 944, in call_kw
File "C:\Program Files\Odoo 8.0-20170809\server\openerp\addons\web\controllers\main.py", line 936, in _call_kw
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\api.py", line 268, in wrapper
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\api.py", line 399, in old_api
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\models.py", line 5955, in onchange
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\models.py", line 5657, in __getitem__
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\fields.py", line 838, in __get__
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\fields.py", line 946, in determine_draft_value
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\fields.py", line 885, in _compute_value
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\api.py", line 266, in wrapper
File "C:\Program Files\Odoo 8.0-20170809\server\openerp\addons\account_budget_extended\models\models.py", line 170, in _compute_amount_total
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\api.py", line 266, in wrapper
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\api.py", line 508, in new_api
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\models.py", line 1650, in search
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\api.py", line 268, in wrapper
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\models.py", line 4708, in _search
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\sql_db.py", line 171, in wrapper
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\sql_db.py", line 247, in execute
DataError: la sintaxis de entrada no es válida para tipo timestamp: «%Y-12-31»
LINE 1: ...e" = 'draft') AND ("sale_order"."date_order" <= '%Y-12-31'...
I think is Postgres related, but I'm not sure how to declare a domain filter of date type on Odoo's orm.
The draft domain works perfectly, I think the domain concatenation is also fine, there must be something with the date domain.
Any ideas?
Doubling the percent sign escapes it. If you want to use it as part of a format specifier then you must only have one.

ValueError: RSA key format is not supported

trying to use big query on google app engine python. I am trying to achieve this using a this client library . I have imported every necessary library and somehow running the snippet below
from bigquery import get_client
# BigQuery project id as listed in the Google Developers Console.
project_id = 'project_id'
# Service account email address as listed in the Google Developers Console.
service_account = 'my_id_123#developer.gserviceaccount.com'
# PKCS12 or PEM key provided by Google.
key = 'key.pem'
client = get_client(project_id, service_account=service_account,
private_key_file=key, readonly=True)
and still get the error:
2015-10-26 19:08:37 Running command: "['C:\\Python27\\pythonw.exe', 'C:\\Program Files (x86)\\Google\\google_appengine\\dev_appserver.py', '--skip_sdk_update_check=yes', '--port=19090', '--admin_port=9010', 'C:\\Users\\CrowdStar\\workspace\\AppEngineThinkStudio\\TrafficTestCase']"
INFO 2015-10-26 19:08:39,540 devappserver2.py:726] Skipping SDK update check.
INFO 2015-10-26 19:08:39,634 api_server.py:172] Starting API server at: http://localhost:61626
INFO 2015-10-26 19:08:39,634 dispatcher.py:186] Starting module "default" running at: http://localhost:19090
INFO 2015-10-26 19:08:39,651 admin_server.py:118] Starting admin server at: http://localhost:9010
INFO 2015-10-26 18:08:44,361 discovery.py:240] URL being requested: GET https://www.googleapis.com/discovery/v1/apis/bigquery/v2/rest?userIp=%3A%3A1
INFO 2015-10-26 18:08:44,361 client.py:563] Attempting refresh to obtain initial access_token
ERROR 2015-10-26 18:08:44,365 webapp2.py:1528] RSA key format is not supported
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 1511, in __call__
rv = self.handle_exception(request, response, e)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 1505, in __call__
rv = self.router.dispatch(request, response)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 1253, in default_dispatcher
return route.handler_adapter(request, response)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 1077, in __call__
return handler.dispatch()
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 547, in dispatch
return self.handle_exception(e, self.app.debug)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 545, in dispatch
return method(*args, **kwargs)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\main.py", line 72, in get
private_key_file=key, readonly=True)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\bigquery\client.py", line 83, in get_client
readonly=readonly)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\bigquery\client.py", line 101, in _get_bq_service
service = build('bigquery', 'v2', http=http)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\util.py", line 142, in positional_wrapper
return wrapped(*args, **kwargs)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\googleapiclient\discovery.py", line 196, in build
cache)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\googleapiclient\discovery.py", line 242, in _retrieve_discovery_doc
resp, content = http.request(actual_url)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\client.py", line 565, in new_request
self._refresh(request_orig)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\client.py", line 835, in _refresh
self._do_refresh_request(http_request)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\client.py", line 862, in _do_refresh_request
body = self._generate_refresh_request_body()
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\client.py", line 1541, in _generate_refresh_request_body
assertion = self._generate_assertion()
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\client.py", line 1670, in _generate_assertion
private_key, self.private_key_password), payload)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\_pycrypto_crypt.py", line 121, in from_string
pkey = RSA.importKey(parsed_pem_key)
File "C:\Python27\lib\site-packages\pycrypto-2.6.1-py2.7-win32.egg\Crypto\PublicKey\RSA.py", line 665, in importKey
return self._importKeyDER(der)
File "C:\Python27\lib\site-packages\pycrypto-2.6.1-py2.7-win32.egg\Crypto\PublicKey\RSA.py", line 588, in _importKeyDER
raise ValueError("RSA key format is not supported")
ValueError: RSA key format is not supported
ERROR 2015-10-26 18:08:44,372 wsgi.py:279]
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 267, in Handle
result = handler(dict(self._environ), self._StartResponse)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 1519, in __call__
response = self._internal_error(e)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 1511, in __call__
rv = self.handle_exception(request, response, e)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 1505, in __call__
rv = self.router.dispatch(request, response)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 1253, in default_dispatcher
return route.handler_adapter(request, response)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 1077, in __call__
return handler.dispatch()
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 547, in dispatch
return self.handle_exception(e, self.app.debug)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 545, in dispatch
return method(*args, **kwargs)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\main.py", line 72, in get
private_key_file=key, readonly=True)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\bigquery\client.py", line 83, in get_client
readonly=readonly)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\bigquery\client.py", line 101, in _get_bq_service
service = build('bigquery', 'v2', http=http)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\util.py", line 142, in positional_wrapper
return wrapped(*args, **kwargs)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\googleapiclient\discovery.py", line 196, in build
cache)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\googleapiclient\discovery.py", line 242, in _retrieve_discovery_doc
resp, content = http.request(actual_url)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\client.py", line 565, in new_request
self._refresh(request_orig)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\client.py", line 835, in _refresh
self._do_refresh_request(http_request)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\client.py", line 862, in _do_refresh_request
body = self._generate_refresh_request_body()
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\client.py", line 1541, in _generate_refresh_request_body
assertion = self._generate_assertion()
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\client.py", line 1670, in _generate_assertion
private_key, self.private_key_password), payload)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\_pycrypto_crypt.py", line 121, in from_string
pkey = RSA.importKey(parsed_pem_key)
File "C:\Python27\lib\site-packages\pycrypto-2.6.1-py2.7-win32.egg\Crypto\PublicKey\RSA.py", line 665, in importKey
return self._importKeyDER(der)
File "C:\Python27\lib\site-packages\pycrypto-2.6.1-py2.7-win32.egg\Crypto\PublicKey\RSA.py", line 588, in _importKeyDER
raise ValueError("RSA key format is not supported")
ValueError: RSA key format is not supported
INFO 2015-10-26 19:08:44,404 module.py:737] default: "GET / HTTP/1.1" 500 -

Deployment error on Google App engine launcher for python application

I am trying to deploy a python application on google app engine using google app engine launcher.
The Project ID is same as my application name is app.yaml file
But still I am getting the following error in log.
appcfg.py:2450 An error occurred processing file '': EOF occurred in violation of protocol (_ssl.c:581). Aborting.
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\appcfg.py", line 133, in <module>
run_file(__file__, globals())
File "C:\Program Files (x86)\Google\google_appengine\appcfg.py", line 129, in run_file
execfile(_PATHS.script_file(script_name), globals_)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 5509, in <module>
main(sys.argv)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 5500, in main
result = AppCfgApp(argv).Run()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 3019, in Run
self.action(self)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 5156, in __call__
return method()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 3878, in Update
self._UpdateWithParsedAppYaml(appyaml, self.basepath)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 3931, in _UpdateWithParsedAppYaml
self.UpdateVersion(rpcserver, basepath, appyaml, APP_YAML_FILENAME)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 3816, in UpdateVersion
return appversion.DoUpload(paths, openfunc)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 2440, in DoUpload
self.error_fh)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 494, in GetResourceLimits
resource_limits.update(_GetRemoteResourceLimits(logging_context))
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 464, in _GetRemoteResourceLimits
yaml_data = logging_context.Send('/api/appversion/getresourcelimits')
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 1750, in Send
result = self.rpcserver.Send(url, payload=payload, **kwargs)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appengine_rpc_httplib2.py", line 236, in Send
url, method=method, body=payload, headers=headers)
File "C:\Program Files (x86)\Google\google_appengine\lib\httplib2\httplib2\__init__.py", line 1584, in request
(response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
File "C:\Program Files (x86)\Google\google_appengine\lib\httplib2\httplib2\__init__.py", line 1332, in _request
(response, content) = self._conn_request(conn, request_uri, method, body, headers)
File "C:\Program Files (x86)\Google\google_appengine\lib\httplib2\httplib2\__init__.py", line 1268, in _conn_request
conn.connect()
File "C:\Program Files (x86)\Google\google_appengine\lib\httplib2\httplib2\__init__.py", line 1014, in connect
self.disable_ssl_certificate_validation, self.ca_certs)
File "C:\Program Files (x86)\Google\google_appengine\lib\httplib2\httplib2\__init__.py", line 80, in _ssl_wrap_socket
cert_reqs=cert_reqs, ca_certs=ca_certs)
File "C:\Python27\lib\ssl.py", line 891, in wrap_socket
ciphers=ciphers)
File "C:\Python27\lib\ssl.py", line 566, in __init__
self.do_handshake()
File "C:\Python27\lib\ssl.py", line 788, in do_handshake
self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:581)
2015-07-13 14:35:47 (Process exited with code 1)

Bad Image Error by Google App engine

My problem when trying to resize an image using the image class in google app engine.
The error is displayed below. This happens for every type of image including .jpg,.png,etc
Internal Server Error
The server has either erred or is incapable of performing the requested operation.
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 1535, in __call__
rv = self.handle_exception(request, response, e)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 1529, in __call__
rv = self.router.dispatch(request, response)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 1278, in default_dispatcher
return route.handler_adapter(request, response)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 1102, in __call__
return handler.dispatch()
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 572, in dispatch
return self.handle_exception(e, self.app.debug)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 570, in dispatch
return method(*args, **kwargs)
File "C:\Users\prudhvir\Desktop\projectbyprudhviraj\main.py", line 252, in post
avatar = images.resize(user_dp, 32, 32)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\images\__init__.py", line 1095, in resize
return rpc.get_result()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\apiproxy_stub_map.py", line 612, in get_result
return self.__get_result_hook(self)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\images\__init__.py", line 886, in execute_transforms_hook
raise _ToImagesError(e, self._blob_key)
BadImageError

Error accessing dashboard or admin interface in Google App Engine

I am unable to access dashboard/admin interface of Google app engine on local development environment which could be access using localhost:8000/_ah/admin/.
It throws following error:
Traceback (most recent call last):
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2726, in _HandleRequest
self._Dispatch(dispatcher, self.rfile, outfile, env_dict)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2611, in _Dispatch
base_env_dict=env_dict)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 653, in Dispatch
base_env_dict=base_env_dict)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1675, in Dispatch
self._module_dict)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1575, in ExecuteCGI
reset_modules = exec_script(config, handler_path, cgi_path, hook)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1277, in ExecuteOrImportScript
exec module_code in script_module.__dict__
File "C:\Program Files\Google\google_appengine\google\appengine\ext\admin\__init__.py", line 94, in <module>
class _AhAdminXsrfToken_(db.Model):
File "C:\Projects_2013_05_14\retail\common\appenginepatch\appenginepatcher\patch.py", line 539, in __init__
_initialize_model(cls, bases)
File "C:\Projects_2013_05_14\retail\common\appenginepatch\appenginepatcher\patch.py", line 523, in _initialize_model
cls._meta = _meta(cls, bases)
File "C:\Projects_2013_05_14\retail\common\appenginepatch\appenginepatcher\patch.py", line 246, in __init__
raise ValueError('Django expects models (here: %s.%s) to be defined in their own apps!' % (model.__module__, model.__name__))
ValueError: Django expects models (here: __main__._AhAdminXsrfToken_) to be defined in their own apps!
My development environment is as follows.
Google App Engine 1.6.1
Python 2.5
Google app engine patch for Django 1.1
I am unable to understand what is going wrong over here.
Appreciate your help.

Categories