that error is raised when an smtpserver is not configured (usually
mail.settings.server)
On Monday, April 25, 2016 at 10:57:50 PM UTC+2, Bhanu Teja P wrote:
>
> db.py
> db = DAL('sqlite://storage.sqlite')
>
> from gluon.tools import Auth
> auth = Auth(db)
>
>
> auth.settings.extra_fields['auth_user']= [
> Field('city'),
> Field('zip'),
> Field('phone_number')
> ]
> auth.define_tables(username=True)
>
>
>
> db.define_table('note',
> Field('author','reference auth_user', default=auth.user_id),
> Field('title','string'),
> Field('note', 'text'),
> Field('datetime','datetime',default = request.now)
> )
>
> db.define_table('post',
> Field('note_id','reference note'),
> Field('author','reference auth_user',
> default=auth.user_id),
> Field('comment','text'))
>
> db.post.note_id.readable = db.post.note_id.writable = False
> db.post.author.readable = db.post.author.writable = False
> db.note.title.requires = IS_NOT_IN_DB(db,db.note.title)
> db.note.title.requires = IS_NOT_EMPTY()
> db.note.note.requires = IS_NOT_EMPTY()
> db.note.author.readable = db.note.author.writable = False
> db.post.comment.requires = IS_NOT_EMPTY()
>
>
>
> default.py
>
> @auth.requires_login()
> def index():
> form = SQLFORM(db.note)
> if form.process().accepted:
> response.flash = 'Your Note is added'
> notes = db().select(db.note.ALL)
> return dict(notes=notes,form=form)
>
> @auth.requires_login()
> def show():
> note = db.note(request.args(0)) or redirect(URL('index'))
> return dict(note=note)
>
> def comments():
> note = db.note(request.args(0)) or redirect(URL('index'))
> db.post.note_id.default = note.id
> form = SQLFORM(db.post)
> if form.process().accepted:
> response.flash = 'Your Comment is posted'
> comments = db(db.post.note_id == note.id).select()
> return dict(note=note,comments=comments,form=form)
>
> def delete():
> query = db(db.note.id==request.args(0)).select().first()
> remove = db(db.note.id==query).delete()
> if remove:
> redirect(URL('index'))
> return dict(remove=remove)
>
> def edit():
> this_note = db.note(request.args(0,cast=int)) or redirect(URL('index'))
> form = SQLFORM(db.note, this_note).process(
> next = URL('index'))
> return dict(form=form)
>
> def delete_comment():
> query = db(db.post.id==request.args(0)).select().first()
> remove = db(db.post.id==query).delete()
> if remove:
> redirect(URL('comments'))
> return dict(remove=remove)
>
> def edit_comment():
> this_post = db.post(request.args(0,cast=int)) or
> redirect(URL('comments'))
> form = SQLFORM(db.post, this_post).process(
> next = URL('comments'))
> return dict(form=form)
>
> def download():
> return response.download(request,db)
>
> def user():
> return dict(form=auth())
>
> def search():
> return dict(form=FORM(INPUT(_id='keyword',_name='keyword',
> _onkeyup="ajax('callback', ['keyword'],
> 'target');")),
> target_div=DIV(_id='target'))
> def callback():
> query = db.note.title.contains(request.vars.keyword)
> notes = db(query).select(orderby=db.note.title)
> links = [A(n.title, _href=URL('show',args=n.id)) for n in notes]
> return UL(*links)
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.