I'd recommend you use the LOAD helper instead of ajax. If you repost
your more current code I will try help.

On Jan 23, 9:10 am, web-dev-m <mgrave...@gmail.com> wrote:
> Massimo,
>
> Thank you very much for your reply.  I have made the changes to my
> code, but it still didn't solve my problem with the AJAX call not
> working.  Any suggestions?
>
> On Jan 21, 11:40 pm, Massimo Di Pierro <massimo.dipie...@gmail.com>
> wrote:
>
>
>
>
>
>
>
> > In your code you have many calls to this:
>
> >    db(db.mydb.id==request.args(0)).select().first()
>
> > which could be simplified into the equivalent expression
>
> >    db.mydb(request.args(0))
>
> > You also have this:
>
> >     records=db(db.mydb.id==request.args(0)).select()
> >     ...
> >     counter=len(records)
>
> > but id is unique so counter is always only 1 or 0.
>
> > You also have:
>
> >         check=db(db.mydb.id==request.args(0)).select().first()
> >         if check !=None:
> >             ....
> >         else:
> >             row = db(db.mydb.id==request.args(0)).select().first()
>
> > so row is exactly like check and therefore always None.
>
> > Basically you code is equivalent to this:
>
> > def my_func():
> >     if request.args:
> >         row = db.mydb(request.args(0))
> >         counter = 1 if row else 0
> >         if not row: # should be if row?
> >             my_id=row.id # always fails!
> >             (filename, stream)
> > = db.mydb.myfield.retrieve(row.resourcefield)
> >             myfunc(id,filename,stream)
> >     else:
> >         redirect(URL('mycontroller','this_function'))
> >     records = [row] if row else []
> >     return(counter=counter, records=recods, row=row)
>
> > On Jan 21, 5:54 am, web-dev-m <mgrave...@gmail.com> wrote:
>
> > > Dear Massimo,
>
> > > Thank you in advance for your time just looking.  If I can write a
> > > functional web application, you must be brilliant to have created this
> > > software.
>
> > > I am essentially trying to write a google docs clone with the ability
> > > to add notes.
>
> > > My users upload documents which a python function uses, modifies, and
> > > then stores the text in the database.  The view displays the text from
> > > the page in a set of divs.  I then use AJAX to create a note on the
> > > side via a form.
>
> > > The text from the document and the document title/file are in
> > > different tables.  Also, there is not guaranteed to be file text yet,
> > > as not every user that uploads a file will need to see the text, so I
> > > upload the file and get the text in two separate functions.
>
> > > My workflow is:
>
> > > 1.) check to see if file exists in database
> > > 2.) IF it doesnt, make it, and store the text in a table, then get the
> > > text fields.
> > > 3.) IF it does, get the text fields from one table and the filename
> > > from another
> > > 4.) Display file text in the view
>
> > > I then use AJAX to add a form which allows the user to add a note next
> > > to the text.

Reply via email to