email notification and abstract methods

nemilya <nemilya-JGs/[email protected]> Sat, 15 Nov 2003 11:19:20 +0500
Newsgroups gmane.comp.web.syncato.general
Organization home
Message-ID <[email protected]>
About story of sending email notification

I think that for email notification have to be list of subscribed
users. F.e. 'user-subscribe.xml', with 'id', 'email', 'activated')
also possible for activation logic additional xml storage
'user-activation-code.xml' is needed:

<user-activate-code>
  <user id="1" code="qweDwerwr23ff"/>
  ...
</user-activate-code>

Also in 'config.xml' parameter:
    <allow-subscribe>yes</allow-subscribe>

If this parametr 'yes', on blog's pages will be showen form for subscribe,
and on new post will be sending notifications.

Usecase 'user subscription'
1. on any blog's page user see 'subscribe form', user submit this form
   with self email address
2. in user-subscribe.xml added record from form, with 'activated'='no',
   also is generated record to user-activation-code.xml (@code)
3. to user is send email notification with code
4. user take email with url with code, user going to url with code
  taking answer from user , checking  @code from
  user-activation-code.xml and if code is ok -
XPath (not valid):
user-subscribe.xml/users/user[
  @id=user-activation-code.xml/user-activate-code/user[@code=$codeFromRequest]/@id
]/@activated='yes'

Usecase 'send notification on new post in blog' (on post message to blog):
1. for each user's email from 'user-subscribe.xml' (which is activated)
send notification about new post (with url)

Note: also possible to subscription to posts of specific category.

Implementation:

To Weblog.addPost() after
if (ping == 1):
    self.pingWeblogs()

add some like:
if (emailNotification == 1):
    self.emailNotification(postID)

method 'emailNotification' implements usecase  'send notification on new post in blog'

Also on comment we dont need to send notifications to subscribed users
(or needed?).

at Weblog.addPost() there is argument 'ping = 1', which is 0 when is
added comment (servlets/open/Comment.py):
method 'respondToPost' is execuded on submit of comment's form,
calls 'respondToGet',
in this method the comment is added to xml database:
self.weblog.addPost(content, 0)


Possible we have to send notification to blog's author on comments.
Possible for this is needed new parameter in config.


Summary:
1. notification to user on new post in blog
2. notification to blog's author on comments to blog's record
3. notification to user on new comments in specified blog's record

I think possible to find 'common denominator' of this 3 notifications.

Is this have rational?


About code.

Code is very nice.

One note: BaseDatabase.py is abstract class for manage xml db.

But abstract function are not marked out in code of this class.
I think it would be clearer for understunding, if add to BaseDatabase.py:

def shutdown(self):
    # abstract
    pass

def getRecord(self, recordID):
    # abstract
    pass

def addRecord(self, record):
    # abstract
    pass

def updateRecord(self, recordID, record):
    # abstract
    pass

def deleteRecord(self, recordID):
    # abstract
    pass

def getPathData(self, xpath):
    # abstract
    pass


Ilya




-------------------------------------------------------
This SF. Net email is sponsored by: GoToMyPC
GoToMyPC is the fast, easy and secure way to access your computer from
any Web browser or wireless device. Click here to Try it Free!
https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/g22lp.tmpl