本文整理汇总了Python中desktop.conf.DEFAULT_USER类的典型用法代码示例。如果您正苦于以下问题:Python DEFAULT_USER类的具体用法?Python DEFAULT_USER怎么用?Python DEFAULT_USER使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DEFAULT_USER类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _get_params
def _get_params(self):
params = {}
if self.username != DEFAULT_USER.get(): # We impersonate if needed
params['doAs'] = self.username
if not self.security_enabled:
params['user.name'] = DEFAULT_USER.get()
return params
示例2: getuser
def getuser(self, **options):
try:
return User.objects.get(id=1)
except User.DoesNotExist:
form = SuperUserChangeForm(
{
"username": DEFAULT_USER.get(),
"password1": DEFAULT_USER_PASSWORD.get(),
"password2": DEFAULT_USER_PASSWORD.get(),
"ensure_home_directory": True,
"is_active": True,
"is_superuser": True,
}
)
instance = form.save()
get_profile(instance)
return User.objects.get(username=DEFAULT_USER.get())
示例3: handle_noargs
def handle_noargs(self, **options):
try:
user = User.objects.get(username=DEFAULT_USER.get())
except User.DoesNotExist:
from useradmin.management.commands.create_sandbox_user import Command
Command().handle_noargs()
user = User.objects.get(username=DEFAULT_USER.get())
error_list = _get_config_errors(user)
error_message = ""
for confvar, error in error_list:
if isinstance(confvar, str):
cv = confvar
else:
cv = confvar.get_fully_qualifying_key()
error_message += "\n--Variable: %s\n--Current value: %s\n--Error: %s\n" % (cv, confvar, error)
if error_message:
sys.stderr.write("Possible missconfigurations: \n %s \n" % error_message)
sys.exit(1)
else:
sys.stdout.write("Smoke test passed \n")
sys.exit(0)
示例4: extract_archive_in_hdfs
def extract_archive_in_hdfs(request, upload_path, file_name):
_upload_extract_archive_script_to_hdfs(request.fs)
output_path = upload_path + '/' + file_name.split('.')[0]
start_time = json.loads(request.POST.get('start_time', '-1'))
shell_notebook = Notebook(
name=_('HDFS Extraction of %(upload_path)s/%(file_name)s') % {'upload_path': upload_path, 'file_name': file_name},
isManaged=True,
onSuccessUrl=reverse('filebrowser.views.view', kwargs={'path': output_path})
)
shell_notebook.add_shell_snippet(
shell_command='extract_archive_in_hdfs.sh',
arguments=[{'value': '-u=' + upload_path}, {'value': '-f=' + file_name}, {'value': '-o=' + output_path}],
archives=[],
files=[{'value': '/user/' + DEFAULT_USER.get() + '/common/extract_archive_in_hdfs.sh'}, {"value": upload_path + '/' + urllib.quote(file_name)}],
env_var=[{'value': 'HADOOP_USER_NAME=${wf:user()}'}],
last_executed=start_time
)
return shell_notebook.execute(request, batch=True)
示例5: compress_files_in_hdfs
def compress_files_in_hdfs(request, file_names, upload_path, archive_name):
_upload_compress_files_script_to_hdfs(request.fs)
files = [{"value": upload_path + '/' + file_name} for file_name in file_names]
files.append({'value': '/user/' + DEFAULT_USER.get() + '/common/compress_files_in_hdfs.sh'})
start_time = json.loads(request.POST.get('start_time', '-1'))
shell_notebook = Notebook(
name=_('HDFS Compression to %(upload_path)s/hue_compressed.zip') % {'upload_path': upload_path},
isManaged=True,
onSuccessUrl=reverse('filebrowser.views.view', kwargs={'path': upload_path})
)
shell_notebook.add_shell_snippet(
shell_command='compress_files_in_hdfs.sh',
arguments=[{'value': '-u=' + upload_path}, {'value': '-f=' + ','.join(file_names)}, {'value': '-n=' + archive_name}],
archives=[],
files=files,
env_var=[{'value': 'HADOOP_USER_NAME=${wf:user()}'}],
last_executed=start_time
)
return shell_notebook.execute(request, batch=True)
示例6: HiveServerTable
TExecuteStatementReq, TGetOperationStatusReq, TFetchOrientation,\
TCloseSessionReq, TGetSchemasReq, TGetLogReq, TCancelOperationReq,\
TCloseOperationReq, TFetchResultsResp, TRowSet, TProtocolVersion
from beeswax import conf as beeswax_conf
from beeswax import hive_site
from beeswax.hive_site import hiveserver2_use_ssl
from beeswax.models import Session, HiveServerQueryHandle, HiveServerQueryHistory
from beeswax.server.dbms import Table, NoSuchObjectException, DataTable,\
QueryServerException
LOG = logging.getLogger(__name__)
IMPALA_RESULTSET_CACHE_SIZE = 'impala.resultset.cache.size'
DEFAULT_USER = DEFAULT_USER.get()
class HiveServerTable(Table):
"""
We get the table details from a DESCRIBE FORMATTED.
"""
def __init__(self, table_results, table_schema, desc_results, desc_schema):
if beeswax_conf.THRIFT_VERSION.get() >= 7:
if not table_results.columns:
raise NoSuchObjectException()
self.table = table_results.columns
else: # Deprecated. To remove in Hue 4.
if not table_results.rows:
raise NoSuchObjectException()
示例7: username
def username(self):
try:
return self._thread_local.user
except AttributeError:
return DEFAULT_USER.get()