Browse Source

Resolve problema do batch_size na request (#2624)

Corrige verificação de existencia de chave no dicionário
pull/2636/head
Vinícius Cantuária 6 years ago
committed by Edward
parent
commit
80c666821a
  1. 4
      sapl/lexml/OAIServer.py
  2. 7
      sapl/lexml/views.py

4
sapl/lexml/OAIServer.py

@ -26,7 +26,7 @@ class OAILEXML:
def __call__(self, element, metadata):
data = metadata.record
if data['metadata']:
if data.get('metadata'):
value = etree.XML(data['metadata'])
element.append(value)
@ -55,7 +55,7 @@ class OAIServer:
granularity='YYYY-MM-DDThh:mm:ssZ',
compression=['identity'],
toolkit_description=False)
if self.config['descricao']:
if self.config.get('descricao'):
result.add_description(self.config['descricao'])
return result

7
sapl/lexml/views.py

@ -18,10 +18,15 @@ class LexmlProvedorCrud(Crud):
class DetailView(Crud.DetailView):
layout_key = 'LexmlProvedorDetail'
def lexml_request(request):
request_dict = request.GET.copy()
if request_dict.get('batch_size'):
del request_dict['batch_size']
config = get_config(request.get_raw_uri(), int(request.GET.get('batch_size', '10')))
oai_server = OAIServerFactory(config)
r = oai_server.handleRequest(request.GET)
r = oai_server.handleRequest(request_dict)
response = r.decode('UTF-8')
return HttpResponse(response, content_type='text/xml')

Loading…
Cancel
Save