Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(8)  |  Call(4)  |  Derive(0)  |  Import(4)
<comment-ja>
system????????????????["ascii", "utf-8", "euc-jp", "cp932", "shift-jis"]?????unicode???????

@param string: ?????
@type string: str
@param system: ?????
@type system: str
@return: Unicode???
@rtype: str
</comment-ja>(more...)

        def uni_force(string, system="utf-8"):
    """
    
    system????????????????["ascii", "utf-8", "euc-jp", "cp932", "shift-jis"]?????unicode???????

    @param string: ?????
    @type string: str
    @param system: ?????
    @type system: str
    @return: Unicode???
    @rtype: str
    
    
    English Comment
    
    """
    if isinstance(string, unicode) is True:
        return string
    else:
        try:
            return unicode(string, system)
        except:
            encodings = ["ascii", "utf-8", "euc-jp", "cp932", "shift-jis"]
            for encode in encodings:
                try:
                    return unicode(string, encode)
                except:
                    pass
            raise KaresansuiLibException("Character code that can be converted to unicode.")
        


src/k/a/karesansui-HEAD/karesansui/gadget/guest.py   karesansui(Download)
from karesansui.lib.const import XEN_KEYMAP_DIR, KVM_KEYMAP_DIR, KVM_BRIDGE_PREFIX
 
from karesansui.lib.utils import comma_split, \
     generate_mac_address, is_param, \
     next_number, generate_uuid, string_from_uuid, uniq_sort, \
        _guest = m_new(created_user=self.me,
                       modified_user=self.me,
                       uniq_key=uni_force(uuid),
                       name=self.input.m_name,
                       attribute=MACHINE_ATTRIBUTE['GUEST'],

src/k/a/karesansui-HEAD/karesansui/gadget/host.py   karesansui(Download)
from karesansui import config
from karesansui.lib.rest import Rest, auth
from karesansui.lib.utils import generate_uuid, string_from_uuid, \
     uni_force, is_param, comma_split, uniq_sort, uri_split, uri_join
 
            host = m_new(created_user=self.me,
                         modified_user=self.me,
                         uniq_key=uni_force(uniq_key),
                         name=name,
                         hostname=hostname,

src/k/a/karesansui-HEAD/karesansui/gadget/guestreplicate.py   karesansui(Download)
    ID_MIN_LENGTH, ID_MAX_LENGTH, MACHINE_ATTRIBUTE
 
from karesansui.lib.utils import comma_split, generate_uuid, \
    string_from_uuid, is_param, uni_force, \
    next_number, generate_mac_address, chk_create_disk, get_partition_info
        dest_guest = m_new(created_user=self.me,
                           modified_user=self.me,
                           uniq_key=uni_force(uuid),
                           name=self.input.m_name,
                           attribute=MACHINE_ATTRIBUTE['GUEST'],

src/k/a/karesansui-HEAD/karesansui/db/model/user.py   karesansui(Download)
    from karesansui.lib.crypt import sha1encrypt
    (password, salt) = sha1encrypt(u'password')
    from karesansui.lib.utils import uni_force
    _m_u = User(u'hoge@localhost', uni_force(password), unicode(salt, 'utf-8'), u'ja', u'ja_JP')
    session.add(_m_u)