[ckan-dev] FW: WebApp Error: <type 'exceptions.KeyError'>: 'id'

Adrià Mercader adria.mercader at okfn.org
Wed Jul 2 08:58:28 UTC 2014


This is a known bug, a patch will be included in the upcoming 2.2.1
version, and if you are using an older CKAN version we can backport it as
well:

https://github.com/ckan/ckan/pull/1505

Adrià


On 2 July 2014 05:02, Nigel Babu <nigel.babu at okfn.org> wrote:

> What CKAN version is this?
>
> Nigel Babu
> Developer, Open Knowledge
>
>
> On 1 July 2014 21:20, Jeff Socia <JSocia at drcog.org> wrote:
>
>> Hello Everyone,
>>
>>
>>
>> We are getting the error below when attempting to create new users from
>> the manage/org add new member form. Does anyone have an idea as to what may
>> be causing this?
>>
>>
>>
>> *From:* support at drcog.org [mailto:support at drcog.org]
>> *Sent:* Tuesday, July 01, 2014 9:47 AM
>> *To:* Support
>> *Subject:* WebApp Error: <type 'exceptions.KeyError'>: 'id'
>>
>>
>>
>> Module ckan.controllers.group:*655* in member_new
>>
>> <<                      del data_dict['email']
>>                            user_dict = self._action('user_invite')(
>> context,
>>                                    user_data_dict)
>>                            data_dict['username'] = user_dict['name']
>>
>> >>  user_data_dict)
>>
>> Module ckan.logic:*419* in wrapped
>>
>> <<                  # check_access(action_name, context, data_dict=None)
>>                        result = _action(context, data_dict, **kw)
>>                        try:
>>                            audit = context['__auth_audit'][-1]
>>
>> >>  result = _action(context, data_dict, **kw)
>>
>> Module ckan.logic.action.create:*874* in user_invite
>>
>> <<      :rtype: dictionary
>>            '''
>>            _check_access('user_invite', context, data_dict)
>>
>>            schema = context.get('schema',
>>
>> >>  _check_access('user_invite', context, data_dict)
>>
>> Module ckan.logic:*287* in check_access
>>
>> <<      context = _prepopulate_context(context)
>>
>>            logic_authorization = new_authz.is_authorized(action, context,
>> data_dict)
>>            if not logic_authorization['success']:
>>                msg = logic_authorization.get('msg', '')
>>
>> >>  logic_authorization = new_authz.is_authorized(action, context,
>> data_dict)
>>
>> Module ckan.new_authz:*187* in is_authorized
>>
>> <<                     }
>>
>>                return auth_function(context, data_dict)
>>            else:
>>                raise ValueError(_('Authorization function not found: %s'
>> % action))
>>
>> >>  return auth_function(context, data_dict)
>>
>> Module ckan.logic.auth.create:*126* in user_invite
>>
>> <<  def user_invite(context, data_dict=None):
>>            context['id'] = context.get('group_id')
>>            return group_member_create(context, data_dict)
>>
>>        def _check_group_auth(context, data_dict):
>>
>> >>  return group_member_create(context, data_dict)
>>
>> Module ckan.logic.auth.create:*218* in group_member_create
>>
>> <<  def group_member_create(context, data_dict):
>>            return _group_or_org_member_create(context, data_dict)
>>
>>        def member_create(context, data_dict):
>>
>> >>  return _group_or_org_member_create(context, data_dict)
>>
>> Module ckan.logic.auth.create:*209* in _group_or_org_member_create
>>
>> <<  def _group_or_org_member_create(context, data_dict):
>>            user = context['user']
>>            group_id = data_dict['id']
>>            if not new_authz.has_user_permission_for_group_or_org(group_id
>> , user, 'membership'):
>>                return {'success': False, 'msg': _('User %s not
>> authorized to add members') % user}
>>
>> >>  group_id = data_dict['id']
>>
>> *KeyError: 'id'*
>>
>> *CGI Variables*
>>
>> AUTH_TYPE
>>
>> 'cookie'
>>
>> CKAN_CURRENT_URL
>>
>> '/organization/member_new/6c2f33eb-b3f1-4747-9e0a-70579e54aeb4'
>>
>> CKAN_LANG
>>
>> 'en'
>>
>> CKAN_LANG_IS_DEFAULT
>>
>> True
>>
>> CONTENT_TYPE
>>
>> 'application/x-www-form-urlencoded; charset=utf-8'
>>
>> DOCUMENT_ROOT
>>
>> '/etc/apache2/htdocs'
>>
>> GATEWAY_INTERFACE
>>
>> 'CGI/1.1'
>>
>> HTTP_ACCEPT
>>
>>
>> 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'
>>
>> HTTP_ACCEPT_ENCODING
>>
>> 'gzip,deflate,sdch'
>>
>> HTTP_ACCEPT_LANGUAGE
>>
>> 'en-US,en;q=0.8,pl;q=0.6,de;q=0.4'
>>
>> HTTP_CACHE_CONTROL
>>
>> 'max-age=0'
>>
>> HTTP_CONNECTION
>>
>> 'close'
>>
>> HTTP_COOKIE
>>
>> 'ckan=b20d95de12809abf2bc7287a8c240a9d828e72182a15a23f75c1489e9d49210db6b09a6a;
>> auth_tkt="a6b5dd3741e845a5699d96a8b0c2b9ad53b2d733pjordan-4041!userid_type:unicode";
>> auth_tkt="a6b5dd3741e845a5699d96a8b0c2b9ad53b2d733pjordan-4041!userid_type:unicode"'
>>
>> HTTP_HOST
>>
>> 'dataportal.drcog.org'
>>
>> HTTP_ORIGIN
>>
>> 'http://dataportal.drcog.org'
>>
>> HTTP_REFERER
>>
>> '
>> http://dataportal.drcog.org/organization/member_new/6c2f33eb-b3f1-4747-9e0a-70579e54aeb4
>> '
>>
>> HTTP_USER_AGENT
>>
>> 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like
>> Gecko) Chrome/35.0.1916.153 Safari/537.36'
>>
>> PATH_INFO
>>
>> '/organization/member_new/6c2f33eb-b3f1-4747-9e0a-70579e54aeb4'
>>
>> PATH_TRANSLATED
>>
>>
>> '/etc/ckan/default/apache.wsgi/organization/member_new/6c2f33eb-b3f1-4747-9e0a-70579e54aeb4'
>>
>> REMOTE_ADDR
>>
>> '127.0.0.1'
>>
>> REMOTE_PORT
>>
>> '54822'
>>
>> REMOTE_USER
>>
>> u'pjordan-4041'
>>
>> REMOTE_USER_DATA
>>
>> 'userid_type:unicode'
>>
>> REMOTE_USER_TOKENS
>>
>> ['']
>>
>> REQUEST_METHOD
>>
>> 'POST'
>>
>> REQUEST_URI
>>
>> '/organization/member_new/6c2f33eb-b3f1-4747-9e0a-70579e54aeb4'
>>
>> SCRIPT_FILENAME
>>
>> '/etc/ckan/default/apache.wsgi'
>>
>> SERVER_ADDR
>>
>> '127.0.0.1'
>>
>> SERVER_ADMIN
>>
>> '[no address given]'
>>
>> SERVER_NAME
>>
>> 'dataportal.drcog.org'
>>
>> SERVER_PORT
>>
>> '80'
>>
>> SERVER_PROTOCOL
>>
>> 'HTTP/1.0'
>>
>> SERVER_SIGNATURE
>>
>> '<address>Apache/2.2.22 (Ubuntu) Server at dataportal.drcog.org Port
>> 80</address>\n'
>>
>> SERVER_SOFTWARE
>>
>> 'Apache/2.2.22 (Ubuntu)'
>>
>>
>>
>> *WSGI Variables*
>>
>> application
>>
>> <fanstatic.publisher.Delegator object at 0x7fab9b498f10>
>>
>> beaker.cache
>>
>> <beaker.cache.CacheManager object at 0x7fab9b498c10>
>>
>> beaker.get_session
>>
>> <bound method SessionMiddleware._get_session of
>> <beaker.middleware.SessionMiddleware object at 0x7fab9b498f50>>
>>
>> beaker.session
>>
>> {'_accessed_time': 1404229641.93883, '_creation_time': 1404229287.791556}
>>
>> fanstatic.needed
>>
>> <fanstatic.core.NeededResources object at 0x7fab7c547290>
>>
>> mod_wsgi.application_group
>>
>> 'default.ckanhosted.com|'
>>
>> mod_wsgi.callable_object
>>
>> 'application'
>>
>> 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.request_handler
>>
>> 'wsgi-script'
>>
>> mod_wsgi.script_reloading
>>
>> '1'
>>
>> mod_wsgi.version
>>
>> (3, 3)
>>
>> paste.cookies
>>
>> (<SimpleCookie:
>> auth_tkt='a6b5dd3741e845a5699d96a8b0c2b9ad53b2d733pjordan-4041!userid_type:unicode'
>> ckan='b20d95de12809abf2bc7287a8c240a9d828e72182a15a23f75c1489e9d49210db6b09a6a'>,
>> 'ckan=b20d95de12809abf2bc7287a8c240a9d828e72182a15a23f75c1489e9d49210db6b09a6a;
>> auth_tkt="a6b5dd3741e845a5699d96a8b0c2b9ad53b2d733pjordan-4041!userid_type:unicode";
>> auth_tkt="a6b5dd3741e845a5699d96a8b0c2b9ad53b2d733pjordan-4041!userid_type:unicode"')
>>
>> paste.registry
>>
>> <paste.registry.Registry object at 0x7fab7d310ad0>
>>
>> paste.throw_errors
>>
>> True
>>
>> pylons.action_method
>>
>> <bound method OrganizationController.member_new of
>> <ckan.controllers.organization.OrganizationController object at
>> 0x7fab7c547b90>>
>>
>> pylons.controller
>>
>> <ckan.controllers.organization.OrganizationController object at
>> 0x7fab7c547b90>
>>
>> pylons.environ_config
>>
>> {'session': 'beaker.session', 'cache': 'beaker.cache'}
>>
>> pylons.pylons
>>
>> <pylons.util.PylonsContext object at 0x7fab7c547690>
>>
>> pylons.routes_dict
>>
>> {'action': u'member_new', 'controller': u'organization', 'id':
>> u'6c2f33eb-b3f1-4747-9e0a-70579e54aeb4'}
>>
>> repoze.who.identity
>>
>> <repoze.who identity (hidden, dict-like) at 140374380523440>
>>
>> repoze.who.logger
>>
>> <logging.Logger object at 0x7fab9b51c7d0>
>>
>> repoze.who.plugins
>>
>> {'openid': <OpenIdIdentificationPlugin 140375021962512>, 'friendlyform':
>> <FriendlyFormPlugin 140375021424336>,
>> 'ckan.lib.authenticator:UsernamePasswordAuthenticator':
>> <ckan.lib.authenticator.UsernamePasswordAuthenticator object at
>> 0x7fab9b87ef10>, 'auth_tkt': <AuthTktCookiePlugin 140375021422224>,
>> 'ckan.lib.authenticator:OpenIDAuthenticator':
>> <ckan.lib.authenticator.OpenIDAuthenticator object at 0x7fab9b87eed0>}
>>
>> routes.route
>>
>> <routes.route.Route object at 0x7fab9af22690>
>>
>> routes.url
>>
>> <routes.util.URLGenerator object at 0x7fab7c547990>
>>
>> webob._parsed_post_vars
>>
>> (MultiDict([('username', ''), ('email', 'WSoper at drcog.org'), ('role',
>> 'editor'), ('submit', '')]), <FakeCGIBody at 0x7fab7c547f10 viewing
>> MultiDict([('us...'')])>)
>>
>> webob._parsed_query_vars
>>
>> (GET([]), '')
>>
>> webob.adhoc_attrs
>>
>> {'errors': 'ignore', 'response': <Response at 0x7fab7c547850 200 OK>,
>> 'language': 'en-us'}
>>
>> webob.is_body_readable
>>
>> True
>>
>> webob.is_body_seekable
>>
>> False
>>
>> wsgi process
>>
>> 'Multi process AND threads (?)'
>>
>> wsgi.file_wrapper
>>
>> <built-in method file_wrapper of mod_wsgi.Adapter object at
>> 0x7fab7e12f990>
>>
>> wsgi.version
>>
>> (1, 1)
>>
>> wsgiorg.routing_args
>>
>> (<routes.util.URLGenerator object at 0x7fab7c547990>, {'action':
>> u'member_new', 'controller': u'organization', 'id':
>> u'6c2f33eb-b3f1-4747-9e0a-70579e54aeb4'})
>>
>>
>>
>> _______________________________________________
>> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20140702/a5cf9916/attachment-0003.html>


More information about the ckan-dev mailing list