File size: 2,579 Bytes
b2e2343
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
###########################################################
#
# Copyright (c) 2005, Southpaw Technology
#                     All Rights Reserved
#
# PROPRIETARY INFORMATION.  This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permission.
#
#
#
__all__ = ['FlashInfo']

import cStringIO, os, sys, urllib, xmlrpclib
from xml.dom.minidom import parseString


from pyasm.application.common import BaseAppInfo


class FlashInfo(BaseAppInfo):
    '''Gets data fed by the TACTIC server in a well know location'''

    def __init__(my, app_name):

        super(FlashInfo,my).__init__(app_name)

        # read from a file a parse
        my.ticket = "2b6754788b90877f0240e4b1d8e620b3"
        my.xmlrpc_url = "http://fugu/tactic/flash/XMLRPC"
        my.upload_server = "http://fugu/tactic/default/UploadServer/"
        my.tactic_user = "boris"
        my.tmpdir = "D:/tactic_temp"
        my.trash_dir = '%s/temp' %my.tmpdir
        my.sandbox_dir = "D:/tactic_temp/sandbox"
        my.publish_dir = "D:/tactic_temp/publish/%s" %my.tactic_user
        my.check_dirs()

    def check_dirs(my):
        
        if not os.path.exists(my.trash_dir):
            os.makedirs(dir)
        if not os.path.exists(my.publish_dir):
            os.makedirs(my.publish_dir)

    def get_ticket(my):
        assert my.ticket
        return my.ticket

    def get_xmlrpc_server(my):
        assert my.xmlrpc_url
        if not my.xmlrpc_server:
            my.xmlrpc_server = xmlrpclib.Server(my.xmlrpc_url)
        return my.xmlrpc_server

    def get_upload_server(my):
        assert my.upload_server
        return my.upload_server

    def get_user(my):
        assert my.user
        return my.user

    def get_tmp_dir(my):
        assert my.tmpdir
        return my.tmpdir

    def get_sandbox_dir(my):
        assert my.sandbox_dir
        return my.sandbox_dir

    def get_log_path(my):
        
        to_path = '%s/actionLog.txt' %my.trash_dir
        if not os.path.exists(to_path):
            file = open(to_path, "wb")
        return to_path

    def get_publish_dir(my):
        return my.publish_dir

    def report_error(my, exception):
        print "Error: ", exception

    def report_warning(my, exception):
        print "Warning: ", exception

"""
def upload_warning():
    info = TacticInfo.get()
    info.report_warning('','', upload=True)

    #remove the file afterwards
    path = "%s/warning.txt" % info.get_tmpdir()
    if os.path.exists(path):
        os.unlink(path)

"""