Dear all,

  i hope i finally cleared all errors and glitches.
Please use attached file instead that one i sent earlier as with this one
you will be able to delpoy to GAE
fix was casting row[0].xmldata to string as without that GAE would not do
auto cast correctly for some reason...

            #return row[0].xmldata             #does NOT work
            return "%s" % row[0].xmldata  # works perfectly...

fixing robots.txt and favicon.ico on GAE was struggle too... put these in
app.yaml and put your path of application inside (instead bolded init)
------------------------------------------------------------------------------------------------------------------
- url: /robots.txt
  static_files: applications/*init*/static/robots.txt
  upload: applications/*init*/static/robots.txt

- url: /favicon.ico
  static_files: applications/*init*/static/favicon.ico
  upload: applications/*init*/static/robots.txt
------------------------------------------------------------------------------------------------------------------


On Mon, Sep 14, 2009 at 11:58 PM, Boris Manojlovic <
[email protected]> wrote:

> After quick check on GAE i found out a small error in output.xsl please
> edit output.xsl or patch it with included patch.
>
> Boris
>
>
> On Mon, Sep 14, 2009 at 8:56 PM, Boris Manojlovic <
> [email protected]> wrote:
>
>> Hello community,
>>
>>  after few months I'm happy to announce that new version of SQL WWW
>> Developer is possible to integrate into web2py without need to patch web2py
>> nor www sql designer code.
>> Attached files in web2py-backend.tar.gz should replace default files in
>> wwwsqldesigner-2.3.3.zip<http://wwwsqldesigner.googlecode.com/files/wwwsqldesigner-2.3.3.zip>
>> in folder <unpacked_wwwsqldesigner>/db/web2py.
>> Process of integration into web2py is following:
>>
>> 1. Download web2py <http://web2py.com/examples/static/web2py_src.zip> and
>> unpack (doh)
>> 2. create application named designer for example (no hard-coding of names
>> needed anymore)
>> 3. change dir to <application_name>/static/
>> 4. Download and unpack wwwsqldesigner-2.3.3.zip and rename folder to
>> designer (  that is needed if you don't want to change default.py code)
>> 5. cd designer/db/web2py and unpack web2py-backend.tar.gz file from this
>> email.
>> 6. cd designer/js/ and edit it so it looks like this snipper bellow
>>
>> ---------------------------------------------------------------------------------------------------------
>> var CONFIG = {
>>     AVAILABLE_DBS:["mysql","sqlite","web2py","mssql","postgresql"],
>>     DEFAULT_DB:"*web2py*",
>>
>>     AVAILABLE_LOCALES:["en","fr","de","cs","pl","pt_BR","es", "ru","eo"],
>>     DEFAULT_LOCALE:"en",
>>
>>     AVAILABLE_BACKENDS:["php-mysql","php-blank","php-file","php-sqlite","
>> *web2py*"],
>>     DEFAULT_BACKEND:["*web2py*"],
>>
>>     RELATION_THICKNESS:2,
>>     RELATION_SPACING:15,
>>
>>     STATIC_PATH: "",
>>     XHR_PATH: "*../../default/*"
>> }
>>
>> ---------------------------------------------------------------------------------------------------------
>>
>> 7. edit ( from web gui or from console ) *models/db.py* and add table
>> definition:
>>
>> ---------------------------------------------------------------------------------------------------------
>> db.define_table("tbldata",
>>     Field("tblname", "string", default="tabela"),
>>     Field("changed", "datetime", default=request.now),
>>     Field("xmldata", "blob"))
>>
>> ---------------------------------------------------------------------------------------------------------
>> 8. replace *controllers/default.py* with code attached ( default.py) -
>> adding backend for web2py and redirection to static/designer/index.html
>> 9a. Go to http://<YOUR_IP>/<appname>/ and enjoy creating tables visually
>> 9b. Buy beer or some cocktail to me when in Belgrade, Serbia :) (and to
>> Ondrej as he created this great tool)
>>
>> FIXES:
>> data types fixes (removal of timestamp),
>> many XSL fixes;
>>         - relations are working now as they should - no need to remove
>> anything from "relations" line if you are lazy it should just work :),
>>         - tables without relation will be first on list of created tables
>> as needed by web2py - when this is not a case web2py will error out.
>>         - password fields will not be mapped to select box by design!!
>>         - some defaults are mapped correctly - still watch out for single
>> quotes!
>>
>>
>> Boris Manojlovic
>>
>> --
>> "Only two things are infinite, the universe and human stupidity, and I'm
>> not sure about the former."-Albert Einstein
>>
>
>
>
> --
> "Only two things are infinite, the universe and human stupidity, and I'm
> not sure about the former."-Albert Einstein
>
> for words in '' clean up forwarded e-mail before forwarding it to your
> friends '';do BR=$(($( od -N 2 -t o2 /dev/urandom |grep -v 0000002|cut -d "
> "  -f 2|cut -b 3) + 1)) ; printf "%0.${BR}s %s\n" ">>>>>" ${words} ;done
>



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

for words in '' clean up forwarded e-mail before forwarding it to your
friends '';do BR=$(($( od -N 2 -t o2 /dev/urandom |grep -v 0000002|cut -d "
"  -f 2|cut -b 3) + 1)) ; printf "%0.${BR}s %s\n" ">>>>>" ${words} ;done

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

# coding: utf8                                                       

#########################################################################
## This is a samples controller                                          
## - index is the default action of any application                      
## - user is required for authentication and authorization                                                                                                                              
## - download is for downloading files uploaded in the db (does streaming)                                                                                                              
## - call exposes all registered services (none by default)                                                                                                                             
#########################################################################                                                                                                               
                                                                                                                                                                                        
def index():                                                                                                                                                                            
    redirect(URL(r=request,c='static',f='designer/index.html',vars=request.vars))

def user():
    return dict(form=auth())                                    


def download():
    return response.download(request,db)         


def call():
    session.forget()
    return service()

def backend():
    import re
    if request.vars.action == "save": # api is URL?action=save&keyword=schemaname
        if re.compile('[^0-9a-zA-Z]').findall(request.vars.keyword):
            raise HTTP(503, 'NOT SAVED! use [0-9a-zA-Z] for project names only... ')
        name = db(db.tbldata.tblname == request.vars.keyword).select(db.tbldata.tblname)
        if len(name) != 0:
            db(db.tbldata.tblname==request.vars.keyword).update(
                              tblname=request.vars.keyword,
                              changed=request.now,
                              xmldata=request.body.read()
                          )
        else:
            db.tbldata.insert(tblname=request.vars.keyword,
                              changed=request.now,
                              xmldata=request.body.read()
                          )
        raise HTTP(201, "Model has been saved...")
        #request.body.read()
    elif request.vars.action == "list": # api is URL?action=list
        rows = db().select(db.tbldata.ALL)
        names = ""
        for row in rows:
            if names == "":
                names = row.tblname
                continue
            names = names + "\n" + row.tblname
            response.headers['Content-Type'] = 'text/plain'
        return names
    elif request.vars.action == "load":               # api is URL?action=load&keyword=schemaname
        row = db(db.tbldata.tblname == request.get_vars.keyword).select(db.tbldata.xmldata)
        if len(row) != 0 :
            response.headers['Content-Type'] = 'application/xml'
            #return row[0].xmldata        # without cast it errors out with Blob does not have items attribute????
            return "%s" % row[0].xmldata  # when casted to string it works on GAE....
        else:
            raise HTTP(404,T('Model Not found...'))
    elif request.vars.action == "import":     # api is URL?action=import&database=somedatabasename
        raise HTTP(501,T("Not implemented"))

Reply via email to