Welcome.

Normally in web2py you define a model

   db.define_table('message',Field('body'))

and then web2py generates and processes forms for you:

   form=SQLFORM(db.message)
   if form.accepts(request.vars):
         do_something

In your case you would not use define_table because web2py DAL does
not support SOLR and you cannot generate forms from the schema but you
can install this:
http://code.google.com/p/solrpy/
and you can do

   #in model
   import solr
   s = solr.SolrConnection('http://example.org:8083/solr')

    #in controller
    form=SQLFORM.factory(Field('body'))
    if form.accepts(request.vars):
          s.add(mody=request.vars.body)
          s.commit()
          do_something

So the difference is SQLFORM.factory instead of SQLFORM and the extra
line after accepts. That is it.

On Sep 2, 4:05 pm, harryf <[email protected]> wrote:
> This is kind of a re-post of a question I asked on stackoverflow 
> -http://stackoverflow.com/questions/3630641/whats-the-most-productive-...
> which Massimo invited me to ask here.
>
> To repeat, I want to build a web app using SOLR as the backend ( no
> RDBMS or other backend ). Most of the data will be stored in SOLR via
> offline jobs but there is some need for CRUD from the web app. The
> schema will probably move fairly slowly ( in fact it already exists )
> so creating / changing models manually is acceptable from a
> maintenance point of view.
>
> Have only got so far as a web2py "Hello World" so don't have deep
> insight but would appreciate any hints on how this might be
> accomplished in web2py. Also if anyone has any general experience of
> using web2py with a RESTful backend as the primary data source, would
> be great to hear about it.
>
> Thanks.

Reply via email to