Final changes to support duplicate document search

This commit is contained in:
Roberto Rosario
2011-02-21 19:32:03 -04:00
parent 5209847ab5
commit 5b4f2ecb57
4 changed files with 39 additions and 20 deletions
+12 -4
View File
@@ -64,8 +64,8 @@ def check_settings(request):
'hide_object':True,
'extra_columns':[
{'name':_(u'name'), 'attribute':'name'},
{'name':_(u'value'), 'attribute': lambda x: return_type(x['value'])},
{'name':_(u'exists'), 'attribute':lambda x: exists(x['value']) if 'exists' in x else ''},
{'name':_(u'value'), 'attribute': lambda x: _return_type(x['value'])},
{'name':_(u'exists'), 'attribute':lambda x: _exists(x['value']) if 'exists' in x else ''},
]
}
@@ -73,7 +73,7 @@ def check_settings(request):
context_instance=RequestContext(request))
def return_type(value):
def _return_type(value):
if isinstance(value, types.FunctionType):
return _(u'function found')
elif isinstance(value, types.ClassType):
@@ -85,8 +85,16 @@ def return_type(value):
else:
return value
def exists(path):
def _exists(path):
try:
return os.path.exists(path)
except Exception, exc:
return exc
def blank_menu(request):
return render_to_response('generic_template.html', {
'title':_(u'Tools menu'),
'content':_(u'"Find all duplicates": Search all the documents\' checksums and return a list of the exact matches.')
},
context_instance=RequestContext(request))