mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-16 07:08:55 +00:00
Add index to groupmessage and fix typo.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
|
|
||||||
class UuidOjbidMap(models.Model):
|
class UuidObjidMap(models.Model):
|
||||||
"""
|
"""
|
||||||
Model used for store crocdoc uuid and file object id mapping.
|
Model used for store crocdoc uuid and file object id mapping.
|
||||||
"""
|
"""
|
||||||
|
@@ -99,7 +99,7 @@ def contact_edit(request):
|
|||||||
contact = Contact.objects.get(user_email=user_email,
|
contact = Contact.objects.get(user_email=user_email,
|
||||||
contact_email=contact_email)
|
contact_email=contact_email)
|
||||||
except Contact.DoesNotExist:
|
except Contact.DoesNotExist:
|
||||||
return go_error(request, '用户不存在')
|
return go_error(request, '联系人不存在')
|
||||||
else:
|
else:
|
||||||
contact.contact_name = contact_name
|
contact.contact_name = contact_name
|
||||||
contact.note = note
|
contact.note = note
|
||||||
@@ -110,7 +110,7 @@ def contact_edit(request):
|
|||||||
c = Contact.objects.filter(user_email=request.user.username,
|
c = Contact.objects.filter(user_email=request.user.username,
|
||||||
contact_email=contact_email)
|
contact_email=contact_email)
|
||||||
if not c:
|
if not c:
|
||||||
return go_error(request, '用户不存在')
|
return go_error(request, '联系人不存在')
|
||||||
else:
|
else:
|
||||||
init_data = {'user_email':request.user.username,
|
init_data = {'user_email':request.user.username,
|
||||||
'contact_email':contact_email,
|
'contact_email':contact_email,
|
||||||
|
@@ -4,7 +4,7 @@ import os
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
class GroupMessage(models.Model):
|
class GroupMessage(models.Model):
|
||||||
group_id = models.IntegerField()
|
group_id = models.IntegerField(db_index=True)
|
||||||
from_email = models.EmailField()
|
from_email = models.EmailField()
|
||||||
message = models.CharField(max_length=500)
|
message = models.CharField(max_length=500)
|
||||||
timestamp = models.DateTimeField(default=datetime.datetime.now)
|
timestamp = models.DateTimeField(default=datetime.datetime.now)
|
||||||
|
12
views.py
12
views.py
@@ -35,7 +35,7 @@ from seaserv import ccnet_rpc, ccnet_threaded_rpc, get_repos, get_emailusers, \
|
|||||||
from pysearpc import SearpcError
|
from pysearpc import SearpcError
|
||||||
|
|
||||||
from seahub.base.accounts import CcnetUser
|
from seahub.base.accounts import CcnetUser
|
||||||
from seahub.base.models import UuidOjbidMap
|
from seahub.base.models import UuidObjidMap
|
||||||
from seahub.contacts.models import Contact
|
from seahub.contacts.models import Contact
|
||||||
from seahub.notifications.models import UserNotification
|
from seahub.notifications.models import UserNotification
|
||||||
from seahub.organizations.utils import clear_org_ctx, access_org_repo
|
from seahub.organizations.utils import clear_org_ctx, access_org_repo
|
||||||
@@ -1887,8 +1887,8 @@ def crocodoc_upload(request):
|
|||||||
data = json.dumps([{'error': '缺少obj_id'}])
|
data = json.dumps([{'error': '缺少obj_id'}])
|
||||||
return HttpResponse(data, status=500, content_type=content_type)
|
return HttpResponse(data, status=500, content_type=content_type)
|
||||||
try:
|
try:
|
||||||
uo = UuidOjbidMap.objects.get(obj_id=obj_id)
|
uo = UuidObjidMap.objects.get(obj_id=obj_id)
|
||||||
except UuidOjbidMap.DoesNotExist:
|
except UuidObjidMap.DoesNotExist:
|
||||||
uo = None
|
uo = None
|
||||||
if uo:
|
if uo:
|
||||||
data = json.dumps([{'uuid': uo.uuid, 'obj_id': obj_id}])
|
data = json.dumps([{'uuid': uo.uuid, 'obj_id': obj_id}])
|
||||||
@@ -1933,7 +1933,7 @@ def crocodoc_status(request):
|
|||||||
ret_dict = ret_list[0]
|
ret_dict = ret_list[0]
|
||||||
if ret_dict.has_key('error'):
|
if ret_dict.has_key('error'):
|
||||||
# Delete obj_id-uuid in db
|
# Delete obj_id-uuid in db
|
||||||
UuidOjbidMap.objects.filter(obj_id=obj_id).delete()
|
UuidObjidMap.objects.filter(obj_id=obj_id).delete()
|
||||||
|
|
||||||
data = json.dumps([{'error': '文档转换出错:' + ret_dict['error']}])
|
data = json.dumps([{'error': '文档转换出错:' + ret_dict['error']}])
|
||||||
return HttpResponse(data, status=500, content_type=content_type)
|
return HttpResponse(data, status=500, content_type=content_type)
|
||||||
@@ -1948,7 +1948,7 @@ def crocodoc_status(request):
|
|||||||
return HttpResponse(data, status=200, content_type=content_type)
|
return HttpResponse(data, status=200, content_type=content_type)
|
||||||
elif status == 'DONE':
|
elif status == 'DONE':
|
||||||
# Cache obj_id and uuid in db
|
# Cache obj_id and uuid in db
|
||||||
uo = UuidOjbidMap(uuid=uuids, obj_id=obj_id)
|
uo = UuidObjidMap(uuid=uuids, obj_id=obj_id)
|
||||||
try:
|
try:
|
||||||
uo.save()
|
uo.save()
|
||||||
except IntegrityError, e:
|
except IntegrityError, e:
|
||||||
@@ -1958,7 +1958,7 @@ def crocodoc_status(request):
|
|||||||
return HttpResponse(data, status=200, content_type=content_type)
|
return HttpResponse(data, status=200, content_type=content_type)
|
||||||
elif status == 'ERROR':
|
elif status == 'ERROR':
|
||||||
# Delete obj_id-uuid in db
|
# Delete obj_id-uuid in db
|
||||||
UuidOjbidMap.objects.filter(obj_id=obj_id).delete()
|
UuidObjidMap.objects.filter(obj_id=obj_id).delete()
|
||||||
|
|
||||||
err_msg = '文档转换出错:' + ret_dict['error'] if ret_dict.has_key('error') \
|
err_msg = '文档转换出错:' + ret_dict['error'] if ret_dict.has_key('error') \
|
||||||
else '文档转换出错'
|
else '文档转换出错'
|
||||||
|
Reference in New Issue
Block a user