Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gajim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Weblate
gajim
Commits
3fc9c10c
Commit
3fc9c10c
authored
15 years ago
by
steve-e
Browse files
Options
Downloads
Patches
Plain Diff
Remove old workarounds for Python 2.3.
parent
2654ee9d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/common/xmpp_stringprep.py
+27
-66
27 additions, 66 deletions
src/common/xmpp_stringprep.py
with
27 additions
and
66 deletions
src/common/xmpp_stringprep.py
+
27
−
66
View file @
3fc9c10c
...
...
@@ -21,34 +21,9 @@
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
##
import
sys
,
warnings
if
sys
.
version_info
<
(
2
,
3
,
2
):
import
re
class
IDNA
:
dots
=
re
.
compile
(
u
"
[
\u002E\u3002\uFF0E\uFF61
]
"
)
def
nameprep
(
self
,
label
):
return
label
.
lower
()
idna
=
IDNA
()
crippled
=
True
warnings
.
warn
(
"
Accented and non-Western Jabber IDs will not be properly
"
"
case-folded with this version of Python, resulting in
"
"
incorrect protocol-level behavior. It is strongly
"
"
recommended you upgrade to Python 2.3.2 or newer if you
"
"
intend to use Twisted
'
s Jabber support.
"
)
else
:
import
stringprep
import
unicodedata
from
encodings
import
idna
crippled
=
False
del
sys
,
warnings
import
stringprep
import
unicodedata
from
encodings
import
idna
class
ILookupTable
:
"""
Interface for character lookup classes.
"""
...
...
@@ -222,44 +197,30 @@ class NamePrep:
raise
UnicodeError
,
"
Invalid trailing hyphen-minus
"
return
label
if
crippled
:
case_map
=
MappingTableFromFunction
(
lambda
c
:
c
.
lower
())
nodeprep
=
Profile
(
mappings
=
[
case_map
],
normalize
=
False
,
prohibiteds
=
[
LookupTable
([
u
'
'
,
u
'"'
,
u
'
&
'
,
u
"'"
,
u
'
/
'
,
u
'
:
'
,
u
'
<
'
,
u
'
>
'
,
u
'
@
'
])],
check_unassigneds
=
False
,
check_bidi
=
False
)
resourceprep
=
Profile
(
normalize
=
False
,
check_unassigneds
=
False
,
check_bidi
=
False
)
else
:
C_11
=
LookupTableFromFunction
(
stringprep
.
in_table_c11
)
C_12
=
LookupTableFromFunction
(
stringprep
.
in_table_c12
)
C_21
=
LookupTableFromFunction
(
stringprep
.
in_table_c21
)
C_22
=
LookupTableFromFunction
(
stringprep
.
in_table_c22
)
C_3
=
LookupTableFromFunction
(
stringprep
.
in_table_c3
)
C_4
=
LookupTableFromFunction
(
stringprep
.
in_table_c4
)
C_5
=
LookupTableFromFunction
(
stringprep
.
in_table_c5
)
C_6
=
LookupTableFromFunction
(
stringprep
.
in_table_c6
)
C_7
=
LookupTableFromFunction
(
stringprep
.
in_table_c7
)
C_8
=
LookupTableFromFunction
(
stringprep
.
in_table_c8
)
C_9
=
LookupTableFromFunction
(
stringprep
.
in_table_c9
)
B_1
=
EmptyMappingTable
(
stringprep
.
in_table_b1
)
B_2
=
MappingTableFromFunction
(
stringprep
.
map_table_b2
)
nodeprep
=
Profile
(
mappings
=
[
B_1
,
B_2
],
prohibiteds
=
[
C_11
,
C_12
,
C_21
,
C_22
,
C_3
,
C_4
,
C_5
,
C_6
,
C_7
,
C_8
,
C_9
,
LookupTable
([
u
'"'
,
u
'
&
'
,
u
"'"
,
u
'
/
'
,
u
'
:
'
,
u
'
<
'
,
u
'
>
'
,
u
'
@
'
])])
resourceprep
=
Profile
(
mappings
=
[
B_1
,],
prohibiteds
=
[
C_12
,
C_21
,
C_22
,
C_3
,
C_4
,
C_5
,
C_6
,
C_7
,
C_8
,
C_9
])
C_11
=
LookupTableFromFunction
(
stringprep
.
in_table_c11
)
C_12
=
LookupTableFromFunction
(
stringprep
.
in_table_c12
)
C_21
=
LookupTableFromFunction
(
stringprep
.
in_table_c21
)
C_22
=
LookupTableFromFunction
(
stringprep
.
in_table_c22
)
C_3
=
LookupTableFromFunction
(
stringprep
.
in_table_c3
)
C_4
=
LookupTableFromFunction
(
stringprep
.
in_table_c4
)
C_5
=
LookupTableFromFunction
(
stringprep
.
in_table_c5
)
C_6
=
LookupTableFromFunction
(
stringprep
.
in_table_c6
)
C_7
=
LookupTableFromFunction
(
stringprep
.
in_table_c7
)
C_8
=
LookupTableFromFunction
(
stringprep
.
in_table_c8
)
C_9
=
LookupTableFromFunction
(
stringprep
.
in_table_c9
)
B_1
=
EmptyMappingTable
(
stringprep
.
in_table_b1
)
B_2
=
MappingTableFromFunction
(
stringprep
.
map_table_b2
)
nodeprep
=
Profile
(
mappings
=
[
B_1
,
B_2
],
prohibiteds
=
[
C_11
,
C_12
,
C_21
,
C_22
,
C_3
,
C_4
,
C_5
,
C_6
,
C_7
,
C_8
,
C_9
,
LookupTable
([
u
'"'
,
u
'
&
'
,
u
"'"
,
u
'
/
'
,
u
'
:
'
,
u
'
<
'
,
u
'
>
'
,
u
'
@
'
])])
resourceprep
=
Profile
(
mappings
=
[
B_1
,],
prohibiteds
=
[
C_12
,
C_21
,
C_22
,
C_3
,
C_4
,
C_5
,
C_6
,
C_7
,
C_8
,
C_9
])
nameprep
=
NamePrep
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment