Пример #1
0
    def show_import_profile(self):
        dialog = interface.FileChooserDialog()
        dialog.set_title(APP_NAME_FORMATED)
        dialog.set_icon(utils.get_logo())
        dialog.add_filter('Pritunl Profile', '*.ovpn')
        dialog.add_filter('Pritunl Profile', '*.conf')
        dialog.add_filter('Pritunl Profile', '*.tar')

        response = dialog.run()
        if response:
            try:
                profile.import_file(response)
            except Exception as exception:
                self.show_import_profile_error(exception)
            self.update_menu()
        dialog.destroy()
Пример #2
0
    def show_import_profile(self):
        dialog = interface.FileChooserDialog()
        dialog.set_title(APP_NAME_FORMATED)
        dialog.set_icon(utils.get_logo())
        dialog.add_filter('Pritunl Profile', '*.ovpn')
        dialog.add_filter('Pritunl Profile', '*.conf')
        dialog.add_filter('Pritunl Profile', '*.tar')

        response = dialog.run()
        if response:
            try:
                profile.import_file(response)
            except Exception as exception:
                self.show_import_profile_error(exception)
            self.update_menu()
        dialog.destroy()
Пример #3
0
    def do_import(self):
        profile_path = self.data.get('profile_path')
        profile_uri = self.data.get('profile_uri')

        if profile_path:
            profile.import_file(profile_path)
        elif profile_uri:
            try:
                profile.import_uri(profile_uri)
            except httplib.HTTPException:
                self.send_text_response('Unable to retrieve profile or ' +
                    'profile path does not exist', 500)
        else:
            raise ValueError('Must have profile_path or profile_uri')

        self.send_response(200)
Пример #4
0
    def do_import(self):
        profile_path = self.data.get('profile_path')
        profile_uri = self.data.get('profile_uri')

        if profile_path:
            profile.import_file(profile_path)
        elif profile_uri:
            try:
                profile.import_uri(profile_uri)
            except httplib.HTTPException:
                self.send_text_response(
                    'Unable to retrieve profile or ' +
                    'profile path does not exist', 500)
        else:
            raise ValueError('Must have profile_path or profile_uri')

        self.send_response(200)