Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fastkml
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Aurélien Vermylen
fastkml
Commits
f45883fa
Commit
f45883fa
authored
May 05, 2016
by
Christian Ledermann
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #43 from heltonbiker/master
Change "NS" to "KMLNS" for legibility and consistency
parents
f4fd8629
8b4e9e98
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
12 deletions
+12
-12
fastkml/base.py
fastkml/base.py
+2
-2
fastkml/config.py
fastkml/config.py
+2
-2
fastkml/kml.py
fastkml/kml.py
+2
-2
fastkml/test_main.py
fastkml/test_main.py
+6
-6
No files found.
fastkml/base.py
View file @
f45883fa
...
...
@@ -29,7 +29,7 @@ class _XMLObject(object):
def
__init__
(
self
,
ns
=
None
):
if
ns
is
None
:
self
.
ns
=
config
.
NS
self
.
ns
=
config
.
KML
NS
else
:
self
.
ns
=
ns
...
...
@@ -78,7 +78,7 @@ class _BaseObject(_XMLObject):
super
(
_BaseObject
,
self
).
__init__
(
ns
)
self
.
id
=
id
if
ns
is
None
:
self
.
ns
=
config
.
NS
self
.
ns
=
config
.
KML
NS
else
:
self
.
ns
=
ns
...
...
fastkml/config.py
View file @
f45883fa
...
...
@@ -29,12 +29,12 @@ except ImportError:
LXML
=
False
NS
=
'{http://www.opengis.net/kml/2.2}'
KML
NS
=
'{http://www.opengis.net/kml/2.2}'
ATOMNS
=
'{http://www.w3.org/2005/Atom}'
GXNS
=
'{http://www.google.com/kml/ext/2.2}'
if
hasattr
(
etree
,
'register_namespace'
):
etree
.
register_namespace
(
'kml'
,
NS
[
1
:
-
1
])
etree
.
register_namespace
(
'kml'
,
KML
NS
[
1
:
-
1
])
etree
.
register_namespace
(
'atom'
,
ATOMNS
[
1
:
-
1
])
etree
.
register_namespace
(
'gx'
,
GXNS
[
1
:
-
1
])
...
...
fastkml/kml.py
View file @
f45883fa
...
...
@@ -79,7 +79,7 @@ class KML(object):
self
.
_features
=
[]
if
ns
is
None
:
self
.
ns
=
config
.
NS
self
.
ns
=
config
.
KML
NS
else
:
self
.
ns
=
ns
...
...
@@ -119,7 +119,7 @@ class KML(object):
# element, just without prefix.
if
not
self
.
ns
:
root
=
etree
.
Element
(
'%skml'
%
self
.
ns
)
root
.
set
(
'xmlns'
,
config
.
NS
[
1
:
-
1
])
root
.
set
(
'xmlns'
,
config
.
KML
NS
[
1
:
-
1
])
else
:
if
config
.
LXML
:
root
=
etree
.
Element
(
...
...
fastkml/test_main.py
View file @
f45883fa
...
...
@@ -45,7 +45,7 @@ class BaseClassesTestCase(unittest.TestCase):
def
test_base_object
(
self
):
bo
=
base
.
_BaseObject
(
id
=
'id0'
)
self
.
assertEqual
(
bo
.
id
,
'id0'
)
self
.
assertEqual
(
bo
.
ns
,
config
.
NS
)
self
.
assertEqual
(
bo
.
ns
,
config
.
KML
NS
)
self
.
assertEqual
(
bo
.
targetId
,
None
)
self
.
assertEqual
(
bo
.
__name__
,
None
)
bo
.
targetId
=
'target'
...
...
@@ -55,17 +55,17 @@ class BaseClassesTestCase(unittest.TestCase):
self
.
assertEqual
(
bo
.
id
,
None
)
self
.
assertEqual
(
bo
.
ns
,
''
)
self
.
assertRaises
(
NotImplementedError
,
bo
.
etree_element
)
element
=
etree
.
Element
(
config
.
NS
+
'Base'
)
element
=
etree
.
Element
(
config
.
KML
NS
+
'Base'
)
self
.
assertRaises
(
TypeError
,
bo
.
from_element
)
self
.
assertRaises
(
TypeError
,
bo
.
from_element
,
element
)
bo
.
__name__
=
'NotABaseObject'
self
.
assertRaises
(
TypeError
,
bo
.
from_element
,
element
)
# Note that we can coax baseclasses not to throw errors
bo
.
__name__
=
'Base'
bo
.
ns
=
config
.
NS
bo
.
ns
=
config
.
KML
NS
bo
.
from_element
(
element
)
self
.
assertEqual
(
bo
.
id
,
None
)
self
.
assertEqual
(
bo
.
ns
,
config
.
NS
)
self
.
assertEqual
(
bo
.
ns
,
config
.
KML
NS
)
self
.
assertFalse
(
bo
.
etree_element
(),
None
)
self
.
assertTrue
(
len
(
bo
.
to_string
())
>
1
)
...
...
@@ -808,7 +808,7 @@ class KmlFromStringTestCase(unittest.TestCase):
k
.
from_string
(
doc1
)
d
=
list
(
k
.
features
())[
0
]
s2
=
list
(
d
.
schemata
())[
0
]
s
.
ns
=
config
.
NS
s
.
ns
=
config
.
KML
NS
self
.
assertEqual
(
s
.
to_string
(),
s2
.
to_string
())
k1
=
kml
.
KML
()
k1
.
from_string
(
k
.
to_string
())
...
...
@@ -948,7 +948,7 @@ class StyleTestCase(unittest.TestCase):
f
.
styleUrl
=
'#somestyle'
self
.
assertEqual
(
f
.
styleUrl
,
'#somestyle'
)
self
.
assertTrue
(
isinstance
(
f
.
_styleUrl
,
styles
.
StyleUrl
))
s
=
styles
.
StyleUrl
(
config
.
NS
,
url
=
'#otherstyle'
)
s
=
styles
.
StyleUrl
(
config
.
KML
NS
,
url
=
'#otherstyle'
)
f
.
styleUrl
=
s
self
.
assertTrue
(
isinstance
(
f
.
_styleUrl
,
styles
.
StyleUrl
))
self
.
assertEqual
(
f
.
styleUrl
,
'#otherstyle'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment