本文整理汇总了Python中dctmpy.obj.typedobject.TypedObject.set_string方法的典型用法代码示例。如果您正苦于以下问题:Python TypedObject.set_string方法的具体用法?Python TypedObject.set_string怎么用?Python TypedObject.set_string使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dctmpy.obj.typedobject.TypedObject
的用法示例。
在下文中一共展示了TypedObject.set_string方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_attribute_nls_info
# 需要导入模块: from dctmpy.obj.typedobject import TypedObject [as 别名]
# 或者: from dctmpy.obj.typedobject.TypedObject import set_string [as 别名]
def get_attribute_nls_info(session, type, attribute, policy=NULL_ID, state=0):
obj = TypedObject(session=session)
obj.set_string("TYPE_NAME", type)
obj.set_string("ATTR_NAME", attribute)
obj.set_id("POLICY_ID", policy)
obj.set_int("POLICY_STATE", state)
return obj
示例2: put_file
# 需要导入模块: from dctmpy.obj.typedobject import TypedObject [as 别名]
# 或者: from dctmpy.obj.typedobject.TypedObject import set_string [as 别名]
def put_file(session, storage_id, file, format):
obj = TypedObject(session=session)
obj.set_id("STORAGE", storage_id)
obj.set_string("FILE", file)
obj.set_id("FORMAT", format)
obj.set_bool("MAC_CLIENT", False)
return obj
示例3: execute
# 需要导入模块: from dctmpy.obj.typedobject import TypedObject [as 别名]
# 或者: from dctmpy.obj.typedobject.TypedObject import set_string [as 别名]
def execute(session, query, for_update, batch_hint, bof_dql=False):
obj = TypedObject(session=session)
obj.set_string("QUERY", query)
obj.set_bool("FOR_UPDATE", for_update)
obj.set_int("BATCH_HINT", batch_hint)
obj.set_bool("BOF_DQL", bof_dql)
return obj
示例4: server_dir
# 需要导入模块: from dctmpy.obj.typedobject import TypedObject [as 别名]
# 或者: from dctmpy.obj.typedobject.TypedObject import set_string [as 别名]
def server_dir(session, path, dirs=True, files=True, links=True):
obj = TypedObject(session=session)
obj.set_string("DIRECTORY", path)
obj.set_bool("LIST_DIR", dirs)
obj.set_bool("LIST_FILE", files)
obj.set_bool("LIST_LINK", links)
return obj
示例5: convert_id
# 需要导入模块: from dctmpy.obj.typedobject import TypedObject [as 别名]
# 或者: from dctmpy.obj.typedobject.TypedObject import set_string [as 别名]
def convert_id(session, fmt, page=0, page_modifier='', convert=False, useconvert=False):
obj = TypedObject(session=session)
obj.set_int("page", page)
obj.set_string("format", fmt)
obj.set_string("page_modifier", page_modifier)
obj.set_bool("convert", convert)
obj.set_bool("useconvert", useconvert)
return obj
示例6: main
# 需要导入模块: from dctmpy.obj.typedobject import TypedObject [as 别名]
# 或者: from dctmpy.obj.typedobject.TypedObject import set_string [as 别名]
def main():
if len(sys.argv) != 5:
usage()
exit(1)
(session, docbase) = create_session(*sys.argv[1:5])
if is_super_user(session):
print "Current user is a superuser, nothing to do"
exit(1)
print "Trying to find any object with content..."
object_id = session.query(
"SELECT FOR READ r_object_id "
"FROM dm_sysobject WHERE r_content_size>0") \
.next_record()['r_object_id']
session.apply(None, NULL_ID, "BEGIN_TRANS")
print "Querying \"inaccessible\" dmr_content objects..."
for e in session.query(
"SELECT * FROM dmr_content "
"WHERE ANY parent_id IS NOT NULLID "
"AND ANY parent_id NOT IN "
"(SELECT r_object_id FROM dm_sysobject)"
):
handle = 0
try:
content_id = session.next_id(0x06)
obj = TypedObject(session=session)
obj.set_string("OBJECT_TYPE", "dmr_content")
obj.set_bool("IS_NEW_OBJECT", True)
obj.set_int("i_vstamp", 0)
obj.set_id("storage_id", e["storage_id"])
obj.set_id("format", e["format"])
obj.set_int("data_ticket", e["data_ticket"])
obj.set_id("parent_id", object_id)
if not session.save_cont_attrs(content_id, obj):
print "Failed"
exit(1)
handle = session.make_puller(
NULL_ID, obj["storage_id"], content_id,
obj["format"], obj["data_ticket"]
)
if handle == 0:
raise RuntimeError("Unable make puller")
size = 0
for chunk in session.download(handle):
size += len(chunk)
print "Downloaded %d/%d bytes of object %s" % \
(size, e['full_content_size'], e['r_object_id'])
finally:
if handle > 0:
try:
session.kill_puller(handle)
except:
pass
示例7: get_file
# 需要导入模块: from dctmpy.obj.typedobject import TypedObject [as 别名]
# 或者: from dctmpy.obj.typedobject.TypedObject import set_string [as 别名]
def get_file(session, content_id, file_name=None):
content = session.get_object(content_id)
obj = TypedObject(session=session)
obj.set_id("STORAGE", content['storage_id'])
obj.set_id("FORMAT", content['format'])
obj.set_id("CONTENT", content['r_object_id'])
obj.set_int("D_TICKET", content['data_ticket'])
obj.set_bool("MAC_CLIENT", False)
if file_name:
obj.set_string("OBJNAME", file_name)
return obj
示例8: start_push
# 需要导入模块: from dctmpy.obj.typedobject import TypedObject [as 别名]
# 或者: from dctmpy.obj.typedobject.TypedObject import set_string [as 别名]
def start_push(session, handle, content_id, fmt, size, d_ticket=0, is_other=False,
compression=False, can_use_new_callbacks=True, encoded_content_attrs='', i_partition=0):
obj = TypedObject(session=session)
obj.set_int("HANDLE", handle)
obj.set_id("CONTENT_ID", content_id)
obj.set_id("FORMAT", fmt)
obj.set_int("D_TICKET", d_ticket)
obj.set_int("SIZE", size & 0xFFFFFFFF)
obj.set_int("SIZE_LOW", size & 0xFFFFFFFF)
obj.set_int("SIZE_HIGH", size >> 32)
obj.set_bool("IS_OTHER", is_other)
obj.set_bool("COMPRESSION", compression)
obj.set_bool("CAN_USE_NEW_CALLBACKS", can_use_new_callbacks)
obj.set_string("ENCODED_CONTENT_ATTRS", encoded_content_attrs)
obj.set_int("I_PARTITION", i_partition)
return obj
示例9: _server_map_request
# 需要导入模块: from dctmpy.obj.typedobject import TypedObject [as 别名]
# 或者: from dctmpy.obj.typedobject.TypedObject import set_string [as 别名]
def _server_map_request(handle, version, docbase):
obj = TypedObject(ser_version=0)
obj.set_string("r_docbase_name", docbase)
obj.set_string("r_map_name", "mn_cs_map")
obj.set_string("DBR_REQUEST_NAME", "DBRN_GET_SERVER_MAP")
obj.set_int("DBR_REQUEST_VERSION", 1)
obj.set_string("DBR_REQUEST_HANDLE", handle)
obj.set_string("DBR_SOFTWARE_VERSION", version)
return obj
示例10: get_dist_content_map
# 需要导入模块: from dctmpy.obj.typedobject import TypedObject [as 别名]
# 或者: from dctmpy.obj.typedobject.TypedObject import set_string [as 别名]
def get_dist_content_map(session, fmt=None, page_number=0, page_modifier='', netloc_id='',
request_time=int(time.mktime(time.gmtime())),
expire_delta=360, lookup_resourcefork_info=False, include_surrogate_get=True):
obj = TypedObject(session=session)
if fmt:
obj.set_string("format", fmt)
obj.set_int("page_number", page_number)
obj.set_string("page_modifier", page_modifier)
obj.set_string("netloc_id", netloc_id)
obj.set_string("request_time", str(request_time))
obj.set_string("expire_delta", str(expire_delta))
obj.set_bool("lookup_resourcefork_info", lookup_resourcefork_info)
obj.set_bool("include_surrogate_get", include_surrogate_get)
return obj
示例11: download
# 需要导入模块: from dctmpy.obj.typedobject import TypedObject [as 别名]
# 或者: from dctmpy.obj.typedobject.TypedObject import set_string [as 别名]
def download(session, path, buf):
print "Downloading %s" % path
print "Trying to find any object with content..."
object_id = session.query(
"SELECT FOR READ r_object_id "
"FROM dm_sysobject WHERE r_content_size>0") \
.next_record()['r_object_id']
session.apply(None, NULL_ID, "BEGIN_TRANS")
store = session.get_by_qualification("dm_filestore")
format = session.get_by_qualification("dm_format")
remote_path = "common=/../../../../../../../../../..%s=Directory" % path
result = session.put_file(store.object_id(), remote_path, format.object_id())
full_size = result['FULL_CONTENT_SIZE']
ticket = result['D_TICKET']
content_id = session.next_id(0x06)
obj = TypedObject(session=session)
obj.set_string("OBJECT_TYPE", "dmr_content")
obj.set_bool("IS_NEW_OBJECT", True)
obj.set_int("i_vstamp", 0)
obj.set_id("storage_id", store.object_id())
obj.set_id("format", format.object_id())
obj.set_int("data_ticket", ticket)
obj.set_id("parent_id", object_id)
if not session.save_cont_attrs(content_id, obj):
raise RuntimeError("Unable to save content object")
handle = session.make_puller(
NULL_ID, store.object_id(), content_id,
format.object_id(), ticket
)
if handle == 0:
raise RuntimeError("Unable make puller")
for chunk in session.download(handle):
buf.extend(chunk)
return buf
示例12: _docbase_map_request
# 需要导入模块: from dctmpy.obj.typedobject import TypedObject [as 别名]
# 或者: from dctmpy.obj.typedobject.TypedObject import set_string [as 别名]
def _docbase_map_request(handle, version):
obj = TypedObject(ser_version=0)
obj.set_string("DBR_REQUEST_NAME", "DBRN_GET_DOCBASE_MAP")
obj.set_int("DBR_REQUEST_VERSION", 1)
obj.set_string("DBR_REQUEST_HANDLE", handle)
obj.set_string("DBR_SOFTWARE_VERSION", version)
return obj
示例13: authenticate_user
# 需要导入模块: from dctmpy.obj.typedobject import TypedObject [as 别名]
# 或者: from dctmpy.obj.typedobject.TypedObject import set_string [as 别名]
def authenticate_user(session, username, password, identity=None):
obj = TypedObject(session=session)
obj.set_bool("CONNECT_POOLING", False)
obj.set_string("USER_PASSWORD", password)
obj.set_bool("AUTHENTICATION_ONLY", False)
obj.set_bool("CHECK_ONLY", False)
obj.set_string("LOGON_NAME", username)
if identity:
if identity.trusted:
obj.set_bool("TRUSTED_LOGIN_ALLOWED", True)
obj.set_string("OS_LOGON_NAME", username)
auth_data = identity.get_auth_data()
if auth_data:
obj.set_string("CLIENT_AUTH_DATA", auth_data)
return obj
示例14: checkout_license
# 需要导入模块: from dctmpy.obj.typedobject import TypedObject [as 别名]
# 或者: from dctmpy.obj.typedobject.TypedObject import set_string [as 别名]
def checkout_license(session, feature_name, feature_version, user=None):
obj = TypedObject(session=session)
if not user:
user = session.username
obj.set_string("FEATURE_NAME", feature_name)
obj.set_string("FEATURE_VERSION", feature_version)
obj.set_string("USER_LOGIN_NAME", user)
return obj
示例15: set_locale
# 需要导入模块: from dctmpy.obj.typedobject import TypedObject [as 别名]
# 或者: from dctmpy.obj.typedobject.TypedObject import set_string [as 别名]
def set_locale(session, charset=get_charset_id()):
obj = TypedObject(session=session)
obj.set_int("LANGUAGE", get_locale_id())
obj.set_int("CHARACTER_SET", charset)
obj.set_int("PLATFORM_ENUM", get_platform_id())
obj.set_string("PLATFORM_VERSION_IMAGE", "python")
obj.set_int("UTC_OFFSET", get_offset_in_seconds())
obj.set_int("SDF_AN_custom_date_order", 0)
obj.set_int("SDF_AN_custom_scan_fields", 0)
obj.set_string("SDF_AN_date_separator", "/")
obj.set_int("SDF_AN_date_order", 2)
obj.set_bool("SDF_AN_day_leading_zero", True)
obj.set_bool("SDF_AN_month_leading_zero", True)
obj.set_bool("SDF_AN_century", True)
obj.set_string("SDF_AN_time_separator", ":")
obj.set_bool("SDF_AN_hours_24", True)
obj.set_bool("SDF_AN_hour_leading_zero", True)
obj.set_bool("SDF_AN_noon_is_zero", False)
obj.set_string("SDF_AN_am", "AM")
obj.set_string("SDF_AN_pm", "PM")
obj.append_int("PLATFORM_EXTRA", [0, 0, 0, 0])
obj.set_string("APPLICATION_CODE", "")
return obj