예제 #1
0
    def file_name(self):
        file_name = self._file_name

        # derive file name from headers
        if file_name is None and 'content_disposition' in self.headers:
            _, attrs = cgi.parse_header(self.headers['content_disposition'])
            file_name = chomp(attrs.get('filename'))

        if file_name is None and self.source_path:
            file_name = os.path.basename(self.source_path)

        if file_name is None and self.source_url:
            parsed = urlparse(self.source_url)
            file_name = os.path.basename(parsed.path)

        return make_filename(file_name) or 'data'
예제 #2
0
파일: __init__.py 프로젝트: nivertech/aleph
    def file_name(self):
        file_name = self._file_name

        # derive file name from headers
        if file_name is None and 'content_disposition' in self.headers:
            _, attrs = cgi.parse_header(self.headers['content_disposition'])
            file_name = chomp(attrs.get('filename'))

        if file_name is None and self.source_path:
            file_name = os.path.basename(self.source_path)

        if file_name is None and self.source_url:
            parsed = urlparse(self.source_url)
            file_name = os.path.basename(parsed.path)

        return make_filename(file_name) or 'data'
예제 #3
0
파일: __init__.py 프로젝트: nivertech/aleph
 def extension(self, extension):
     self._extension = chomp(extension)
예제 #4
0
파일: __init__.py 프로젝트: nivertech/aleph
 def add_phone_number(self, number):
     number = chomp(number)
     if number and number not in self._phone_numbers:
         self._phone_numbers.append(number)
예제 #5
0
파일: __init__.py 프로젝트: nivertech/aleph
 def foreign_id(self, foreign_id):
     self._foreign_id = chomp(foreign_id)
예제 #6
0
파일: __init__.py 프로젝트: nivertech/aleph
 def add_country(self, country):
     country = chomp(country, lower=True)
     if is_country_code(country) and country not in self._countries:
         self._countries.append(country)
예제 #7
0
파일: __init__.py 프로젝트: nivertech/aleph
 def add_keyword(self, kw):
     kw = chomp(kw)
     if kw is not None and kw not in self._keywords:
         self._keywords.append(kw)
예제 #8
0
파일: __init__.py 프로젝트: nivertech/aleph
 def file_name(self, file_name):
     self._file_name = chomp(file_name)
예제 #9
0
파일: __init__.py 프로젝트: nivertech/aleph
 def add_language(self, language):
     lang = chomp(language, lower=True)
     if is_language_code(lang) and lang not in self._languages:
         self._languages.append(lang)
예제 #10
0
파일: __init__.py 프로젝트: nivertech/aleph
 def mime_type(self, mime_type):
     self._mime_type = chomp(mime_type)
예제 #11
0
 def add_language(self, language):
     lang = chomp(language, lower=True)
     if is_language_code(lang) and lang not in self._languages:
         self._languages.append(lang)
예제 #12
0
 def mime_type(self, mime_type):
     self._mime_type = chomp(mime_type)
예제 #13
0
 def title(self, title):
     self._title = chomp(title)
예제 #14
0
 def extension(self, extension):
     self._extension = chomp(extension)
예제 #15
0
 def foreign_id(self, foreign_id):
     self._foreign_id = chomp(foreign_id)
예제 #16
0
 def add_phone_number(self, number):
     number = chomp(number)
     if number and number not in self._phone_numbers:
         self._phone_numbers.append(number)
예제 #17
0
 def add_keyword(self, kw):
     kw = chomp(kw)
     if kw is not None and kw not in self._keywords:
         self._keywords.append(kw)
예제 #18
0
 def add_country(self, country):
     country = chomp(country, lower=True)
     if is_country_code(country) and country not in self._countries:
         self._countries.append(country)
예제 #19
0
파일: __init__.py 프로젝트: nivertech/aleph
 def title(self, title):
     self._title = chomp(title)
예제 #20
0
 def file_name(self, file_name):
     self._file_name = chomp(file_name)