这与这个问题有关,但略有不同:我不需要传递'yes'或'no',而是需要Fabric将任意字符串传递给远程shell.
例如,如果远程shell提示"你叫什么名字?" 然后我需要'先,最后'喂它.
澄清:我知道我说过任意输入,但当我尝试做一个git pull时,我真的试图将它用于SSH密钥passwd提示.
更新#1:得到了Jeff Forcier @bitprophet的回复
我有一本这样的字典:
dict_name['keyname.with.manydots']
Run Code Online (Sandbox Code Playgroud)
问题:我不能做
{{ dict_name.keyname.with.manydots }}
Run Code Online (Sandbox Code Playgroud)
我知道用 Django 的模板是不可能做到这一点的……但是你找到的最好的解决方法是什么?谢谢!
我在Intel Mac OS X 10.5上运行python 2.6
我正在尝试安装pycurl 7.16.2.1(这里推荐http://curl.haxx.se/mail/curlpython-2009-03/0009.html),但出于某种原因,安装会看到我的libcurl 7.16.3 ,但它仍然坚持我安装7.16.2或更高(7.16.3不满足?)
这是错误输出:
Running pycurl-7.16.2.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-3emZIB/pycurl-7.16.2.1/egg-dist-tmp-K10rbP
Using curl-config (libcurl 7.16.3)
src/pycurl.c:54:4:src/pycurl.c:54:4: error: #error "Need libcurl version 7.16.2 or greater to compile pycurl."
error: #error "Need libcurl version 7.16.2 or greater to compile pycurl."
Run Code Online (Sandbox Code Playgroud)
确定curl-config --version会产生libcurl 7.16.3
有什么建议?我应该升级libcurl,还是坚持使用出厂默认的lib?
==在响应==后添加更多详细信息
我有的AFAIK python是出厂默认设置(我没有从python.org获取)
Python 2.6.2 (r262:71600, Apr 16 2009, 09:17:39)
[GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin
Run Code Online (Sandbox Code Playgroud)
这是我的卷曲版本.看起来很误导,因为我使用的是英特尔Macbook,而不是PPC.
curl 7.16.3 (powerpc-apple-darwin9.0) libcurl/7.16.3 OpenSSL/0.9.7l zlib/1.2.3
Protocols: tftp ftp telnet …Run Code Online (Sandbox Code Playgroud) 在第一次 HTTP GET 期间(在重新加载守护进程模式下的 WSGI 之后),admin.site.unregister 抛出一个 NotRegistered 异常,但 admin.site.register 抛出一个 AlreadyRegistered 异常(catch-22?)但是,在随后的 HTTP GET 中,一切都加载得很好,没有错误。
设置:
设置.py:
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
#'django.contrib.sites', #(this didn't seem to make a difference)
'django.contrib.messages',
'django.contrib.staticfiles',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
'django.contrib.admindocs',
'base',
'sample',
'reports',
'south',
)
Run Code Online (Sandbox Code Playgroud)
模型.py:
from django.db import models
from django.contrib import admin
from django.contrib.auth.models import User
from django.contrib.auth.admin import …Run Code Online (Sandbox Code Playgroud) 我正在尝试官方文档中的 Django 测试装置,但我的测试类找不到assertContains。
from django.utils import unittest
from django.test import Client
class SimpleTest(unittest.TestCase):
def setUp(self):
self.client = Client()
def test_details(self):
response = self.client.post('/register',
{'username': '123',
'password': '123',
follow=True)
self.assertEqual(response.status_code, 200)
self.assertContains(response, "Logout")
self.assertNotContains(response, "Login")
Run Code Online (Sandbox Code Playgroud)