本文整理汇总了Python中dNG.data.binary.Binary.utf8方法的典型用法代码示例。如果您正苦于以下问题:Python Binary.utf8方法的具体用法?Python Binary.utf8怎么用?Python Binary.utf8使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dNG.data.binary.Binary
的用法示例。
在下文中一共展示了Binary.utf8方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: set_data_attributes
# 需要导入模块: from dNG.data.binary import Binary [as 别名]
# 或者: from dNG.data.binary.Binary import utf8 [as 别名]
def set_data_attributes(self, **kwargs):
"""
Sets values given as keyword arguments to this method.
:since: v0.2.00
"""
with self, self.local.connection.no_autoflush:
DataLinker.set_data_attributes(self, **kwargs)
if ("entry_type" in kwargs): self.local.db_instance.entry_type = kwargs['entry_type']
if ("owner_type" in kwargs): self.local.db_instance.owner_type = kwargs['owner_type']
if ("author_id" in kwargs): self.local.db_instance.author_id = kwargs['author_id']
if ("author_ip" in kwargs): self.local.db_instance.author_ip = kwargs['author_ip']
if ("time_published" in kwargs): self.local.db_instance.time_published = int(kwargs['time_published'])
if ("description" in kwargs): self.local.db_instance.description = Binary.utf8(kwargs['description'])
if ("locked" in kwargs): self.local.db_instance.locked = kwargs['locked']
if ("guest_permission" in kwargs): self.local.db_instance.guest_permission = kwargs['guest_permission']
if ("user_permission" in kwargs): self.local.db_instance.user_permission = kwargs['user_permission']
if ("content" in kwargs):
if (self.local.db_instance.rel_text_entry is None):
self.local.db_instance.rel_text_entry = _DbTextEntry()
self.local.db_instance.rel_text_entry.id = self.local.db_instance.id
db_text_entry = self.local.db_instance.rel_text_entry
else: db_text_entry = self.local.db_instance.rel_text_entry
db_text_entry.content = Binary.utf8(kwargs['content'])
示例2: set_data_attributes
# 需要导入模块: from dNG.data.binary import Binary [as 别名]
# 或者: from dNG.data.binary.Binary import utf8 [as 别名]
def set_data_attributes(self, **kwargs):
"""
Sets values given as keyword arguments to this method.
:since: v0.2.00
"""
with self:
if ("type" in kwargs):
_type = (kwargs['type'] if (type(kwargs['type']) is int) else self.__class__.get_type_int(kwargs['type']))
self.local.db_instance.type = _type
#
if ("type_ex" in kwargs): self.local.db_instance.type_ex = kwargs['type_ex']
if ("banned" in kwargs): self.local.db_instance.banned = kwargs['banned']
if ("deleted" in kwargs): self.local.db_instance.deleted = kwargs['deleted']
if ("locked" in kwargs): self.local.db_instance.locked = kwargs['locked']
if ("name" in kwargs): self.local.db_instance.name = Binary.utf8(kwargs['name'])
if ("password" in kwargs): self.local.db_instance.password = kwargs['password']
if ("lang" in kwargs): self.local.db_instance.lang = kwargs['lang']
if ("theme" in kwargs): self.local.db_instance.theme = kwargs['theme']
if ("email" in kwargs): self.local.db_instance.email = Binary.utf8(kwargs['email'])
if ("email_public" in kwargs): self.local.db_instance.email_public = kwargs['email_public']
if ("credits" in kwargs): self.local.db_instance.credits = kwargs['credits']
if ("title" in kwargs): self.local.db_instance.title = Binary.utf8(kwargs['title'])
if ("avatar" in kwargs): self.local.db_instance.avatar = kwargs['avatar']
if ("signature" in kwargs): self.local.db_instance.signature = Binary.utf8(kwargs['signature'])
if ("registration_ip" in kwargs): self.local.db_instance.registration_ip = kwargs['registration_ip']
if ("registration_time" in kwargs): self.local.db_instance.registration_time = int(kwargs['registration_time'])
if ("secid" in kwargs): self.local.db_instance.secid = kwargs['secid']
if ("lastvisit_ip" in kwargs): self.local.db_instance.lastvisit_ip = kwargs['lastvisit_ip']
if ("lastvisit_time" in kwargs): self.local.db_instance.lastvisit_time = int(kwargs['lastvisit_time'])
if ("rating" in kwargs): self.local.db_instance.rating = kwargs['rating']
if ("timezone" in kwargs): self.local.db_instance.timezone = kwargs['timezone']
示例3: set_data_attributes
# 需要导入模块: from dNG.data.binary import Binary [as 别名]
# 或者: from dNG.data.binary.Binary import utf8 [as 别名]
def set_data_attributes(self, **kwargs):
"""
Sets values given as keyword arguments to this method.
:since: v0.2.00
"""
with self:
MpEntry.set_data_attributes(self, **kwargs)
if ("duration" in kwargs): self.local.db_instance.duration = kwargs['duration']
if ("description" in kwargs): self.local.db_instance.description = Binary.utf8(kwargs['description'])
if ("genre" in kwargs): self.local.db_instance.genre = Binary.utf8(kwargs['genre'])
if ("series" in kwargs): self.local.db_instance.series = Binary.utf8(kwargs['series'])
if ("episode" in kwargs): self.local.db_instance.episode = kwargs['episode']
if ("actor" in kwargs): self.local.db_instance.actor = Binary.utf8(kwargs['actor'])
if ("author" in kwargs): self.local.db_instance.author = Binary.utf8(kwargs['author'])
if ("director" in kwargs): self.local.db_instance.director = Binary.utf8(kwargs['director'])
if ("producer" in kwargs): self.local.db_instance.producer = Binary.utf8(kwargs['producer'])
if ("publisher" in kwargs): self.local.db_instance.publisher = Binary.utf8(kwargs['publisher'])
if ("width" in kwargs): self.local.db_instance.width = kwargs['width']
if ("height" in kwargs): self.local.db_instance.height = kwargs['height']
if ("codec" in kwargs): self.local.db_instance.codec = kwargs['codec']
if ("bitrate" in kwargs): self.local.db_instance.bitrate = kwargs['bitrate']
if ("bpp" in kwargs): self.local.db_instance.bpp = kwargs['bpp']
if ("encoder" in kwargs): self.local.db_instance.encoder = Binary.utf8(kwargs['encoder'])
示例4: set_data_attributes
# 需要导入模块: from dNG.data.binary import Binary [as 别名]
# 或者: from dNG.data.binary.Binary import utf8 [as 别名]
def set_data_attributes(self, **kwargs):
"""
Sets values given as keyword arguments to this method.
:since: v0.2.00
"""
with self:
MpEntry.set_data_attributes(self, **kwargs)
if ("artist" in kwargs): self.local.db_instance.artist = Binary.utf8(kwargs['artist'])
if ("description" in kwargs): self.local.db_instance.description = Binary.utf8(kwargs['description'])
if ("width" in kwargs): self.local.db_instance.width = kwargs['width']
if ("height" in kwargs): self.local.db_instance.height = kwargs['height']
if ("bpp" in kwargs): self.local.db_instance.bpp = kwargs['bpp']
if ("creator" in kwargs): self.local.db_instance.creator = Binary.utf8(kwargs['creator'])
示例5: save
# 需要导入模块: from dNG.data.binary import Binary [as 别名]
# 或者: from dNG.data.binary.Binary import utf8 [as 别名]
def save(self):
"""
Saves changes of the database task instance.
:since: v0.2.00
"""
with self:
self.local.db_instance.tid = Binary.utf8(Md5.hash(self.tid))
self.params['_tid'] = self.tid
if (self.local.db_instance.name == ""): self.local.db_instance.name = Binary.utf8(self.hook[-100:])
if (self.local.db_instance.status is None): self.local.db_instance.status = DatabaseTask.STATUS_WAITING
self.local.db_instance.hook = Binary.utf8(self.hook)
self.local.db_instance.params = Binary.utf8(JsonResource().data_to_json(self.params))
self.local.db_instance.time_updated = int(time())
Instance.save(self)
示例6: set_data_attributes
# 需要导入模块: from dNG.data.binary import Binary [as 别名]
# 或者: from dNG.data.binary.Binary import utf8 [as 别名]
def set_data_attributes(self, **kwargs):
"""
Sets values given as keyword arguments to this method.
:since: v0.2.00
"""
with self:
if ("name" in kwargs): self.local.db_instance.name = Binary.utf8(kwargs['name'])
if ("permitted" in kwargs): self.local.db_instance.permitted = kwargs['permitted']
示例7: set_data_attributes
# 需要导入模块: from dNG.data.binary import Binary [as 别名]
# 或者: from dNG.data.binary.Binary import utf8 [as 别名]
def set_data_attributes(self, **kwargs):
#
"""
Sets values given as keyword arguments to this method.
:since: v0.1.00
"""
with self:
#
DataLinker.set_data_attributes(self, **kwargs)
if ("id_subscription" in kwargs): self.local.db_instance.id_subscription = Binary.utf8(kwargs['id_subscription'])
if ("hybrid_list" in kwargs): self.local.db_instance.hybrid_list = kwargs['hybrid_list']
if ("owner_type" in kwargs): self.local.db_instance.owner_type = kwargs['owner_type']
if ("description" in kwargs): self.local.db_instance.description = Binary.utf8(kwargs['description'])
if ("topics" in kwargs):
#
if (kwargs['topics'] == "++"): self.local.db_instance.topics = self.local.db_instance.topics + 1
elif (kwargs['topics'] == "--"):
#
if (self.local.db_instance.topics > 0): self.local.db_instance.topics = self.local.db_instance.topics - 1
#
else: self.local.db_instance.topics = kwargs['topics']
#
if ("posts" in kwargs):
#
if (kwargs['posts'] == "++"): self.local.db_instance.posts = self.local.db_instance.posts + 1
elif (kwargs['posts'] == "--"):
#
if (self.local.db_instance.posts > 0): self.local.db_instance.posts = self.local.db_instance.posts - 1
#
else: self.local.db_instance.posts = kwargs['posts']
#
if ("last_id_topic" in kwargs): self.local.db_instance.last_id_topic = kwargs['last_id_topic']
if ("last_id_author" in kwargs): self.local.db_instance.last_id_author = kwargs['last_id_author']
if ("last_preview" in kwargs): self.local.db_instance.last_preview = Binary.utf8(kwargs['last_preview'])
if ("locked" in kwargs): self.local.db_instance.locked = kwargs['locked']
if ("guest_permission" in kwargs): self.local.db_instance.guest_permission = kwargs['guest_permission']
if ("user_permission" in kwargs): self.local.db_instance.user_permission = kwargs['user_permission']
示例8: _set_data_attribute
# 需要导入模块: from dNG.data.binary import Binary [as 别名]
# 或者: from dNG.data.binary.Binary import utf8 [as 别名]
def _set_data_attribute(self, attribute, value):
"""
Sets data for the requested attribute.
:param attribute: Requested attribute
:param value: Value for the requested attribute
:since: v1.0.0
"""
if (attribute == "name"): value = Binary.utf8(value)
Instance._set_data_attribute(self, attribute, value)
示例9: set_data_attributes
# 需要导入模块: from dNG.data.binary import Binary [as 别名]
# 或者: from dNG.data.binary.Binary import utf8 [as 别名]
def set_data_attributes(self, **kwargs):
"""
Sets values given as keyword arguments to this method.
:since: v0.1.00
"""
with self, self.local.connection.no_autoflush:
DataLinker.set_data_attributes(self, **kwargs)
if ("vfs_url" in kwargs): self.local.db_instance.vfs_url = Binary.utf8(kwargs['vfs_url'])
if ("vfs_type" in kwargs): self.local.db_instance.vfs_type = kwargs['vfs_type']
if ("role_id" in kwargs): self.local.db_instance.role_id = Binary.utf8(kwargs['role_id'])
if ("owner_type" in kwargs): self.local.db_instance.owner_type = kwargs['owner_type']
if ("owner_id" in kwargs): self.local.db_instance.owner_id = kwargs['owner_id']
if ("owner_ip" in kwargs): self.local.db_instance.owner_ip = kwargs['owner_ip']
if ("mimeclass" in kwargs): self.local.db_instance.mimeclass = kwargs['mimeclass']
if ("mimetype" in kwargs): self.local.db_instance.mimetype = kwargs['mimetype']
if ("size" in kwargs): self.local.db_instance.size = kwargs['size']
if ("locked" in kwargs): self.local.db_instance.locked = kwargs['locked']
if ("guest_permission" in kwargs): self.local.db_instance.guest_permission = kwargs['guest_permission']
if ("user_permission" in kwargs): self.local.db_instance.user_permission = kwargs['user_permission']
示例10: set_data_attributes
# 需要导入模块: from dNG.data.binary import Binary [as 别名]
# 或者: from dNG.data.binary.Binary import utf8 [as 别名]
def set_data_attributes(self, **kwargs):
"""
Sets values given as keyword arguments to this method.
:since: v0.2.00
"""
with self:
if (self.db_id is None): self.db_id = self.local.db_instance.id
if ("tid" in kwargs): self.tid = kwargs['tid']
if ("name" in kwargs): self.local.db_instance.name = Binary.utf8(kwargs['name'][-100:])
if ("status" in kwargs): self.local.db_instance.status = kwargs['status']
if ("hook" in kwargs): self.hook = kwargs['hook']
if ("params" in kwargs and isinstance(kwargs['params'], dict)): self.params = kwargs['params']
if ("time_started" in kwargs): self.local.db_instance.time_started = int(kwargs['time_started'])
if ("time_scheduled" in kwargs): self.local.db_instance.time_scheduled = int(kwargs['time_scheduled'])
if ("timeout" in kwargs): self.local.db_instance.timeout = int(kwargs['timeout'])
示例11: set_data_attributes
# 需要导入模块: from dNG.data.binary import Binary [as 别名]
# 或者: from dNG.data.binary.Binary import utf8 [as 别名]
def set_data_attributes(self, **kwargs):
"""
Sets values given as keyword arguments to this method.
:since: v0.2.00
"""
with self, self.local.connection.no_autoflush:
Entry.set_data_attributes(self, **kwargs)
if ("resource_title" in kwargs): self.local.db_instance.resource_title = Binary.utf8(kwargs['resource_title'])
if ("refreshable" in kwargs): self.local.db_instance.refreshable = kwargs['refreshable']
if ("metadata" in kwargs):
is_empty = (kwargs['metadata'] is None or kwargs['metadata'].strip() == "")
if (self.local.db_instance.rel_resource_metadata is None):
self.local.db_instance.rel_resource_metadata = _DbKeyStore()
self.local.db_instance.rel_resource_metadata.key = self.local.db_instance.id
elif (is_empty): del(self.local.db_instance.rel_resource_metadata)
if (not is_empty): self.local.db_instance.rel_resource_metadata.value = kwargs['metadata']
示例12: save
# 需要导入模块: from dNG.data.binary import Binary [as 别名]
# 或者: from dNG.data.binary.Binary import utf8 [as 别名]
def save(self):
"""
Saves changes of the uuIDs instance.
:return: (bool) True on success
:since: v0.2.00
"""
_return = False
if (self.is_valid()):
with self:
_return = Abstract.save(self)
if (_return):
self.local.db_instance.data = ("" if (self.cache is None) else Binary.utf8(JsonResource().data_to_json(self.cache)))
self.local.db_instance.session_timeout = time() + self.session_time
Instance.save(self)
#
#
#
return _return
示例13: set_data_attributes
# 需要导入模块: from dNG.data.binary import Binary [as 别名]
# 或者: from dNG.data.binary.Binary import utf8 [as 别名]
def set_data_attributes(self, **kwargs):
"""
Sets values given as keyword arguments to this method.
:since: v0.2.00
"""
with self:
MpEntry.set_data_attributes(self, **kwargs)
if ("duration" in kwargs): self.local.db_instance.duration = kwargs['duration']
if ("artist" in kwargs): self.local.db_instance.artist = Binary.utf8(kwargs['artist'])
if ("genre" in kwargs): self.local.db_instance.genre = Binary.utf8(kwargs['genre'])
if ("description" in kwargs): self.local.db_instance.description = Binary.utf8(kwargs['description'])
if ("album" in kwargs): self.local.db_instance.album = Binary.utf8(kwargs['album'])
if ("album_artist" in kwargs): self.local.db_instance.album_artist = Binary.utf8(kwargs['album_artist'])
if ("track_number" in kwargs): self.local.db_instance.track_number = kwargs['track_number']
if ("codec" in kwargs): self.local.db_instance.codec = kwargs['codec']
if ("channels" in kwargs): self.local.db_instance.channels = kwargs['channels']
if ("bitrate" in kwargs): self.local.db_instance.bitrate = kwargs['bitrate']
if ("bps" in kwargs): self.local.db_instance.bps = kwargs['bps']
if ("sample_frequency" in kwargs): self.local.db_instance.sample_frequency = kwargs['sample_frequency']
if ("encoder" in kwargs): self.local.db_instance.encoder = Binary.utf8(kwargs['encoder'])
示例14: set_data_attributes
# 需要导入模块: from dNG.data.binary import Binary [as 别名]
# 或者: from dNG.data.binary.Binary import utf8 [as 别名]
def set_data_attributes(self, **kwargs):
"""
Sets values given as keyword arguments to this method.
:since: v0.2.00
"""
with self:
DataLinker.set_data_attributes(self, **kwargs)
if ("id_subscription" in kwargs): self.local.db_instance.id_subscription = Binary.utf8(kwargs['id_subscription'])
if ("entry_type" in kwargs): self.local.db_instance.entry_type = kwargs['entry_type']
if ("owner_type" in kwargs): self.local.db_instance.owner_type = kwargs['owner_type']
if ("locked" in kwargs): self.local.db_instance.locked = kwargs['locked']
if ("guest_permission" in kwargs): self.local.db_instance.guest_permission = kwargs['guest_permission']
if ("user_permission" in kwargs): self.local.db_instance.user_permission = kwargs['user_permission']