Subversion Repositories SmartDukaan

Rev

Rev 17490 | Rev 18247 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 17490 Rev 18020
Line 115... Line 115...
115
                json_result =  json.loads(urllib2.urlopen(pushpostrequest).read())
115
                json_result =  json.loads(urllib2.urlopen(pushpostrequest).read())
116
                notificationRecord.url = json_result['url']
116
                notificationRecord.url = json_result['url']
117
                logging.debug('User Id:-'+str(notificationRecord.userId)+' Notification Url:- '+ str(notificationRecord.url))
117
                logging.debug('User Id:-'+str(notificationRecord.userId)+' Notification Url:- '+ str(notificationRecord.url))
118
            else:
118
            else:
119
                if '?user_id' not in notificationRecord.url:
119
                if '?user_id' not in notificationRecord.url:
120
                    notificationRecord.url = notificationRecord.url+'?user_id='+str(notificationRecord.userId)
120
                    notificationRecord.url = notificationRecord.url.strip()+'?user_id='+str(notificationRecord.userId)
121
                    logging.debug('User Id:-'+str(notificationRecord.userId)+' Notification Url:- '+ str(notificationRecord.url))
121
                    logging.debug('User Id:-'+str(notificationRecord.userId)+' Notification Url:- '+ str(notificationRecord.url))
122
                else: 
122
                else: 
123
                    logging.debug('User Id:-'+str(notificationRecord.userId)+' Notification Url:- '+ str(notificationRecord.url))
123
                    logging.debug('User Id:-'+str(notificationRecord.userId)+' Notification Url:- '+ str(notificationRecord.url))
124
        if notificationRecord.url is None or str(notificationRecord.url)=='':
124
        if notificationRecord.url is None or str(notificationRecord.url)=='':
125
            notificationRecord.url = 'http://api.profittill.com/deals?user_id='+str(notificationRecord.userId)
125
            notificationRecord.url = 'http://api.profittill.com/deals?user_id='+str(notificationRecord.userId)
126
        data = {"message":notificationRecord.message,"cid":notificationRecord.campaignId,"title":notificationRecord.title,
126
        data = {"message":notificationRecord.message,"cid":notificationRecord.campaignId,"title":notificationRecord.title,
127
                "type":notificationRecord.type,"url":notificationRecord.url,"vibrate":1,"sound":1,"largeIcon":"large_icon",
127
                "type":notificationRecord.type,"url":notificationRecord.url.strip(),"vibrate":1,"sound":1,"largeIcon":"large_icon",
128
                "smallIcon":"small_icon","priority":"high","time_to_live":long(time.mktime(notificationRecord.expiresAt.timetuple()))-long(time.mktime(datetime.datetime.now().timetuple()))}
128
                "smallIcon":"small_icon","priority":"high","time_to_live":long(time.mktime(notificationRecord.expiresAt.timetuple()))-long(time.mktime(datetime.datetime.now().timetuple()))}
129
        
129
        
130
        post_data = {}
130
        post_data = {}
131
        
131
        
132
        post_data['data'] = data
132
        post_data['data'] = data