[Zope3-checkins] CVS: Products3/demo/jobboardi18n - I18nJob.py:1.1 Job.py:1.3 JobCreateView.py:1.4 JobView.pt:1.2 configure.zcml:1.10 edit.pt:1.2 preview.pt:1.3 review.pt:1.2
Nathan R. Yergler
nathan@yergler.net
Tue, 25 Mar 2003 17:00:26 -0500
Update of /cvs-repository/Products3/demo/jobboardi18n
In directory cvs.zope.org:/tmp/cvs-serv6896
Modified Files:
Job.py JobCreateView.py JobView.pt configure.zcml edit.pt
preview.pt review.pt
Added Files:
I18nJob.py
Log Message:
Updated demo to use locale formatters; descended I18nJob from IJob.
=== Added File Products3/demo/jobboardi18n/I18nJob.py ===
"""
IJob.py
"""
from zope.interface import Interface
from zope.interface import Attribute
from zopeproducts.demo.jobboard.IJob import IJob
class I18nJob(IJob):
"""Interface for an internationalized (i18n) Job"""
salary = Attribute("salary",
"Salary range offered for the job.")
startdate = Attribute("start date",
"Job start date")
=== Products3/demo/jobboardi18n/Job.py 1.2 => 1.3 ===
--- Products3/demo/jobboardi18n/Job.py:1.2 Thu Mar 20 16:03:05 2003
+++ Products3/demo/jobboardi18n/Job.py Tue Mar 25 16:59:55 2003
@@ -1,17 +1,20 @@
from persistence import Persistent
-from zopeproducts.demo.jobboard.IJob import IJob, JobState
+from I18nJob import I18nJob
+from zopeproducts.demo.jobboard.IJob import JobState
class Job(Persistent):
- __implements__ = IJob
+ __implements__ = I18nJob
- def __init__(self, submitter, summary, description, contact):
+ def __init__(self, submitter, summary, description, contact, salary, startdate):
self.submitter = submitter
self.summary = summary
self.description = description
self.contact = contact
self.state = JobState.PendingApproval
+ self.salary = salary
+ self.startdate = startdate
def approve(self):
"""Moves the job state to approved"""
=== Products3/demo/jobboardi18n/JobCreateView.py 1.3 => 1.4 ===
--- Products3/demo/jobboardi18n/JobCreateView.py:1.3 Thu Mar 20 16:03:05 2003
+++ Products3/demo/jobboardi18n/JobCreateView.py Tue Mar 25 16:59:55 2003
@@ -11,8 +11,14 @@
thanks = ViewPageTemplateFile('thanks.pt')
- def create(self, submitter='', summary='', description='', contact=''):
+ def create(self, submitter='', summary='', description='',
+ contact='', salary='', startdate=''):
+
# Validation code should go here
- job = Job(submitter, summary, description, contact)
+ print "startdate: ##%s##" % startdate
+ print self.request.locale.getDateFormatter('short').getPattern()
+ job = Job(submitter, summary, description, contact, salary,
+ self.request.locale.getDateFormatter('short').parse(startdate.strip()))
self.context.add(job)
+
return self.thanks()
=== Products3/demo/jobboardi18n/JobView.pt 1.1 => 1.2 ===
--- Products3/demo/jobboardi18n/JobView.pt:1.1 Mon Jun 17 19:57:56 2002
+++ Products3/demo/jobboardi18n/JobView.pt Tue Mar 25 16:59:55 2003
@@ -7,18 +7,25 @@
<h3 tal:content="context/summary">Job summary goes here</h3>
<table border=0>
- <tr><td i18n:translate="">Description:</td>
+ <tr><td i18n:translate="full-description">Description:</td>
<td>
<pre tal:content="context/description">Full descripion goes here
(multiple lines)
</pre>
</td>
</tr>
- <tr><td i18n:translate="">Contact:</td>
+ <tr><td i18n:translate="contact">Contact:</td>
<td><a href="user@host.com"
tal:attributes="href string:mailto:${context/contact}"
tal:content="context/contact">user@host.com</a></td>
</tr>
+ <tr><td i18n:translate="salary">Salary Range:</td>
+ <td tal:content="context/salary"></td>
+ </tr>
+ <tr><td i18n:translate="startdate">Start date:</td>
+ <td tal:content="python: request.locale.getDateFormatter('full').format(context.startdate)"></td>
+ </tr>
+
</table>
<table border=0>
@@ -29,3 +36,4 @@
</body>
</html>
+
=== Products3/demo/jobboardi18n/configure.zcml 1.9 => 1.10 ===
--- Products3/demo/jobboardi18n/configure.zcml:1.9 Thu Mar 20 16:10:08 2003
+++ Products3/demo/jobboardi18n/configure.zcml Tue Mar 25 16:59:55 2003
@@ -23,7 +23,7 @@
/>
<content class=".Job.Job">
- <allow interface="zopeproducts.demo.jobboard.IJob.IJob" />
+ <allow interface="zopeproducts.demo.jobboardi18n.I18nJob.I18nJob" />
</content>
<browser:page
@@ -46,7 +46,7 @@
<browser:page
name="index.html"
- for="zopeproducts.demo.jobboard.IJob.IJob"
+ for="zopeproducts.demo.jobboardi18n.I18nJob.I18nJob"
template="JobView.pt"
permission="zope.View"
/>
=== Products3/demo/jobboardi18n/edit.pt 1.1 => 1.2 ===
--- Products3/demo/jobboardi18n/edit.pt:1.1 Mon Jun 17 19:57:56 2002
+++ Products3/demo/jobboardi18n/edit.pt Tue Mar 25 16:59:55 2003
@@ -27,8 +27,18 @@
<td><input name="contact" type="text" value="" size="60">
</td>
</tr>
+ <tr><td i18n:translate="salary">Salary Range:</td>
+ <td><input name="salary" type="text" value="" size="60">
+ </td>
+ </tr>
+ <tr>
+ <td><span i18n:translate="startdate">Start Date</span><br>
+ (<span tal:replace="python:request.locale.getDateFormatter('short').getPattern()" />)</td>
+ <td><input name="startdate" type="text" value="" size="60">
+ </td>
+ </tr>
<tr><td colspan="2">
- <input type="submit" value="Preview" i18n:attributes="value">
+ <input type="submit" value="Preview" i18n:attributes="value=Preview">
</td>
</tr>
</table>
=== Products3/demo/jobboardi18n/preview.pt 1.2 => 1.3 ===
--- Products3/demo/jobboardi18n/preview.pt:1.2 Wed Jun 19 16:07:56 2002
+++ Products3/demo/jobboardi18n/preview.pt Tue Mar 25 16:59:55 2003
@@ -40,6 +40,15 @@
tal:attributes="href string:mailto:${request/contact}"
tal:content="request/contact">user@host.com</a></td>
</tr>
+ <tr><td i18n:translate="salary">Salary Range:</td>
+ <td tal:content="request/salary">
+ </td>
+ </tr>
+ <tr><td i18n:translate="startdate">Start Date:</td>
+ <td tal:content="request/startdate">
+ </td>
+ </tr>
+
</table>
<hr>
@@ -54,8 +63,12 @@
tal:attributes="value request/description" />
<input name="contact" type="hidden" value=""
tal:attributes="value request/contact" />
+ <input name="salary" type="hidden" value=""
+ tal:attributes="value request/salary" />
+ <input name="startdate" type="hidden" value=""
+ tal:attributes="value request/startdate" />
- <input type="submit" value="Submit" i18n:attributes="value" />
+ <input type="submit" value="Submit" i18n:attributes="value=Submit" />
</form>
=== Products3/demo/jobboardi18n/review.pt 1.1 => 1.2 ===
--- Products3/demo/jobboardi18n/review.pt:1.1 Mon Jun 17 19:57:56 2002
+++ Products3/demo/jobboardi18n/review.pt Tue Mar 25 16:59:55 2003
@@ -35,7 +35,7 @@
</div>
</tr>
<tr><td colspan="3">
- <input type="submit" value="Submit" i18n:attributes="value">
+ <input type="submit" value="Submit" i18n:attributes="value=Submit">
<a href="." i18n:translate="back-to-summary">Back to summary</a>
</td></tr>
</table>