[ckan-dev] Continuous error: ckan.logic.ValidationError: None - {'offset': [u'Invalid integer']} - SOLVED (?)

Stefan Oderbolz stefan.oderbolz at liip.ch
Mon Nov 28 11:00:04 UTC 2016


Hi Lucia,

I guess just laziness ;)
Usually these mails are no big deal, it's more a warning than an actually
error. I mean nothing really bad happens, and it's usually just an idicator
of a bad practice, just like you discovered now. The more these are fixed,
the better.

- Stefan

On Fri, Nov 25, 2016 at 1:32 PM, <lucia.espona at wsl.ch> wrote:

> Dear Stefan
>
> I addition to fixing the URL in the config I also modified the
> ckan/config/routing.py so that the offset has to be a digit.
> This way I do not get a server error every time a wrong url is requested
> for any reason.
> A regexp was added to all the url's where an offset is required. For
> example:
>
> m.connect('/dataset/activity/{id}/*{offset:\d*}*', action='activity')
>
> Is there any reason why this filtering was not being done?
>
> Best
> Lucia
>
> _________________________________________________________
> Dr. Lucia Espona Pernas
>
> Swiss Federal Institute for Forest, Snow and Landscape Research WSL
> Hauptgebäaude Labortrakt (HL C21)
> Zürcherstrasse 111
> 8903 Birmensdorf
> Switzerland
>
> +41 44 739 28 71 phone direct
> +41 44 739 21 11 reception
>
> www.wsl.ch
>
> -----"ckan-dev" <ckan-dev-bounces at lists.okfn.org> wrote: -----
> To: CKAN Development Discussions <ckan-dev at lists.okfn.org>
> From: lucia.espona at wsl.ch
> Sent by: "ckan-dev"
> Date: 25.11.2016 12:05
> Subject: Re: [ckan-dev] Continuous error: ckan.logic.ValidationError: None
> - {'offset': [u'Invalid integer']} - SOLVED
>
> Dear Stefan
>
> Thanks a lot for looking so much into that, it is really nice of you.
>
> I am surprised about what happens because I haven't done any modification
> to the activity stream related templates.
> In addition, in the development instance I never get such an error.
>
> To achieve what you propose, I changed in the configuration the value of
> the favicon to contain the full URL:
>
> #ckan.favicon = envidat-logo-icon.ico
> ckan.favicon = http://www.envidat.ch/envidat-logo-icon.ico
>
> Now the links are properly created:
>
> <link rel="shortcut icon" href="http://www.envidat.ch/
> envidat-logo-icon.ico">
>
> I haven't got the error again so I assume that was triggering the
> ValidationErrors as you said.
>
> Best,
> Lucia
>
>
> _________________________________________________________
> Dr. Lucia Espona Pernas
>
> Swiss Federal Institute for Forest, Snow and Landscape Research WSL
> Hauptgebäaude Labortrakt (HL C21)
> Zürcherstrasse 111
> 8903 Birmensdorf
> Switzerland
>
> +41 44 739 28 71 phone direct
> +41 44 739 21 11 reception
>
> www.wsl.ch
>
> -----"ckan-dev" <ckan-dev-bounces at lists.okfn.org> wrote: -----
> To: CKAN Development Discussions <ckan-dev at lists.okfn.org>
> From: Stefan Oderbolz
> Sent by: "ckan-dev"
> Date: 24.11.2016 17:14
> Subject: Re: [ckan-dev] Continuous error: ckan.logic.ValidationError: None
> - {'offset': [u'Invalid integer']}
>
> Hi Lucia,
>
> this is an interesting case:
> if you look at the error mail you see the CKAN_CURRENT_URL: /
> organization/activity/cryos/envidat-logo-icon.ico
> The envidat-logo-icon.ico indicates that it is probably the favicon, and a
> quick look on envidat.ch confirms that.
>
> Now the error you get is cause by the activity stream of an organisation
> page, in your case it's this one: http://www.envidat.ch/
> organization/activity/cryos/0
> The "0" at the end is the "offset" parameter, which is used if you want to
> load multiple pages of the activity stream, by default the first page is
> loaded.
>
> You are loading the favicon like that on every page (including the
> activity stream):
> <link rel="shortcut icon" href="envidat-logo-icon.ico" />
>
> This is a relative URL and causes every visitor of the activity stream to
> load the following URL:
> http://www.envidat.ch/organization/activity/cryos/envidat-logo-icon.ico
>
> CKAN then tries to load a page with the offset "envidat-logo-icon.ico",
> which of course is not a valid integer offset.
>
> To fix this, you should change the favicon HTML to this:
> <link rel="shortcut icon" href="https://webnotes.wsl.ch/
> envidat-logo-icon.ico" />
>
> Best Regards Stefan
>
> On Thu, Nov 24, 2016 at 4:41 PM, <lucia.espona at wsl.ch> wrote:
>
>> Dear all
>>
>> I since I did a production deploy of CKAN 2.5.2, I get a ValidationError
>> continuously regarding "offset".
>> Here the error:
>>
>> Module ckan.controllers.group:864 in activity
>> >>  context, {'id': c.group_dict['id'], 'offset': offset})
>> Module ckan.logic:416 in wrapped
>> >>  result = _action(context, data_dict, **kw)
>> Module ckan.logic.action.get:2831 in organization_activity_list_html
>> >>  activity_stream = organization_activity_list(context, data_dict)
>> Module ckan.logic:501 in wrapper
>> >>  raise ValidationError(errors)
>> ValidationError: None - {'offset': [u'Invalid integer']}
>>
>> Sometimes I get different values for offset thet look complete non sense
>> with the same error. The mail from the server with the details is pasted
>> below.
>> Does anyone have an idea where it comes from?
>>
>> Thanks a lot,
>> Lucia
>>
>> Subject: WebApp Error: <class 'ckan.logic.ValidationError'>: None -
>> {'offset': [u'Invalid integer']}
>>
>> Module ckan.controllers.group:*864* in activity
>> <<  <#m_-638136305892645238_m_-8868029688847739231_>        # template
>> context for the group/read.html template to retrieve later.
>>                c.group_activity_stream = self._action('group_activity_l
>> ist_html')(
>>                    context, {'id': c.group_dict['id'], 'offset': offset})
>>
>>                return render(self._activity_template(group_type),
>> >>  <#m_-638136305892645238_m_-8868029688847739231_>context, {'id': c.
>> group_dict['id'], 'offset': offset})
>> Module ckan.logic:*416* in wrapped
>> <<  <#m_-638136305892645238_m_-8868029688847739231_>                #
>> check_access(action_name, context, data_dict=None)
>>                        result = _action(context, data_dict, **kw)
>>                        try:
>>                            audit = context['__auth_audit'][-1]
>> >>  <#m_-638136305892645238_m_-8868029688847739231_>result = _action(
>> context, data_dict, **kw)
>> Module ckan.logic.action.get:*2831* in organization_activity_list_html
>> <<  <#m_-638136305892645238_m_-8868029688847739231_>    '''
>>            activity_stream = organization_activity_list(context,
>> data_dict)
>>            offset = int(data_dict.get('offset', 0))
>>            extra_vars = {
>> >>  <#m_-638136305892645238_m_-8868029688847739231_>activity_stream =
>> organization_activity_list(context, data_dict)
>> Module ckan.logic:*501* in wrapper
>> <<  <#m_-638136305892645238_m_-8868029688847739231_>            data_dict
>> , errors = _validate(data_dict, schema, context)
>>                    if errors:
>>                        raise ValidationError(errors)
>>                    return action(context, data_dict)
>>                return wrapper
>> >>  <#m_-638136305892645238_m_-8868029688847739231_>raise ValidationError
>> (errors)
>> *ValidationError: None - {'offset': [u'Invalid integer']}*
>> CGI Variables
>> AUTH_TYPE 'cookie'
>> CKAN_CURRENT_URL '/organization/activity/cryos/envidat-logo-icon.ico'
>> CKAN_LANG 'en'
>> CKAN_LANG_IS_DEFAULT True
>> CONTENT_TYPE '; charset=utf-8'
>> CONTEXT_DOCUMENT_ROOT '/var/www/html'
>> DOCUMENT_ROOT '/var/www/html'
>> GATEWAY_INTERFACE 'CGI/1.1'
>> HTTP_ACCEPT 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q
>> =0.8'
>> HTTP_ACCEPT_ENCODING 'gzip, deflate'
>> HTTP_ACCEPT_LANGUAGE 'en-GB,en;q=0.5'
>> HTTP_CONNECTION 'close'
>> HTTP_COOKIE 'auth_tkt="!userid_type:unicode";
>> auth_tkt="!userid_type:unicode"'
>> HTTP_HOST 'www.envidat.ch'
>> HTTP_USER_AGENT 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:50.0)
>> Gecko/20100101 Firefox/50.0'
>> HTTP_X_FORWARDED_FOR '193.134.202.20'
>> HTTP_X_FORWARDED_HOST 'www.envidat.ch'
>> HTTP_X_FORWARDED_SERVER 'www.envidat.ch'
>> PATH_INFO '/organization/activity/cryos/envidat-logo-icon.ico'
>> PATH_TRANSLATED '/etc/ckan/default/apache.wsgi
>> /organization/activity/cryos/envidat-logo-icon.ico'
>> REMOTE_ADDR '127.0.0.1'
>> REMOTE_PORT '50136'
>> REMOTE_USER u'admin'
>> REMOTE_USER_DATA 'userid_type:unicode'
>> REMOTE_USER_TOKENS ['']
>> REQUEST_METHOD 'GET'
>> REQUEST_SCHEME 'http'
>> REQUEST_URI '/organization/activity/cryos/envidat-logo-icon.ico'
>> SCRIPT_FILENAME '/etc/ckan/default/apache.wsgi'
>> SERVER_ADDR '127.0.0.1'
>> SERVER_ADMIN '[no address given]'
>> SERVER_NAME 'www.envidat.ch'
>> SERVER_PORT '80'
>> SERVER_PROTOCOL 'HTTP/1.0'
>> SERVER_SIGNATURE '<address>Apache/2.4.18 (Ubuntu) Server at
>> www.envidat.ch Port 80</address>\n'
>> SERVER_SOFTWARE 'Apache/2.4.18 (Ubuntu)'
>> WSGI Variables
>> apache.version (2, 4, 18)
>> application <fanstatic.publisher.Delegator object at 0x7f8aa3a68490>
>> beaker.cache <beaker.cache.CacheManager object at 0x7f8aa3a68550>
>> beaker.get_session <bound method SessionMiddleware._get_session of
>> <beaker.middleware.SessionMiddleware object at 0x7f8aa3a65a90>>
>> beaker.session {'_accessed_time': 1479995919.195716, '_creation_time':
>> 1479995919.195716}
>> fanstatic.needed <fanstatic.core.NeededResources object at
>> 0x7f8aa1a05c10>
>> mod_wsgi.application_group 'envidat03.wsl.ch|'
>> mod_wsgi.callable_object 'application'
>> mod_wsgi.daemon_connects '1'
>> mod_wsgi.daemon_restarts '0'
>> mod_wsgi.daemon_start '1479995919070143'
>> mod_wsgi.enable_sendfile '0'
>> mod_wsgi.handler_script ''
>> mod_wsgi.input_chunked '0'
>> mod_wsgi.listener_host ''
>> mod_wsgi.listener_port '8080'
>> mod_wsgi.process_group 'ckan_default'
>> mod_wsgi.queue_start '1479995919069985'
>> mod_wsgi.request_handler 'wsgi-script'
>> mod_wsgi.request_start '1479995919068370'
>> mod_wsgi.script_reloading '1'
>> mod_wsgi.script_start '1479995919070178'
>> mod_wsgi.version (4, 3, 0)
>> paste.cookies
>> paste.registry <paste.registry.Registry object at 0x7f8aa1bb5090>
>> paste.throw_errors True
>> pylons.action_method <bound method OrganizationController.activity of
>> <ckan.controllers.organization.OrganizationController object at
>> 0x7f8aa181cad0>>
>> pylons.controller <ckan.controllers.organization.OrganizationController
>> object at 0x7f8aa181cad0>
>> pylons.environ_config {'session': 'beaker.session', 'cache':
>> 'beaker.cache'}
>> pylons.pylons <pylons.util.PylonsContext object at 0x7f8aa181c3d0>
>> pylons.routes_dict {'action': u'activity', 'controller':
>> u'organization', 'id': u'cryos', 'offset': u'envidat-logo-icon.ico'}
>> repoze.who.api <repoze.who.api.API object at 0x7f8aa1bb5410>
>> repoze.who.identity <repoze.who identity (hidden, dict-like) at
>> 140233395059384>
>> repoze.who.logger <logging.Logger object at 0x7f8aa3a68750>
>> repoze.who.plugins
>> routes.route <routes.route.Route object at 0x7f8aa457cf10>
>> routes.url <routes.util.URLGenerator object at 0x7f8aa1a05510>
>> webob._parsed_query_vars (GET([]), '')
>> webob.adhoc_attrs {'response': <Response at 0x7f8aa1a05f50 200 OK>,
>> 'language': 'en-us'}
>> wsgi process 'Multi process AND threads (?)'
>> wsgi.file_wrapper <type 'mod_wsgi.FileWrapper'>
>> wsgiorg.routing_args (<routes.util.URLGenerator object at
>> 0x7f8aa1a05510>, {'action': u'activity', 'controller': u'organization',
>> 'id': u'cryos', 'offset': u'envidat-logo-icon.ico'})
>>
>> _______________________________________________
>> ckan-dev mailing list
>> ckan-dev at lists.okfn.org
>> https://lists.okfn.org/mailman/listinfo/ckan-dev
>> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>>
>>
>
>
> --
> Liip AG  // Limmatstrasse 183 //  CH-8005 Zürich
> Tel +41 43 500 39 80 // GnuPG 0x7B588C67 // www.liip.ch
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>
>


-- 
Liip AG  // Limmatstrasse 183 //  CH-8005 Zürich
Tel +41 43 500 39 80 // GnuPG 0x7B588C67 // www.liip.ch
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20161128/7679db58/attachment-0003.html>


More information about the ckan-dev mailing list