dabo Commit
Revision 5198
Date: 2009-05-03 08:34:24 -0700 (Sun, 03 May 2009)
Author: Ed
Trac: http://trac.dabodev.com/changeset/5198
Changed:
U trunk/daboserver/appSource/orders/db/default.cnxml
U trunk/daboserver/appSource/orders/go.sh
U trunk/daboserver/appSource/people/biz/People.py
U trunk/daboserver/appSource/people/db/default.cnxml
U trunk/daboserver/appSource/people/ui/people-code.py
U trunk/daboserver/appSource/people/ui/people.cdxml
U trunk/daboserver/config/middleware.py
U trunk/daboserver/controllers/ActivitiesBizobj.py
U trunk/daboserver/controllers/PeopleBizobj.py
U trunk/daboserver/controllers/bizservers.py
U trunk/daboserver/public/index.html
Log:
These are all the changes made to the server code for PyCon 2009
Diff:
Modified: trunk/daboserver/appSource/orders/db/default.cnxml
===================================================================
--- trunk/daboserver/appSource/orders/db/default.cnxml 2009-05-02 12:20:40 UTC
(rev 5197)
+++ trunk/daboserver/appSource/orders/db/default.cnxml 2009-05-03 15:34:24 UTC
(rev 5198)
@@ -6,7 +6,7 @@
<connection dbtype="Web">
<name>Orders</name>
- <remotehost>http://localhost:7777</remotehost>
+ <remotehost>http://daboserver.com:7777</remotehost>
<host></host>
<database></database>
<user></user>
Modified: trunk/daboserver/appSource/orders/go.sh
===================================================================
--- trunk/daboserver/appSource/orders/go.sh 2009-05-02 12:20:40 UTC (rev
5197)
+++ trunk/daboserver/appSource/orders/go.sh 2009-05-03 15:34:24 UTC (rev
5198)
@@ -1,5 +1,5 @@
# go.sh
# launches the orders app.
cd /Users/ed/apps/daboserver/daboserver/appSource/orders
-python orders.py Orders
-# python orders.py --OpenAll
+python main.py Orders
+
Modified: trunk/daboserver/appSource/people/biz/People.py
===================================================================
--- trunk/daboserver/appSource/people/biz/People.py 2009-05-02 12:20:40 UTC
(rev 5197)
+++ trunk/daboserver/appSource/people/biz/People.py 2009-05-03 15:34:24 UTC
(rev 5198)
@@ -16,7 +16,6 @@
self.addField("id")
self.addOrderBy("lastname")
self.VirtualFields = {"fullname": self.getFullName}
- self.setWhereClause(" lastname like %s ")
def getFullName(self):
Modified: trunk/daboserver/appSource/people/db/default.cnxml
===================================================================
--- trunk/daboserver/appSource/people/db/default.cnxml 2009-05-02 12:20:40 UTC
(rev 5197)
+++ trunk/daboserver/appSource/people/db/default.cnxml 2009-05-03 15:34:24 UTC
(rev 5198)
@@ -4,15 +4,6 @@
xsi:schemaLocation="http://www.dabodev.com conn.xsd"
xsi:noNamespaceSchemaLocation = "http://dabodev.com/schema/conn.xsd">
- <connection dbtype="SQLite">
- <name>localpeople</name>
- <host></host>
- <database>/Users/ed/apps/pyworks.db</database>
- <user></user>
- <password></password>
- <port></port>
- </connection>
-
<connection dbtype="web">
<name>people</name>
<remotehost>http://daboserver.com:7777</remotehost>
Modified: trunk/daboserver/appSource/people/ui/people-code.py
===================================================================
--- trunk/daboserver/appSource/people/ui/people-code.py 2009-05-02 12:20:40 UTC
(rev 5197)
+++ trunk/daboserver/appSource/people/ui/people-code.py 2009-05-03 15:34:24 UTC
(rev 5198)
@@ -4,9 +4,9 @@
### 'Dabo Code ID: XXXX',
### as these are needed to link the code to the objects.
-## *!* ## Dabo Code ID: dButton-dForm
-def onHit(self, evt):
- self.Form.save()
+## *!* ## Dabo Code ID: dLabel-dPage
+def afterInit(self):
+ self.DynamicCaption = self.Form.getIncidentLabel
@@ -16,6 +16,36 @@
+## *!* ## Dabo Code ID: dDropdownList-dPage-196
+def afterInit(self):
+ self.PositionValue = 0
+
+
+
+## *!* ## Dabo Code ID: dDropdownList-dPage
+def afterInit(self):
+ self.PositionValue = 1
+
+
+
+## *!* ## Dabo Code ID: dLabel-dForm
+def afterInit(self):
+ pass
+
+
+
+## *!* ## Dabo Code ID: dButton-dForm-102
+def onHit(self, evt):
+ self.Form.cancel()
+
+
+
+## *!* ## Dabo Code ID: dButton-dForm
+def onHit(self, evt):
+ self.Form.save()
+
+
+
## *!* ## Dabo Code ID: dTextBox-dPage
def onKeyChar(self, evt):
if evt.keyCode == 13:
@@ -27,6 +57,7 @@
def afterInitAll(self):
self.searchText.setFocus()
+
def createBizobjs(self):
cxn = self.Application.getConnectionByName("people")
peopleBizobj = self.Application.biz.PeopleBizobj(cxn)
@@ -37,18 +68,49 @@
peopleBizobj.addChild(activitiesBizobj)
+def getIncidentLabel(self):
+ biz = self.PrimaryBizobj
+ try:
+ return "Incidents for: %s, %s" % (biz.getFieldVal("lastname"),
biz.getFieldVal("firstname"))
+ except dabo.dException.NoRecordsException:
+ return ""
+
+
def search(self):
txt = self.searchText.Value
if not txt:
self.searchText.setFocus()
return
- self.PrimaryBizobj.setParams("%%%s%%" % txt)
+ fld = {"Last Name": "lastname", "First Name":
"firstname"}[self.searchFld.StringValue]
+ opstring = self.searchOp.StringValue
+ if opstring == "Equals":
+ op = "="
+ else:
+ op = "ilike"
+ if opstring.startswith("Starts"):
+ txt = "%s%%" % txt
+ elif opstring.startswith("Ends"):
+ txt = "%%%s" % txt
+ else:
+ # Contains
+ txt = "%%%s%%" % txt
+
+ biz = self.PrimaryBizobj
+ whr = " %s %s %%s " % (fld, op)
+ biz.setWhereClause(whr)
+ biz.setParams((txt,))
self.requery()
+ cnt = biz.RowCount
+ if not cnt:
+ dabo.ui.info("No matches found for '%s'." % txt, "Nothing
matched")
+ else:
+ biz.RowNumber = 0
+ self.update()
-## *!* ## Dabo Code ID: dButton-dForm-905
+## *!* ## Dabo Code ID: dButton-dForm-750
def onHit(self, evt):
- self.Form.cancel()
+ self.Form.reload()
Modified: trunk/daboserver/appSource/people/ui/people.cdxml
===================================================================
--- trunk/daboserver/appSource/people/ui/people.cdxml 2009-05-02 12:20:40 UTC
(rev 5197)
+++ trunk/daboserver/appSource/people/ui/people.cdxml 2009-05-03 15:34:24 UTC
(rev 5198)
@@ -1,21 +1,21 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
-<dForm code-ID="dForm-top" CxnFile="path://../db/default.cnxml" Name="dForm"
Caption="Web People" SaveRestorePosition="False" Top="150" Height="617"
Width="544" designerClass="DesForm" CxnName="people" Left="448">
+<dForm code-ID="dForm-top" Name="dForm" Caption="Web People"
SaveRestorePosition="False" Top="140" Height="637" Width="615"
designerClass="DesForm" CxnName="people" Left="412">
<dSizer SlotCount="3" designerClass="LayoutSizer"
Orientation="Vertical">
- <dLabel FontBold="True" FontFace="Gill Sans" sizerInfo="{}"
Caption="Incident Reports" ForeColor="(0, 0, 255)" FontSize="24"
designerClass="controlMix" FontItalic="True"></dLabel>
+ <dLabel code-ID="dLabel-dForm" FontBold="True" FontFace="Gill
Sans" sizerInfo="{}" Caption="Fox Rocks!" ForeColor="purple" FontSize="24"
designerClass="controlMix" FontItalic="True"></dLabel>
<dPageFrame sizerInfo="{'VAlign': 'Middle'}"
designerClass="controlMix" PageCount="2">
<dPage Caption="People" designerClass="controlMix">
<dSizer SlotCount="3"
designerClass="LayoutSizer" Orientation="Vertical">
- <dBorderSizer
sizerInfo="{'BorderSides': ['All'], 'Proportion': 0, 'HAlign': 'Left',
'VAlign': 'Top', 'Border': 0, 'Expand': True}" Orientation="Horizontal"
Caption="Search" designerClass="LayoutBorderSizer" SlotCount="4"
DefaultBorder="8">
- <dPanel sizerInfo="{'VAlign':
'Top', 'Border': 8}" designerClass="LayoutSpacerPanel"></dPanel>
- <dTextBox RegID="searchText"
Width="327" sizerInfo="{'Border': 8}" code-ID="dTextBox-dPage"
designerClass="controlMix"></dTextBox>
+ <dBorderSizer
sizerInfo="{'BorderSides': ['All'], 'Proportion': 0, 'HAlign': 'Left',
'VAlign': 'Top', 'Border': 6, 'Expand': True}" Orientation="Horizontal"
Caption="Search" designerClass="LayoutBorderSizer" SlotCount="4"
DefaultBorder="8">
+ <dDropdownList
code-ID="dDropdownList-dPage" Width="116" sizerInfo="{'Proportion': 0}"
designerClass="controlMix" RegID="searchFld" Choices="[u'First Name',
u'Last Name']"></dDropdownList>
+ <dDropdownList
code-ID="dDropdownList-dPage-196" sizerInfo="{'Proportion': 0}"
Name="dDropdownList1" Choices="[u'Contains', u'Equals',
u'Starts with', u'Ends with']" Width="131"
designerClass="controlMix" RegID="searchOp"></dDropdownList>
+ <dTextBox RegID="searchText"
Width="226" sizerInfo="{'Border': 8}" code-ID="dTextBox-dPage"
designerClass="controlMix"></dTextBox>
<dButton
code-ID="dButton-dPage" Caption="Search" sizerInfo="{'Border': 8}"
designerClass="controlMix"></dButton>
- <dPanel sizerInfo="{'VAlign':
'Top', 'Border': 8}" designerClass="LayoutSpacerPanel"></dPanel>
</dBorderSizer>
<dGrid ColumnCount="2"
SelectionMode="Cell" designerClass="controlMix" DataSource="people"
sizerInfo="{'Border': 12}">
<dColumn Caption="First Name"
designerClass="controlMix" Order="0" DataField="firstname"></dColumn>
<dColumn Caption="Last Name"
designerClass="controlMix" Order="10" DataField="lastname"></dColumn>
</dGrid>
- <dGridSizer HGap="5"
sizerInfo="{'BorderSides': ['All'], 'Proportion': 3, 'HAlign': 'Left',
'VAlign': 'Top', 'Border': 20, 'Expand': True}" Rows="6"
designerClass="LayoutGridSizer" VGap="7" MaxDimension="R" Columns="2">
+ <dGridSizer HGap="5"
sizerInfo="{'BorderSides': ['All'], 'Proportion': 0, 'HAlign': 'Left',
'VAlign': 'Top', 'Border': 20, 'Expand': True}" Rows="6"
designerClass="LayoutGridSizer" VGap="7" MaxDimension="R" Columns="2">
<dLabel Caption="First"
sizerInfo="{'RowSpan': 1, 'ColSpan': 1, 'HAlign': 'Right'}"
designerClass="controlMix" rowColPos="(0, 0)"></dLabel>
<dTextBox
sizerInfo="{'RowSpan': 1, 'ColSpan': 1, 'Proportion': 0, 'HAlign': 'Left'}"
Name="dTextBox1" rowColPos="(0, 1)" designerClass="controlMix"
DataSource="people" DataField="firstname"></dTextBox>
<dLabel Caption="Last"
sizerInfo="{'RowSpan': 1, 'ColSpan': 1}" designerClass="controlMix"
Name="dLabel1" rowColPos="(1, 0)"></dLabel>
@@ -32,7 +32,8 @@
</dSizer>
</dPage>
<dPage Caption="Incidents" designerClass="controlMix"
Name="dPage1">
- <dSizer SlotCount="2"
designerClass="LayoutSizer" Orientation="Vertical">
+ <dSizer SlotCount="3"
designerClass="LayoutSizer" Orientation="Vertical">
+ <dLabel code-ID="dLabel-dPage"
sizerInfo="{'Border': 8}" Name="dLabel3" Caption="Incidents for ..."
FontSize="18" designerClass="controlMix" FontItalic="True"></dLabel>
<dGrid ColumnCount="3"
SelectionMode="Cell" designerClass="controlMix" DataSource="activities"
sizerInfo="{'HAlign': 'Left'}">
<dColumn Caption="Details"
designerClass="controlMix" Order="0" DataField="details"></dColumn>
<dColumn Caption="Date"
designerClass="controlMix" Order="10" DataField="reported_date"></dColumn>
@@ -49,9 +50,10 @@
</dSizer>
</dPage>
</dPageFrame>
- <dBorderSizer SlotCount="2" Caption="Controls"
sizerInfo="{'BorderSides': ['All'], 'Proportion': 0, 'HAlign': 'Right',
'VAlign': 'Top', 'Border': 6, 'Expand': False}"
designerClass="LayoutBorderSizer" Orientation="Horizontal">
+ <dBorderSizer SlotCount="3" Caption="Controls"
sizerInfo="{'BorderSides': ['All'], 'Proportion': 0, 'HAlign': 'Right',
'VAlign': 'Top', 'Border': 6, 'Expand': False}"
designerClass="LayoutBorderSizer" Orientation="Horizontal">
<dButton code-ID="dButton-dForm" Caption="Save"
sizerInfo="{'Border': 5}" designerClass="controlMix" Name="dButton1"></dButton>
- <dButton code-ID="dButton-dForm-905" Caption="Cancel"
sizerInfo="{'Border': 5}" designerClass="controlMix"></dButton>
+ <dButton code-ID="dButton-dForm-102" Caption="Cancel"
sizerInfo="{'Border': 5}" designerClass="controlMix"></dButton>
+ <dButton code-ID="dButton-dForm-750" Caption="Reload"
sizerInfo="{'Border': 5}" designerClass="controlMix" Name="dButton2"></dButton>
</dBorderSizer>
</dSizer>
</dForm>
Modified: trunk/daboserver/config/middleware.py
===================================================================
--- trunk/daboserver/config/middleware.py 2009-05-02 12:20:40 UTC (rev
5197)
+++ trunk/daboserver/config/middleware.py 2009-05-03 15:34:24 UTC (rev
5198)
@@ -5,7 +5,8 @@
from paste.urlparser import StaticURLParser
from paste.deploy.converters import asbool
from pylons import config
-from pylons.middleware import ErrorHandler, StatusCodeRedirect
+#from pylons.middleware import ErrorHandler, StatusCodeRedirect
+from pylons.middleware import StatusCodeRedirect
from pylons.wsgiapp import PylonsApp
from routes.middleware import RoutesMiddleware
@@ -45,7 +46,7 @@
if asbool(full_stack):
# Handle Python exceptions
- app = ErrorHandler(app, global_conf, **config['pylons.errorware'])
+ #app = ErrorHandler(app, global_conf, **config['pylons.errorware'])
# Display error documents for 401, 403, 404 status codes (and
# 500 when debug is disabled)
Modified: trunk/daboserver/controllers/ActivitiesBizobj.py
===================================================================
--- trunk/daboserver/controllers/ActivitiesBizobj.py 2009-05-02 12:20:40 UTC
(rev 5197)
+++ trunk/daboserver/controllers/ActivitiesBizobj.py 2009-05-03 15:34:24 UTC
(rev 5198)
@@ -5,12 +5,18 @@
class ActivitiesBizobj(dabo.biz.RemoteBizobj):
def defineConnection(self):
+# self.setConnectionParams(
+# dbType="MySQL",
+# database="webtest",
+# host="dabodev.com",
+# user="webuser",
+# plainTextPassword="foxrocks")
self.setConnectionParams(
- dbType="MySQL",
+ dbType="PostgreSQL",
database="webtest",
- host="dabodev.com",
+ host="localhost",
user="webuser",
- plainTextPassword="foxrocks")
+ plainTextPassword="foxrox")
def validateRecord(self):
Modified: trunk/daboserver/controllers/PeopleBizobj.py
===================================================================
--- trunk/daboserver/controllers/PeopleBizobj.py 2009-05-02 12:20:40 UTC
(rev 5197)
+++ trunk/daboserver/controllers/PeopleBizobj.py 2009-05-03 15:34:24 UTC
(rev 5198)
@@ -6,14 +6,16 @@
class PeopleBizobj(dabo.biz.RemoteBizobj):
def defineConnection(self):
self.setConnectionParams(
- dbType="MySQL",
+ dbType="PostgreSQL",
database="webtest",
- host="dabodev.com",
+ host="localhost",
user="webuser",
- plainTextPassword="foxrocks")
+ plainTextPassword="foxrox")
def validateRecord(self):
"""Place record validation code here"""
- pass
+ if "leafe" in self.Record.lastname.lower():
+ return "Keep Leafe out of here!"
+
Modified: trunk/daboserver/controllers/bizservers.py
===================================================================
--- trunk/daboserver/controllers/bizservers.py 2009-05-02 12:20:40 UTC (rev
5197)
+++ trunk/daboserver/controllers/bizservers.py 2009-05-03 15:34:24 UTC (rev
5198)
@@ -1,6 +1,7 @@
import logging
import pickle
import os
+import sys
import time
import tempfile
from zipfile import ZipFile
@@ -51,7 +52,13 @@
# The path to the server copy of the web application source files *MUST* be
# defined here. It is used to compare local app manifests in order to
# determine what changes, if any, have been made to the app.
-sourcePath = os.path.join(os.getcwd(), "daboserver/appSource")
+cd = os.getcwd()
+if cd == "/":
+ # Running as an egg through WSGI
+ cd = [p for p in sys.path
+ if "daboserver" in p][0]
+home_dir = os.path.join(cd, "daboserver")
+sourcePath = os.path.join(home_dir, "appSource")
@@ -132,8 +139,7 @@
def getFileRequestDB(self):
- curr = os.getcwd()
- db = os.path.join(curr, "DaboFileCache.db")
+ db = os.path.join(home_dir, "DaboFileCache.db")
cxn = dabo.db.dConnection(connectInfo={"DbType": "SQLite",
"Database": db},
forceCreate=True)
cursor = cxn.getDaboCursor()
@@ -146,7 +152,7 @@
dirnames = [d for d in os.listdir(sourcePath)
if not d.startswith(".")]
return jsonEncode(dirnames)
-
+
crs = self.getFileRequestDB()
enclocal = request.params.get("current", "")
try:
Modified: trunk/daboserver/public/index.html
===================================================================
--- trunk/daboserver/public/index.html 2009-05-02 12:20:40 UTC (rev 5197)
+++ trunk/daboserver/public/index.html 2009-05-03 15:34:24 UTC (rev 5198)
@@ -4,7 +4,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
- <title>Welcome to Pylons!</title>
+ <title>Welcome to Dabo over the Web!</title>
<style type="text/css">
body {
font-family: arial, helvetica, sans-serif;
@@ -96,10 +96,10 @@
</head>
<body>
<div id="container">
- <h1>Welcome to <img src="pylons-logo.gif" alt="Logo displaying the
word Pylons"
- style="vertical-align:-15px; width: 250px;"/>
+ <h1>Welcome to <b>Dabo</b>
</h1>
<hr/>
+<!--
<div id="left">
<h2>Let's begin!</h2>
<p>If you haven't used Pylons before, start with the <a
href="http://docs.pylonshq.com/gettingstarted.html"
@@ -132,6 +132,7 @@
<a href="http://www.pylonshq.com" style="color: #ccc;
text-decoration:none;"
>www.pylonshq.com</a>
</div>
+-->
</div>
</body>
</html>
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message:
http://leafe.com/archives/byMID/[email protected]