[Zope] - Sort date in gadfly/zope

FR Chalaoux chalaouxf@synbio.tpgnet.net
Mon, 1 Feb 1999 09:47:59 +0100


<FontFamily><param>Courier</param><bigger>Hi All,


FR Chalaoux wrote :


As you know a gadfly database has no 
date type for the moment.

Thus, as Aaron Watters recommanded, 
sort date is possible if you 

construct a date string with the 
format 'YY:MM:DD'(without quote).


Paul Everitt wrote :


Is it possible to construct this 
string date on the fly in an SQL 

method or is it an other solution?


Yes, use the object-relational 
integration described at:



<underline><color><param>0000,8000,0000</param>http://www.zope.org/Documen=
tation/Guide
s/ZSQL/ZSQL-HTML/ZSQL.html#pgfId-

</underline></color>936577


Basically, just write a Python class 
with a method that does what you

want.


=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

That's my resulting work :


I did it on the Page 19 model from 
ZSQL.pdf file but it does not 

work :(



=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

New External Method

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

<<HTML>

<<HEAD>

<<TITLE>New External Method<</TITLE>

        <<base 
href=3D"http://srnoix:9673/DBTest/">

<</HEAD>

<<BODY BGCOLOR=3D"#FFFFFF" LINK=3D"#000099" 

VLINK=3D"#555555" ALINK=3D"#77003B">


<<h2>New External Method<</h2>


<<FORM 
ACTION=3D"manage_addExternalMethod" 

METHOD=3D"POST">

<<TABLE CELLSPACING=3D"2">

<<TR>

  <<TH ALIGN=3D"LEFT" VALIGN=3D"TOP">Id<</TH>

  <<TH ALIGN=3D"LEFT" VALIGN=3D"TOP"><<INPUT 
TYPE=3D"TEXT" 

NAME=3D"id" SIZE=3D"50" 
value=3D"datastring"><</TH>

<</TR>

<<TR>

  <<TH ALIGN=3D"LEFT" 
VALIGN=3D"TOP"><<EM>Title<</EM><</TH>

  <<TD ALIGN=3D"LEFT" VALIGN=3D"TOP"><<INPUT 
TYPE=3D"TEXT" 

NAME=3D"title" SIZE=3D"50" value=3D"Gadfly 
date"><</TD>

<</TR>

<<tr>    <<th ALIGN=3D"LEFT">Function 
name<</th>

        <<td ALIGN=3D"LEFT"><<input 
name=3D"function" size=3D"30" 

value=3D"datastring"><</td><</tr>

<<tr>    <<th ALIGN=3D"LEFT">Python module 
file<</th>

        <<td ALIGN=3D"LEFT"><<input 
name=3D"module" size=3D"30" 

value=3D"datastring"><</td><</tr>

<<TR>

<<TD><</TD>

<<TD><<BR><<INPUT TYPE=3D"SUBMIT" 
VALUE=3D"Add"><</TD>

<</TR>

<</TABLE>

<</FORM>

<</BODY>

<</HTML>


=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

Extension/datastring.py

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

class datastring:

	

def datastring(self)

"""Create a new string composed with 
data from my gadfly table

"""

return year + ':' + month + ':' + day



=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

Error

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

<<html>

<<head>

<<title>exceptions.AttributeError<</title
>

<</head>

<<body>

Sorry, an error occurred.<<p>

<<!--

Traceback (innermost last):

  File /opt/digicool/zope/Zope-1.9.0-

src/lib/python/ZPublisher/Publish.py, 
line 879, in publish_module

  File /opt/digicool/zope/Zope-1.9.0-

src/lib/python/ZPublisher/Publish.py, 
line 595, in publish

    (Info: 
/DBTest/manage_addExternalMethod)

  File /opt/digicool/zope/Zope-1.9.0-

src/lib/python/Products/ExternalMethod/
ExternalMethod.py, line 

137, in manage_addExternalMethod

    (Object: Navigation)

  File /opt/digicool/zope/Zope-1.9.0-

src/lib/python/Products/ExternalMethod/
ExternalMethod.py, line 

179, in __init__

    (Object: Item)

  File /opt/digicool/zope/Zope-1.9.0-

src/lib/python/Products/ExternalMethod/
ExternalMethod.py, line 

198, in manage_edit

    (Object: Item)

  File /opt/digicool/zope/Zope-1.9.0-

src/lib/python/Products/ExternalMethod/
ExternalMethod.py, line 

215, in getFunction

    (Object: Item)

AttributeError: func_defaults


-->

<</body>

<</html>






Fran=E7ois-R=E9gis Chalaoux
Bioinformatics Group
Synth=E9labo Biomol=E9culaire
67080 Strasbourg Cedex
FRANCE
T=E9l : 03 88 60 87 14
Fax : 03 88 45 90 70