

from __future__ import unicode_literals

from scrapi.base import OAIHarvester
from scrapi.base.helpers import updated_schema


class ScholarsbankHarvester(OAIHarvester):
    short_name = 'scholarsbank'
    long_name = 'Scholars Bank University of Oregon'
    url = 'http://scholarsbank.uoregon.edu'
    timezone_granularity = True

    base_url = 'http://scholarsbank.uoregon.edu/oai/request'
    property_list = [
        'type', 'source', 'format', 'relation',
        'date', 'description', 'setSpec', 'identifier'
    ]



from __future__ import unicode_literals

from scrapi.base import OAIHarvester
from scrapi.base.schemas import OAISCHEMA
from scrapi.base.helpers import updated_schema


def second_result(des):
    return des[1] if len(des) > 1 else des[0] if des else ''


class ScholarsbankHarvester(OAIHarvester):
    short_name = 'scholarsbank'
    long_name = 'Scholars Bank University of Oregon'
    url = 'http://scholarsbank.uoregon.edu'
    timezone_granularity = True

    base_url = 'http://scholarsbank.uoregon.edu/oai/request'
    property_list = [
        'type', 'source', 'format', 'relation',
        'date', 'description', 'setSpec', 'identifier'
    ]

    schema = updated_schema(OAISCHEMA, {
        'description': ('//dc:description/node()', second_result)
    })

Update schoalrsbank to grab second description if there are two
Update schoalrsbank to grab second description if there are two

  
  
  from __future__ import unicode_literals
  
  from scrapi.base import OAIHarvester
+ from scrapi.base.schemas import OAISCHEMA
  from scrapi.base.helpers import updated_schema
+ 
+ 
+ def second_result(des):
+     return des[1] if len(des) > 1 else des[0] if des else ''
  
  
  class ScholarsbankHarvester(OAIHarvester):
      short_name = 'scholarsbank'
      long_name = 'Scholars Bank University of Oregon'
      url = 'http://scholarsbank.uoregon.edu'
      timezone_granularity = True
  
      base_url = 'http://scholarsbank.uoregon.edu/oai/request'
      property_list = [
          'type', 'source', 'format', 'relation',
          'date', 'description', 'setSpec', 'identifier'
      ]
  
+     schema = updated_schema(OAISCHEMA, {
+         'description': ('//dc:description/node()', second_result)
+     })
+ 
Update schoalrsbank to grab second description if there are two
## Code Before:


from __future__ import unicode_literals

from scrapi.base import OAIHarvester
from scrapi.base.helpers import updated_schema


class ScholarsbankHarvester(OAIHarvester):
    short_name = 'scholarsbank'
    long_name = 'Scholars Bank University of Oregon'
    url = 'http://scholarsbank.uoregon.edu'
    timezone_granularity = True

    base_url = 'http://scholarsbank.uoregon.edu/oai/request'
    property_list = [
        'type', 'source', 'format', 'relation',
        'date', 'description', 'setSpec', 'identifier'
    ]

## Instruction:
Update schoalrsbank to grab second description if there are two
## Code After:


from __future__ import unicode_literals

from scrapi.base import OAIHarvester
from scrapi.base.schemas import OAISCHEMA
from scrapi.base.helpers import updated_schema


def second_result(des):
    return des[1] if len(des) > 1 else des[0] if des else ''


class ScholarsbankHarvester(OAIHarvester):
    short_name = 'scholarsbank'
    long_name = 'Scholars Bank University of Oregon'
    url = 'http://scholarsbank.uoregon.edu'
    timezone_granularity = True

    base_url = 'http://scholarsbank.uoregon.edu/oai/request'
    property_list = [
        'type', 'source', 'format', 'relation',
        'date', 'description', 'setSpec', 'identifier'
    ]

    schema = updated_schema(OAISCHEMA, {
        'description': ('//dc:description/node()', second_result)
    })
