Rushabh Mehta | 3a751e8 | 2012-01-27 18:00:14 +0530 | [diff] [blame] | 1 | import webnotes |
Rushabh Mehta | f17ce7b | 2012-02-13 16:50:52 +0530 | [diff] [blame] | 2 | |
| 3 | @webnotes.whitelist() |
Rushabh Mehta | 3a751e8 | 2012-01-27 18:00:14 +0530 | [diff] [blame] | 4 | def subscribe(arg): |
| 5 | """subscribe to blog (blog_subscriber)""" |
| 6 | if webnotes.conn.sql("""select name from `tabBlog Subscriber` where name=%s""", arg): |
| 7 | webnotes.msgprint("Already a subscriber. Thanks!") |
| 8 | else: |
| 9 | from webnotes.model.doc import Document |
| 10 | d = Document('Blog Subscriber') |
| 11 | d.name = arg |
| 12 | d.save() |
| 13 | webnotes.msgprint("Thank you for subscribing!") |