<?xml version="1.0"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>CKAN: Ticket #1442: You can't GET then POST a dataset as new</title>
    <link>http://localhost/ticket/1442</link>
    <description>&lt;p&gt;
If you try to GET a dataset, purge it then POST it again, it fails checking authz for the group:
&lt;/p&gt;
&lt;pre class="wiki"&gt;Module ckan.controllers.api:278 in create
&amp;lt;&amp;lt;                  (register, subregister))
               try:
                   response_data = action(context, data_dict)
                   location = None
                   if "id" in data_dict:
&amp;gt;&amp;gt;  response_data = action(context, data_dict)
Module ckan.logic.action.create:240 in package_create_rest
&amp;lt;&amp;lt;      api = context.get('api_version') or '1'
           check_access('package_create_rest', context, data_dict)
           dictized_package = package_api_to_dict(data_dict, context)
&amp;gt;&amp;gt;  check_access('package_create_rest', context, data_dict)
Module ckan.logic:129 in check_access
&amp;lt;&amp;lt;          #    log.debug('Valid API key needed to make changes')
               #    raise NotAuthorized
               logic_authorization = new_authz.is_authorized(action, context, data_dict)
               if not logic_authorization['success']:
                   msg = logic_authorization.get('msg','')
&amp;gt;&amp;gt;  logic_authorization = new_authz.is_authorized(action, context, data_dict)
Module ckan.new_authz:16 in is_authorized
&amp;lt;&amp;lt;      auth_function = _get_auth_function(action)
           if auth_function:
               return auth_function(context, data_dict)
           else:
               raise ValueError(_('Authorization function not found: %s' % action))
&amp;gt;&amp;gt;  return auth_function(context, data_dict)
Module ckan.logic.auth.create:115 in package_create_rest
&amp;lt;&amp;lt;          return {'success': False, 'msg': _('Valid API key needed to create a package')}
           return package_create(context, data_dict)
       def group_create_rest(context, data_dict):
&amp;gt;&amp;gt;  return package_create(context, data_dict)
Module ckan.logic.auth.create:15 in package_create
&amp;lt;&amp;lt;      else:
               check2 = check_group_auth(context,data_dict)
               if not check2:
                   return {'success': False, 'msg': _('User %s not authorized to edit these groups') % str(user)}
&amp;gt;&amp;gt;  check2 = check_group_auth(context,data_dict)
Module ckan.logic.auth.create:90 in check_group_auth
&amp;lt;&amp;lt;      groups = set()
           for group_dict in group_dicts:
               id = group_dict.get('id')
               if not id:
                   continue
&amp;gt;&amp;gt;  id = group_dict.get('id')
AttributeError: 'unicode' object has no attribute 'get'
&lt;/pre&gt;&lt;p&gt;
(using RESTful Model API)
&lt;/p&gt;
&lt;p&gt;
The reason is the POST is expecting the group to be expressed as a dict, not the list of names that GET returns.
&lt;/p&gt;
</description>
    <language>en-us</language>
    <image>
      <title>CKAN</title>
      <url>http://assets.okfn.org/p/ckan/img/ckan_logo_shortname.png</url>
      <link>http://localhost/ticket/1442</link>
    </image>
    <generator>Trac 0.12.3</generator>
    <item>
      
        <dc:creator>dread</dc:creator>

      <pubDate>Wed, 02 Nov 2011 23:13:43 GMT</pubDate>
      <title>status changed; resolution set</title>
      <link>http://localhost/ticket/1442#comment:1</link>
      <guid isPermaLink="false">http://localhost/ticket/1442#comment:1</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;status&lt;/strong&gt;
                changed from &lt;em&gt;new&lt;/em&gt; to &lt;em&gt;closed&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;resolution&lt;/strong&gt;
                set to &lt;em&gt;fixed&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;p&gt;
Fixed in cset:819a74bd1c03 for release 1.5. Note release 1.5 doesn't have &lt;a class="closed ticket" href="http://localhost/ticket/1381" title="enhancement: Managing groups via package entity API (closed: fixed)"&gt;#1381&lt;/a&gt; feature, so you're not supposed to create with groups anyway, but this will be useful if people try it.
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item>
 </channel>
</rss>