change to xslt file

--- output.xsl-orig     2013-01-07 01:58:23.000000000 +0000
+++ output.xsl  2013-01-07 01:50:44.000000000 +0000
@@ -85,10 +85,11 @@
                                                </xsl:when>
                                                <xsl:otherwise>
                                                        <xsl:value-of
select="@name"/>
-                                                       <xsl:text>",
dbOBJECT.</xsl:text>
+                                                       <xsl:text>",
"reference </xsl:text>
                                                        <xsl:for-each
select="relation">

<xsl:value-of select="@table"/>
                                                        </xsl:for-each>
+
<xsl:text>"</xsl:text>
                                                </xsl:otherwise>
                                        </xsl:choose>
                                </xsl:when>
@@ -119,7 +120,7 @@
                <xsl:text>    dbOBJECT =
DAL('gae')                           # connect to Google BigTable
&#xa;</xsl:text>
                <xsl:text>    session.connect(request, response,
db=dbOBJECT) # and store sessions and tickets there &#xa;</xsl:text>

<xsl:text>else:                                               # else use a
normal relational database &#xa;</xsl:text>
-               <xsl:text>    dbOBJECT =
SQLDB("sqlite://dbOBJECT.db")&#xa;&#xa;</xsl:text>
+               <xsl:text>    dbOBJECT =
DAL("sqlite://dbOBJECT.db")&#xa;&#xa;</xsl:text>
                <!-- doing two pass: first ignore tables with relations as
they will raise exception if table referenced still does not exist (not
instantiated) -->
                <!-- this is not bullet proff but should be sufficient for
small projects will be in TODO :) -->
                <xsl:for-each select="table">

and again generated output is:

""" database class object creation (initialization) """
if request.env.web2py_runtime_gae:                  # if running on Google
App Engine
    dbOBJECT = DAL('gae')                           # connect to Google
BigTable
    session.connect(request, response, db=dbOBJECT) # and store sessions
and tickets there
else:                                               # else use a normal
relational database
    dbOBJECT = DAL("sqlite://dbOBJECT.db")

dbOBJECT.define_table("category",
    Field("name", "string", default=None))

dbOBJECT.define_table("product",
    Field("id_category", "reference category"),
    Field("name", "string", default=None))

""" Relations between tables (remove fields you don't need from requires)
"""
dbOBJECT.product.id_category.requires=IS_IN_DB( dbOBJECT, 'category.id', '
%(name)s')



On Mon, Jan 7, 2013 at 2:39 AM, Bruno Rocha <rochacbr...@gmail.com> wrote:

> This syntax is deprecated, still worls, but it is now deprecated. Should
> be:
>
>
>
> """ database class object creation (initialization) """
> if request.env.web2py_runtime_
> gae:                  # if running on Google App Engine
>     db = *DAL*('gae')                           # connect to Google
> BigTable
>     session.connect(request, response, db=db) # and store sessions and
> tickets there
> else:                                               # else use a normal
> relational database
>     db = *DAL*("sqlite://db.db")
>
> db.define_table("category",
>
>     Field("name", "string", length=50, default='Not known'))
>
> db.define_table("product",
>     Field("id_category",* "reference category"*),
>
>     Field("name", "string", default=None))
>
> """ Relations between tables (remove fields you don't need from requires)
> """
> db.product.id_category.requires=IS_IN_DB( db, 'category.id', ' %(name)s')
>
>  --
>
>
>
>



-- 
"Only two things are infinite, the universe and human stupidity, and I'm
not sure about the former."-Albert Einstein

-- 



Reply via email to