X Tutup
Skip to content

Commit 9ce8030

Browse files
author
Russ Miles
committed
Added schema support to the core framework, samples and documentation. Needed to correct objectify.py to handle the namespace being part of the 'component' tag, because of the way objectify converts XML tags to class names for creating a typesafe object representation of the document.
git-svn-id: https://src.springframework.org/svn/se-springpython-py/trunk/springpython@134 ce8fead1-4192-4296-8608-a705134b927f
1 parent 53b81c0 commit 9ce8030

27 files changed

+86
-27
lines changed

docs/reference/src/components.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@
4242
adapted to something very similar in Spring Python.</para>
4343

4444
<programlisting><![CDATA[
45-
<components>
45+
<components xmlns="http://springpython.webfactional.com/schema/context/spring-python-context-1.0.xsd"
46+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4647
<component id="MovieLister" class="springpython.test.support.testSupportClasses.MovieLister">
4748
<property name="finder" local="MovieFinder" />
4849
</component>

docs/reference/src/remoting.xml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ print service.getData("Hello")
6262
file called <emphasis>applicationContext.xml</emphasis>.</para>
6363

6464
<programlisting><![CDATA[
65-
<components>
65+
<components xmlns="http://springpython.webfactional.com/schema/context/spring-python-context-1.0.xsd"
66+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
6667
<component id="service" class="Service"/>
6768
</components>
6869
]]></programlisting>
@@ -91,7 +92,9 @@ print service.getData("Hello")
9192
application context.</para>
9293

9394
<programlisting><![CDATA[
94-
<components>
95+
<components xmlns="http://springpython.webfactional.com/schema/context/spring-python-context-1.0.xsd"
96+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
97+
9598
<component id="remoteService" class="Service"/>
9699
97100
<component id="serviceExporter" class="springpython.remoting.pyro.PyroServiceExporter">

samples/petclinic/cherrypy/applicationContext-client.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
<components>
1+
<components xmlns="http://springpython.webfactional.com/schema/context/spring-python-context-1.0.xsd"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
23

34
<component id="controller" class="springpython.remoting.pyro.PyroProxyFactory">
45
<property name="serviceUrl">"PYROLOC://localhost:7766/Controller"</property>

samples/petclinic/cherrypy/applicationContext-server.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
<components>
1+
<components xmlns="http://springpython.webfactional.com/schema/context/spring-python-context-1.0.xsd"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
23

34
<component id="connectionFactory" class="springpython.database.factory.MySQLConnectionFactory">
45
<property name="username">"springpython"</property>

samples/petclinic/cherrypy/applicationContext.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
<components>
1+
<components xmlns="http://springpython.webfactional.com/schema/context/spring-python-context-1.0.xsd"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
23

34
<component id="connectionFactory" class="springpython.database.factory.MySQLConnectionFactory">
45
<property name="username">"springpython"</property>

samples/springwiki/applicationContext.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
<components>
1+
<components xmlns="http://springpython.webfactional.com/schema/context/spring-python-context-1.0.xsd"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
23

34
<component id="controller" class="controller.SpringWikiController">
45
</component>

src/README

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,27 @@ If you want to develop this product, you may have to install some other tools as
3535
* pmock (apt-get install python-pmock for ubuntu users)
3636
* Pyro (apt-get install pyro for ubuntu users)
3737
* CherryPy (apt-get install python-cherrypy for ubuntu users) (This currently supports version 2, not version 3)
38+
4. To export XML JUnit-style output from the tests you will need to install:
39+
* NoseXUnit (http://nosexunit.sourceforge.net/)
40+
41+
You may need to run these installs as root using 'sudo'.
42+
43+
To ensure your changes affect the build appropriately, use the build.py script. For example to see all the options available:
44+
45+
> python build.py --help
46+
47+
Or to build and run all development tests:
48+
49+
> python build.py --test
50+
51+
Or to clean up any recent builds:
52+
53+
> python build.py --clean
54+
55+
Note: You will need to clean the build between test executions with the build.py script.
56+
57+
58+
59+
60+
61+

src/springpython/aop/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ class RegexpMethodPointcutAdvisor(Pointcut, MethodMatcher, MethodInterceptor):
8888
8989
The following block shows how to configure one using IoC.
9090
91-
<components>
91+
<components xmlns="http://springpython.webfactional.com/schema/context/spring-python-context-1.0.xsd"
92+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
9293
9394
<component id="wrappingInterceptor" class="springpython.test.support.testSupportClasses.WrappingInterceptor"/>
9495

src/springpython/context/pycontainer/objectify.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# for this. Instead, it is hard-coded to use the EXPAT mode.
1616
import xml.parsers.expat
1717
EXPAT = 'EXPAT'
18+
SCHEMA = 'http://springpython.webfactional.com/schema/context/spring-python-context-1.0.xsd'
1819

1920
def instance (x):
2021
global minidom, Node
@@ -319,10 +320,12 @@ def pyobj_from_dom(dom_node):
319320
return py_obj
320321

321322
def py_name(name):
323+
name = name.replace(SCHEMA, '')
322324
name = name.replace('#', '_')
323325
name = name.replace(':', '_')
324326
name = name.replace('-', '__')
325327
name = name.replace('.', '_')
328+
name = name.replace(' ', '')
326329
return name
327330

328331
import objectify

test/springpythontest/support/affirmativeBasedApplicationContext.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<components>
1+
<components xmlns="http://springpython.webfactional.com/schema/context/spring-python-context-1.0.xsd"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
3+
24
<component id="authenticationProvider" class="springpython.security.providers.InMemoryAuthenticationProvider">
35
<property name="userMap">
46
{

0 commit comments

Comments
 (0)
X Tutup