我有一个奇怪的问题,我似乎无法解决.这是发生的事情:
我在github存储库中有一些我不想要的日志文件.我发现这个脚本完全从git历史中删除文件,如下所示:
#!/bin/bash
set -o errexit
# Author: David Underhill
# Script to permanently delete files/folders from your git repository. To use
# it, cd to your repository's root and then run the script with a list of paths
# you want to delete, e.g., git-delete-history path1 path2
if [ $# -eq 0 ]; then
exit 0are still
fi
# make sure we're at the root of git repo
if [ ! -d .git ]; then
echo "Error: must run …
Run Code Online (Sandbox Code Playgroud) #!/bin/bash
# Script to output the total size of requested filetype recursively
# Error out if no file types were provided
if [ $# -lt 1 ]
then
echo "Syntax Error, Please provide at least one type, ex: sizeofTypes {filetype1} {filetype2}"
exit 0
fi
#set first filetype
types="-name *."$1
#loop through additional filetypes and append
num=1
while [ $num -lt $# ]
do
(( num++ ))
types=$types' -o -name *.'$$num
done
echo "TYPES="$types
find . -name '*.'$1 | xargs du …
Run Code Online (Sandbox Code Playgroud) 我是django的新手并试图让用户身份验证正常工作.我已经设置了一个非常基本的登录表单和视图,但我收到错误:
AttributeError at /accounts/login/ 'User' object has no attribute 'user'
Run Code Online (Sandbox Code Playgroud)
我很困惑,因为我没有尝试访问User.user
我知道它必须是第一个else语句中的东西,因为经过身份验证的用户只是重定向到"/",因为它应该
是视图:
def login(request):
if request.user.is_authenticated():
return HttpResponseRedirect("/")
else:
if request.method == 'POST':
username = request.POST['username']
password = request.POST['password']
user = authenticate(username=username, password=password)
if user is not None:
if user.is_active:
login(user)
return HttpResponseRedirect("/")
return HttpResponse("There was an error logging you in")
else:
return render_to_response("registration/login.html",
context_instance=RequestContext(request))
Run Code Online (Sandbox Code Playgroud)
在views.py第15行引发错误:if request.user.is_authenticated():