- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
Django 1.8a1
Tastypie 0.12.0
我想通过api来修补我的对象
当我尝试 curl api 时:
➜ sesame git:(migration) ✗ curl --dump-header -b cookies -v -H "X-CSRFToken: 5HA6yUXRtdf6KsHK6V52GKm1WkGWuvLh" -H "Content-Type: application/json" -X PATCH --data '{"login": "111"}' http://127.0.0.1:8000/api/v1/serviceAccountEmail/50D2CB33-1ED8-4925-B542-9CE26C961C09/
我得到了错误:
* Rebuilt URL to: cookies/
* Hostname was NOT found in DNS cache
* Could not resolve host: cookies
* Closing connection 0
curl: (6) Could not resolve host: cookies
* Hostname was NOT found in DNS cache
* Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 8000 (#1)
> PATCH /api/v1/serviceAccountEmail/50D2CB33-1ED8-4925-B542-9CE26C961C09/ HTTP/1.1
> User-Agent: curl/7.35.0
> Host: 127.0.0.1:8000
> Accept: */*
> X-CSRFToken: 5HA6yUXRtdf6KsHK6V52GKm1WkGWuvLh
> Content-Type: application/json
> Content-Length: 16
>
* upload completely sent off: 16 out of 16 bytes
* HTTP 1.0, assume close after body
HTTP/1.0 500 INTERNAL SERVER ERROR
Date: Mon, 23 Feb 2015 21:56:48 GMT
Server: WSGIServer/0.1 Python/2.7.6
X-Frame-Options: SAMEORIGIN
Content-Type: application/json
{"error_message": "'Options' object has no attribute 'module_name'", "traceback": "Traceback (most recent call last):\n\n File \"/home/andrey/repos/sesame/tastypie/resources.py\", line 204, in wrapper\n response = callback(request, *args, **kwargs)\n\n File \"/home/andrey/repos/sesame/tastypie/resources.py\", line 444, in dispatch_detail\n return self.dispatch('detail', request, **kwargs)\n\n File \"/home/andrey/repos/sesame/tastypie/resources.py\", line 467, in dispatch\n response = method(request, **kwargs)\n\n File \"/home/andrey/repos/sesame/tastypie/resources.py\", line 1626, in patch_detail\n self.update_in_place(request, bundle, deserialized)\n\n File \"/home/andrey/repos/sesame/tastypie/resources.py\", line 1649, in update_in_place\n return self.obj_update(bundle=original_bundle, **kwargs)\n\n File \"/home/andrey/repos/sesame/tastypie/resources.py\", line 2167, in obj_update\n return self.save(bundle, skip_errors=skip_errors)\n\n File \"/home/andrey/repos/sesame/tastypie/resou* Closing connection 1
rces.py\", line 2245, in save\n self.authorized_update_detail(self.get_object_list(bundle.request), bundle)\n\n File \"/home/andrey/repos/sesame/tastypie/resources.py\", line 650, in authorized_update_detail\n auth_result = self._meta.authorization.update_detail(object_list, bundle)\n\n File \"/home/andrey/repos/sesame/tastypie/authorization.py\", line 214, in update_detail\n permission = '%s.change_%s' % (klass._meta.app_label, klass._meta.module_name)\n\nAttributeError: 'Options' object has no attribute 'module_name'\n"}%
Google 无法帮助我解决这种情况
最佳答案
您需要更改您的 curl
选项:
根据 docs :
-b, --cookie <name=data>
(HTTP) Pass the data to the HTTP server as a cookie. It is supposedly the data previously received from the server in a "Set-Cookie:" line. The data should be in the format "NAME1=VALUE1; NAME2=VALUE2".
If no '=' symbol is used in the line, it is treated as a filename to use to read previously stored cookie lines from, which should be used in this session if they match. Using this method also activates the "cookie parser" which will make curl record incoming cookies too, which may be handy if you're using this in combination with the -L, --location option. The file format of the file to read cookies from should be plain HTTP headers or the Netscape/Mozilla cookie file format.
The file specified with -b, --cookie is only used as input. No cookies will be written to the file. To store cookies, use the -c, --cookie-jar option.
If this option is used several times, the last one will be used.
关于python - “选项”对象没有属性 'module_name',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28684657/
我无法编译一个极其简单的 ocaml 程序 test2.ml open Test1 print_string " Hello " test1.ml 仅包含 1 行 type program = str
Django 1.8a1 Tastypie 0.12.0 我想通过api来修补我的对象 当我尝试 curl api 时: ➜ sesame git:(migration) ✗ curl --dum
我找到了here Magento 使用这些标签作为自定义配置变量,但我仍然无法理解它们在哪里使用以及如何使用。例如,Wishlist 模块在 config.xml 文件中定义了 wishlist (与
我是一名Java程序员,我开始用Python开发一些模块。我试图用包来划分抽象层,但是不幸的是,根包(hokuspokus.py)中有一个类试图访问一些内部包 (videofactory.py) 中的
我有以下 python 调用: python -m module_name 文件结构如下: module_name __init__.py __main__.py 以前,我通过以下方式
我有一个 Maven 多模块项目。其中一个模块(编译为 .jar )仅包含域对象,这些对象将在客户端和服务器端使用(我将此 .jar 添加为我的其他模块的依赖项)。 我知道 GWT 模块,将在哪里使用
我在 Win7 上使用 Python 3.3,我对测试和 py.test 还很陌生。我有一个简单的测试要运行,尽管我可以通过调用从命令行运行它 $ python -m pytest testing.p
我想使用一个只能在远程 rpyc 服务器上访问的 python 模块。以下两种访问远程机器模块的方式有区别吗: """在客户端:""" my_local_mod_ref = my_rpyc_conne
我想实现一些类似于 django fixture 系统的东西,在 fixture 中你设置 model 属性,它指示 fixture 的模型类。看起来像这样 my_app.models.my_mode
这是我目前所拥有的: def get_concrete_name_of_class(klass): """Given a class return the concrete name of the c
我有两个 Bazel BUILD 文件: 服务器/构建 枚举/构建 我的目标是将 ts_library 从枚举导入服务器作为服务器 ts_library 的依赖项。因此,我使用了此处描述的方法:htt
我收到上述错误: 'Reloaded modules: ' 因为我想保持我的代码不变,所以我想禁用这个警告。如何才能做到这一点?我正在使用 Spyder 3.2.3。 最佳答案 转到工具 -> 首选项
我遇到这样一种情况,我在一个大型应用程序的同一个逻辑模块中有多个 VB.NET 模块。 我希望每个模块的更新函数都是公开的,但我希望用户被迫使用模块名称限定函数调用。 ModuleName.Updat
有人在 Swift 4 项目的 {Module_name}-Swift.h 文件中遇到过问题吗?我注意到 -Swift.h 自动生成的文件不能很好地与 Swift 4 语法一起使用,这与 Swift
我是一名优秀的程序员,十分优秀!