def process_msg(self, msg): clipboard_msg = {"msg_type": "clipboard", "data": msg} admin_username = get_admin_username() admin_user = User.objects.get(username=admin_username) description_content = unicode(msg["data"]["text"]) description, is_description_created=Description.objects.get_or_create(content=description_content) obj, is_created = UfsObj.objects.get_or_create(description_json=json.dumps(clipboard_msg["data"]), ufs_obj_type=UfsObj.TYPE_CLIPBOARD, user=admin_user, ufs_url=u"clipboard://"+description_content) obj.descriptions.add(description)
def __init__(self): super(MsgProcessCommandBase, self).__init__() factory = MsgServiceFactory() self.ufs_msg_service = factory.get_msg_service() self.channel = None caller_file = get_inspection_frame(2) app_signature = caller_file.replace("/", "_").replace("\\", "_").replace(":", "_") # Keep the instance, the lock file will be deleted whenever the instance is deleted self.me = SingleInstance(app_signature) admin_username = get_admin_username() self.admin_user = User.objects.get(username=admin_username)
def process_msg(self, msg): if self.is_need_process(msg): if "urls" in msg: links = "" for i in msg["urls"]: # full_path = get_full_path_from_url(i) # ufs_url = get_ufs_url_for_local_path(full_path) qt_url = i links += "url=" + quote_unicode(unicode(qt_url)) + "&" c = ObjSysClint() c.password = get_admin_password() c.server_port = str(get_ufs_web_server_port()) c.username = get_admin_username() tagging_url = c.get_manual_tagging_url_for_qt_urls(links) # print tagging_url BrowserServiceClass().open_browser(tagging_url)