Skip to content

Commit ee9032f

Browse files
committed
Snapshot version 124 from springpython.webfactional.com's svn code repository.
git-svn-id: https://src.springframework.org/svn/se-springpython-py/trunk@9 ce8fead1-4192-4296-8608-a705134b927f
1 parent 69fe033 commit ee9032f

210 files changed

Lines changed: 20183 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.project

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>springpython</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.python.pydev.PyDevBuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.python.pydev.pythonNature</nature>
16+
</natures>
17+
</projectDescription>

.pydevproject

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<?eclipse-pydev version="1.0"?>
3+
4+
<pydev_project>
5+
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.5</pydev_property>
6+
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
7+
<path>/springpython/src</path>
8+
<path>/springpython/samples/petclinic</path>
9+
</pydev_pathproperty>
10+
</pydev_project>

make_release

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/usr/bin/python
2+
"""
3+
Copyright 2006-2008 Greg L. Turnquist, All Rights Reserved
4+
5+
This script is free software: you can redistribute it and/or modify
6+
it under the terms of the GNU General Public License as published by
7+
the Free Software Foundation, either version 3 of the License, or
8+
(at your option) any later version.
9+
10+
This program is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
GNU General Public License for more details.
14+
15+
You should have received a copy of the GNU General Public License
16+
along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
"""
18+
19+
import os
20+
import sys
21+
from optparse import OptionParser
22+
23+
def main(argv):
24+
"""This script is a shortcut to making the python distribution releases. This should be run from the folder it is in."""
25+
26+
parser = OptionParser(usage="usage: %prog [-h|--help] [options]")
27+
parser.add_option("", "--no-sample", action="store_false", dest="sample", default=True, help="Do NOT include the samples in this release.")
28+
parser.add_option("", "--sample-only", action="store_true", dest="sample_only", default=False, help="ONLY build the samples in this release.")
29+
parser.add_option("-r", "--register", action="store_true", dest="register", default=False, help="Register this release with http://pypi.python.org/pypi")
30+
(options, args) = parser.parse_args()
31+
32+
if not options.sample and options.sample_only:
33+
print "You have requested a conflicting situation. This script cannot build samples and exclude them also."
34+
sys.exit(3)
35+
36+
if not options.sample_only:
37+
# Make the main source code distribution
38+
os.system("cd src ; python setup.py sdist ; mv dist/* .. ; \\rm -rf dist ; \\rm -f MANIFEST ")
39+
40+
if options.register:
41+
os.system("cd src ; python setup.py register")
42+
43+
if options.sample:
44+
# Make the sample distribution
45+
os.system("cd samples ; python setup.py sdist ; mv dist/* .. ; \\rm -rf dist ; \\rm -f MANIFEST ")
46+
47+
if options.register:
48+
os.system("cd samples ; python setup.py register")
49+
else:
50+
print "Samples have been EXCLUDED from this release."
51+
52+
print "+++ Upload the tarballs using sftp to <user>@frs.sourceforge.net, into dir uploads and create a release."
53+
54+
if __name__ == "__main__":
55+
main(sys.argv[1:])

samples/MANIFEST.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
recursive-include petclinic README configure.py *.txt *.xml *.html *.png *.gif *.jpg *.template *.css
2+
recursive-include springwiki README configure.py *.txt *.xml *.html *.png *.gif *.jpg *.template *.css
3+
recursive-include springirc coily springbot.py *.txt

samples/petclinic/LICENSE.txt

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

