示例#1
0
 def put(self):
     if check_creds(tornado.escape.native_str(self.get_argument('creds'))):
         database = 'data/records.sql'
         if tornado.escape.native_str(self.get_argument('new')) == 'T':
             account = tornado.escape.native_str(
                 self.get_argument('account'))
             oppID = tornado.escape.native_str(self.get_argument('oppID'))
             jira = tornado.escape.native_str(self.get_argument('jira'))
             owner = tornado.escape.native_str(self.get_argument('owner'))
             status = tornado.escape.native_str(self.get_argument('status'))
             rep = tornado.escape.native_str(self.get_argument('rep'))
             try:
                 orgID = tornado.escape.native_str(
                     self.get_argument('orgID'))
             except:
                 orgID = ''
             rowid = db_manage.create_record(
                 db_manage.create_connection(database),
                 (account, oppID, jira, orgID, owner, rep, status))
             self.write('New record created: {}'.format(rowid))
         else:
             oppID = tornado.escape.native_str(self.get_argument('oppID'))
             orgID = tornado.escape.native_str(self.get_argument('orgID'))
             db_manage.update_record(db_manage.create_connection(database),
                                     (oppID, orgID))
             self.write('Updated.')
示例#2
0
 def get(self):
     if check_creds(tornado.escape.native_str(self.get_argument('creds'))):
         database = 'data/records.sql'
         try:
             status = tornado.escape.native_str(self.get_argument('status'))
             self.write(
                 db_manage.read_db(db_manage.create_connection(database),
                                   locator=loc))
         except:
             status = ''
         try:
             loc = tornado.escape.native_str(self.get_argument('loc'))
             self.write(
                 db_manage.read_db(db_manage.create_connection(database),
                                   locator=loc))
         except:
             try:
                 owner = tornado.escape.native_str(
                     self.get_argument('owner'))
                 self.write(
                     db_manage.read_db(
                         db_manage.create_connection(database),
                         owner=owner))
             except:
                 try:
                     rep = tornado.escape.native_str(
                         self.get_argument('rep'))
                     self.write(
                         db_manage.read_db(
                             db_manage.create_connection(database),
                             rep=rep))
                 except:
                     self.write(
                         db_manage.read_db(
                             db_manage.create_connection(database)))
示例#3
0
 def post(self):
     if check_creds(tornado.escape.native_str(self.get_argument('creds'))):
         database = 'data/records.sql'
         try:
             email = tornado.escape.native_str(self.get_argument("email"))
             split = email.split("\n")
             for s in split:
                 if s.startswith("https"):
                     oppID = s.strip()[-15:]
         except:
             oppID = tornado.escape.native_str(self.get_argument("opp"))
             if oppID.startswith("https"):
                 oppID = oppID[-15:].strip()
         if oppID:
             # Status change of se request
             jira, rep, se, account = createJIRA(oppID)
             resources.sfdc_details(oppID, status="In Progress")
             response = {
                 'jira': jira,
                 'oppID': oppID,
                 'rep': rep,
                 'owner': se,
                 'account': account
             }
             self.write(response)
             rowid = db_manage.create_record(
                 db_manage.create_connection(database),
                 (account, oppID, jira, '', se, rep, 'Open'))
         else:
             self.write("Error")
     else:
         self.write('Invalid Credentials.')
示例#4
0
def resolve_issue(jira, oppID, task_type):
    database = 'data/records.sql'
    j = login()
    if task_type == 'parent':
        conn = db_manage.create_connection(database)
        db_manage.resolve_record(conn, jira)
        account, opp, req, rep, se = sfdc_details(oppID, status='Completed')
    return 'DB updated - status == Completed'
示例#5
0
 def get(self):
     if check_creds(tornado.escape.native_str(self.get_argument('creds'))):
         database = 'data/records.sql'
         loc = tornado.escape.native_str(self.get_argument('oppID'))
         tags = tornado.escape.native_str(self.get_argument('tags', ''))
         tech = tornado.escape.native_str(self.get_argument('tech'))
         print(tech)
         record = db_manage.read_db(db_manage.create_connection(database),
                                    locator=loc)[0]
         account, oppID, jira, orgID, owner, rep = record[0], record[
             1], record[2], record[3], record[4], record[5]
         email = email_format.compile_email(oppID, orgID, tags, tech=tech)
         self.write(email)
     else:
         self.write('Invalid Credentials.')