Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 177681 Details for
Bug 261961
Yum does not like non-ascii package names
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
iri to uri function from Django
iri.py (text/plain), 1.60 KB, created by
Toshio Ernie Kuratomi
on 2007-08-28 23:51:55 UTC
(
hide
)
Description:
iri to uri function from Django
Filename:
MIME Type:
Creator:
Toshio Ernie Kuratomi
Created:
2007-08-28 23:51:55 UTC
Size:
1.60 KB
patch
obsolete
>'''Code originates with Django > http://code.djangoproject.com/browser/django/trunk/django/utils/encoding.py > > Copyright: Copyright (c) 2005, the Lawrence Journal-World All rights reserved > License: BSD >''' >import types >import urllib > >def smart_str(s, encoding='utf-8', strings_only=False, errors='strict'): > """ > Returns a bytestring version of 's', encoded as specified in 'encoding'. > > If strings_only is True, don't convert (some) non-string-like objects. > """ > if strings_only and isinstance(s, (types.NoneType, int)): > return s > if not isinstance(s, basestring): > try: > return str(s) > except UnicodeEncodeError: > return unicode(s).encode(encoding, errors) > elif isinstance(s, unicode): > return s.encode(encoding, errors) > elif s and encoding != 'utf-8': > return s.decode('utf-8', errors).encode(encoding, errors) > else: > return s > >def iri_to_uri(iri): > """ > Convert an Internationalized Resource Identifier (IRI) portion to a URI > portion that is suitable for inclusion in a URL. > > This is the algorithm from section 3.1 of RFC 3987. However, since we are > assuming input is either UTF-8 or unicode already, we can simplify things a > little from the full method. > > Returns an ASCII string containing the encoded result. > """ > # The list of safe characters here is constructed from the printable ASCII > # characters that are not explicitly excluded by the list at the end of > # section 3.1 of RFC 3987. > if iri is None: > return iri > return urllib.quote(smart_str(iri), safe='/#%[]=:;$&()+,!?') >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 261961
:
177681
|
299034
|
304434
|
304439