samples/petclinic/README

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
This is everybody's favorite example (at least in the Spring community), the "PetClinic" tutorial.
2+
3+
For details about the application, see cherrypy/html/petclinic.html
4+
5+
== REQUIRED ==
6+
1. This demo requires that you already have a MySQL database server running on the same machine as this
7+
demo will be run on.
8+
* sudo apt-get install mysql-server (Ubuntu)
9+
10+
2. You obviously need Python. This demo was coded against Python 2.4.
11+
12+
3. You need to have either installed Spring Python, or have a checkedout copy from Subversion.
13+
In case of the latter, make sure /path/to/springpython/src is in PYTHONPATH.
14+
15+
4. You need to have CherryPy 2 installed. We don't support CherryPy 3 yet. Again, see the
16+
petclinic.html page for more details about this, including installation on Ubuntu/Linux.
17+
* sudo apt-get install python-cherrypy (Ubuntu)
18+
19+
5. To run the distributed version, you must have Pyro installed.
20+
* sudo apt-get install pyro (Ubuntu)
21+
22+
6. For additional demo, I have a plugged in paste component. This means you need to have paste installed
23+
as well.
24+
* sudo apt-get install python-paste (Ubuntu)
25+
26+
== TO SET IT UP AND RUN IT ==
27+
28+
Assuming you have the previous setup, here is how to configure and run the PetClinic app.
29+
30+
1. python configure.py
31+
32+
You will be prompted for MySQL's "root" password. This is NOT the root password for your
33+
machine!!! PetClinic needs to create a "springpython/springpython" account, and also the
34+
database "petclinic" in order to configure everything.
35+
36+
(If you just installed the MySQL server package, and did not extra steps, then hit RETURN
37+
when prompted for MySQL's root password. You may to do this more than once.)
38+
39+
If you look afterwards, you will find a new database. Everytime you re-run this step, it
40+
will wipe out any previous copy of "petclinic" database and rebuild it.
41+
42+
2. cd cherrypy
43+
44+
So far, we only have a CherryPy of the PetClinic.
45+
46+
3. python petclinic.py
47+
--or--
48+
python petclinic-noxml.py
49+
--or--
50+
In one shell, python petclinic-server.py
51+
In another shell, python petclinic-client.py
52+
53+
There are three versions, one demonstrating usage of an IoC container for component "wiring",
54+
another version where the wiring is done programmatically, and a third demonstrating remoting.
55+
56+
4. You should get a message showing a server has been launched, including a hyperlink to http://localhost:8001/
57+
58+
5. Go, man!!! What are you waiting for?!? No, seriously. That is it. At this stage, you don't have to
59+
play around with any Apache configuration. CherryPy uses Python's batteries-included web server components
60+
to run itself. It is possible to integrate this with Apache, but that is when you want to prep for the
61+
SlashDot effect on your mega-web site.
62+
Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
<components>
2+
3+
<component id="controller" class="springpython.remoting.pyro.PyroProxyFactory">
4+
<property name="serviceUrl">"PYROLOC://localhost:7766/Controller"</property>
5+
</component>
6+
7+
<component id="view" class="view.PetClinicView">
8+
<property name="controller" local="controller"/>
9+
</component>
10+
11+
<component id="userDetailsService" class="springpython.remoting.pyro.PyroProxyFactory">
12+
<property name="serviceUrl">"PYROLOC://localhost:7766/UserDetails"</property>
13+
</component>
14+
15+
<component id="userDetailsService2" class="springpython.security.userdetails.InMemoryUserDetailsService">
16+
<property name="userMap">
17+
{
18+
"jcarter": ("password6", ["VET_ANY"], True),
19+
}
20+
</property>
21+
</component>
22+
23+
<component id="userDetailsService3" class="springpython.security.userdetails.InMemoryUserDetailsService">
24+
<property name="userMap">
25+
{
26+
"jcoleman": ("password5", ["CUSTOMER_ANY"], True)
27+
}
28+
</property>
29+
</component>
30+
31+
<component id="md5Encoder" class="springpython.security.providers.encoding.Md5PasswordEncoder"/>
32+
33+
<component id="shaEncoder" class="springpython.security.providers.encoding.ShaPasswordEncoder"/>
34+
35+
<component id="md5UserDetailsService" class="controller.PreencodingUserDetailsService">
36+
<property name="wrappedUserDetailsService" local="userDetailsService2"/>
37+
<property name="encoder" local="md5Encoder"/>
38+
</component>
39+
40+
<component id="shaUserDetailsService" class="controller.PreencodingUserDetailsService">
41+
<property name="wrappedUserDetailsService" local="userDetailsService3"/>
42+
<property name="encoder" local="shaEncoder"/>
43+
</component>
44+
45+
<component id="plainEncoder" class="springpython.security.providers.encoding.PlaintextPasswordEncoder"/>
46+
47+
<component id="plainAuthenticationProvider" class="springpython.security.providers.dao.DaoAuthenticationProvider">
48+
<property name="userDetailsService" local="userDetailsService"/>
49+
<property name="passwordEncoder" local="plainEncoder"/>
50+
</component>
51+
52+
<component id="md5AuthenticationProvider" class="springpython.security.providers.dao.DaoAuthenticationProvider">
53+
<property name="userDetailsService" local="md5UserDetailsService"/>
54+
<property name="passwordEncoder" local="md5Encoder"/>
55+
</component>
56+
57+
<component id="shaAuthenticationProvider" class="springpython.security.providers.dao.DaoAuthenticationProvider">
58+
<property name="userDetailsService" local="shaUserDetailsService"/>
59+
<property name="passwordEncoder" local="shaEncoder"/>
60+
</component>
61+
62+
<component id="authenticationManager" class="springpython.security.providers.AuthenticationManager">
63+
<property name="authenticationProviderList">
64+
<list local="plainAuthenticationProvider"/>
65+
<list local="md5AuthenticationProvider"/>
66+
<list local="shaAuthenticationProvider"/>
67+
</property>
68+
</component>
69+
70+
<component id="vetRoleVoter" class="springpython.security.vote.RoleVoter">
71+
<property name="rolePrefix">"VET"</property>
72+
</component>
73+
74+
<component id="customerRoleVoter" class="springpython.security.vote.RoleVoter">
75+
<property name="rolePrefix">"CUSTOMER"</property>
76+
</component>
77+
78+
<component id="ownerVoter" class="controller.OwnerVoter">
79+
<property name="controller" local="controller"/>
80+
</component>
81+
82+
<component id="accessDecisionManager" class="springpython.security.vote.AffirmativeBased">
83+
<property name="allowIfAllAbstainDecisions">False</property>
84+
<property name="accessDecisionVoterList">
85+
<list local="vetRoleVoter"/>
86+
<list local="customerRoleVoter"/>
87+
<list local="ownerVoter"/>
88+
</property>
89+
</component>
90+
91+
<component id="cherrypySessionStrategy" class="springpython.security.web.CherryPySessionStrategy"/>
92+
93+
<component id="redirectStrategy" class="springpython.security.web.RedirectStrategy"/>
94+
95+
<component id="httpContextFilter" class="springpython.security.web.HttpSessionContextIntegrationFilter">
96+
<property name="sessionStrategy" local="cherrypySessionStrategy"/>
97+
</component>
98+
99+
<component id="authenticationProcessingFilter" class="springpython.security.web.AuthenticationProcessingFilter">
100+
<property name="authenticationManager" local="authenticationManager"/>
101+
<property name="alwaysReauthenticate">False</property>
102+
</component>
103+
104+
<component id="filterSecurityInterceptor" class="springpython.security.web.FilterSecurityInterceptor">
105+
<property name="validateConfigAttributes">False</property>
106+
<property name="authenticationManager" local="authenticationManager"/>
107+
<property name="accessDecisionManager" local="accessDecisionManager"/>
108+
<property name="sessionStrategy" local="cherrypySessionStrategy"/>
109+
<property name="objectDefinitionSource">
110+
[
111+
("/vets.*", ["VET_ANY"]),
112+
("/editOwner.*", ["VET_ANY", "OWNER"]),
113+
("/.*", ["VET_ANY", "CUSTOMER_ANY"])
114+
]
115+
</property>
116+
</component>
117+
118+
<component id="exceptionFilter" class="springpython.security.web.MiddlewareFilter">
119+
<property name="clazz">"paste.evalexception.middleware.EvalException"</property>
120+
<property name="appAttribute">"application"</property>
121+
</component>
122+
123+
<component id="authenticationProcessingFilterEntryPoint" class="springpython.security.web.AuthenticationProcessingFilterEntryPoint">
124+
<property name="loginFormUrl">"/login"</property>
125+
<property name="redirectStrategy" local="redirectStrategy"/>
126+
</component>
127+
128+
<component id="accessDeniedHandler" class="springpython.security.web.SimpleAccessDeniedHandler">
129+
<property name="errorPage">"/accessDenied"</property>
130+
<property name="redirectStrategy" local="redirectStrategy"/>
131+
</component>
132+
133+
<component id="exceptionTranslationFilter" class="springpython.security.web.ExceptionTranslationFilter">
134+
<property name="authenticationEntryPoint" local="authenticationProcessingFilterEntryPoint"/>
135+
<property name="accessDeniedHandler" local="accessDeniedHandler"/>
136+
</component>
137+
138+
<component id="filterChainProxy" class="springpython.security.web.FilterChainProxy">
139+
<property name="filterInvocationDefinitionSource">
140+
[
141+
("/images.*", ["exceptionFilter", ]),
142+
("/html.*", ["exceptionFilter", ]),
143+
("/login.*", ["exceptionFilter", "httpContextFilter"]),
144+
("/.*", ["exceptionFilter", "httpContextFilter", "exceptionTranslationFilter", "authenticationProcessingFilter", "filterSecurityInterceptor"])
145+
]
146+
</property>
147+
</component>
148+
149+
<component id="loginForm" class="view.CherryPyAuthenticationForm">
150+
<property name="filter" local="authenticationProcessingFilter"/>
151+
<property name="controller" local="controller"/>
152+
<property name="hashedUserDetailsServiceList">
153+
<list local="md5UserDetailsService"/>
154+
<list local="shaUserDetailsService"/>
155+
</property>
156+
<property name="authenticationManager" local="authenticationManager"/>
157+
<property name="redirectStrategy" local="redirectStrategy"/>
158+
</component>
159+
160+
</components>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<components>
2+
3+
<component id="connectionFactory" class="springpython.database.factory.MySQLConnectionFactory">
4+
<property name="username">"springpython"</property>
5+
<property name="password">"springpython"</property>
6+
<property name="hostname">"localhost"</property>
7+
<property name="db">"petclinic"</property>
8+
</component>
9+
10+
<component id="remoteController" class="controller.PetClinicController">
11+
<property name="connectionFactory" local="connectionFactory"/>
12+
</component>
13+
14+
<component id="controllerExporter" class="springpython.remoting.pyro.PyroServiceExporter">
15+
<property name="serviceName">"Controller"</property>
16+
<property name="service" local="remoteController"/>
17+
</component>
18+
19+
<component id="remoteUserDetailsService" class="springpython.security.userdetails.dao.DatabaseUserDetailsService">
20+
<property name="dataSource" local="connectionFactory"/>
21+
</component>
22+
23+
<component id="userDetailsServiceExporter" class="springpython.remoting.pyro.PyroServiceExporter">
24+
<property name="serviceName">"UserDetails"</property>
25+
<property name="service" local="remoteUserDetailsService"/>
26+
</component>
27+
28+
</components>

0 commit comments

Comments
 (0)