<commit_before>###########################################################
#
# Copyright (c) 2005, Southpaw Technology
#                     All Rights Reserved
#
# PROPRIETARY INFORMATION.  This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permission.
#
#
#

__all__ = ['UploadServerWdg']


import os, string, sys

from pyasm.common import Environment, TacticException
from pyasm.biz import File
from pyasm.search import SearchType
from pyasm.web import *
from pyasm.command import FileUpload

import shutil


class UploadServerWdg(Widget):

    def get_display(my):
        web = WebContainer.get_web()

        num_files = web.get_form_value("num_files")
        # HTML5 upload
        if num_files:
            num_files = int(num_files)
            files = []
            for i in range(0, num_files):
                field_storage = web.get_form_value("file%s" % i)
                file_name = web.get_form_value("file_name%s"% i)
                if not file_name:
                    file_name = my.get_file_name(field_storage)
                items = my.dump(field_storage, file_name)
                files.extend(items)


        else:
            field_storage = web.get_form_value("file")
            file_name = web.get_form_value("file_name0")
            if not file_name:
                file_name = my.get_file_name(field_storage)

            files = my.dump(field_storage, file_name)

        print "files: ", files
        return "file_name=%s\n" % ','.join(files)
<commit_msg>BRANCH 4.2-DEV: some minor adjustments to upload server<commit_after>###########################################################
#
# Copyright (c) 2005, Southpaw Technology
#                     All Rights Reserved
#
# PROPRIETARY INFORMATION.  This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permission.
#
#
#

__all__ = ['UploadServerWdg']


import os, string, sys

from pyasm.common import Environment, TacticException
from pyasm.biz import File
from pyasm.search import SearchType
from pyasm.web import *
from pyasm.command import FileUpload

import shutil


class UploadServerWdg(Widget):

    def get_display(my):
        web = WebContainer.get_web()

        num_files = web.get_form_value("num_files")
        files = []

        # HTML5 upload
        if num_files:
            num_files = int(num_files)
            files = []
            for i in range(0, num_files):
                field_storage = web.get_form_value("file%s" % i)
                if not field_storage:
                    continue

                file_name = web.get_form_value("file_name%s"% i)
                if not file_name:
                    file_name = my.get_file_name(field_storage)
                items = my.dump(field_storage, file_name)
                files.extend(items)


        else:
            field_storage = web.get_form_value("file")
            if field_storage:
                file_name = web.get_form_value("file_name0")
                if not file_name:
                    file_name = my.get_file_name(field_storage)

                files = my.dump(field_storage, file_name)

        if files:
            print "files: ", files
            return "file_name=%s\n" % ','.join(files)
        else:
            return "NO FILES"

{'fraction_non_alphanumeric': 0.11475409836065574, 'fraction_numerical': 0.00468384074941452, 'mean_word_length': 2.2511893434823977, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1198977', 'n_tokens_mistral': 1020, 'n_tokens_neox': 954, 'n_words': 250}