![]() |
A base class for gd namespace kinds.
Inherits From: Entity
, expected_type
google.appengine.api.datastore_entities.GdKind(
kind, title, kind_properties, contact_properties=[]
)
This class contains common logic for all gd namespace kinds. For example,
this class translates datastore (app id, kind, key)
tuples to tag:
URIs appropriate for use in
Args | |
---|---|
kind
|
String |
title
|
String |
kind_properties
|
List of strings |
contact_properties
|
List of string |
Methods
FromPb
@staticmethod
FromPb( pb, validate_reserved_properties=True, default_kind='<not specified>' )
Static factory method. Returns the Entity representation of the given protocol buffer (datastore_pb.Entity).
Args | |
---|---|
pb
|
datastore_pb.Entity or str encoding of a datastore_pb.Entity |
validate_reserved_properties
|
deprecated |
default_kind
|
str, the kind to use if the pb has no key. |
Returns | |
---|---|
Entity
|
the Entity representation of pb |
ToPb
ToPb()
Converts this Entity to its protocol buffer representation.
Returns | |
---|---|
entity_pb2.Entity |
ToXml
ToXml()
Returns an XML representation of this entity, as a string.
app
app()
Returns the name of the application that created this entity, a string or None if not set.
clear
clear()
D.clear() -> None. Remove all items from D.
copy
copy()
The copy method is not supported.
entity_group
entity_group()
Returns this entity's entity group as a Key.
Note that the returned Key will be incomplete if this is a a root entity and its key is incomplete.
fromkeys
fromkeys(
value, /
)
Create a new dictionary with keys from iterable and values set to value.
get
get(
key, default, /
)
Return the value for key if key is in the dictionary, else default.
is_projection
is_projection()
Returns if this entity is a projection from full entity.
Projected entities:
- may not contain all properties from the original entity;
- only contain single values for lists;
- may not contain values with the same type as the original entity.
is_saved
is_saved()
Returns if this entity has been saved to the datastore.
items
items()
D.items() -> a set-like object providing a view on D's items
key
key()
Returns this entity's primary key, a Key instance.
keys
keys()
D.keys() -> a set-like object providing a view on D's keys
kind
kind()
Returns this entity's kind, a string.
namespace
namespace()
Returns the namespace of this entity, a string or None.
parent
parent()
Returns this entity's parent, as a Key. If this entity has no parent, returns None.
pop
pop()
D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
If the key is not found, return the default if given; otherwise, raise a KeyError.
popitem
popitem()
Remove and return a (key, value) pair as a 2-tuple.
Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.
set_unindexed_properties
set_unindexed_properties(
unindexed_properties
)
setdefault
setdefault(
name, value
)
If the property exists, returns its value. Otherwise sets it to value.
If the property name is the empty string or not a string, raises
BadPropertyError
. If the value is not a supported type, raises
BadValueError
.
unindexed_properties
unindexed_properties()
Returns this entity's unindexed properties, as a frozenset of strings.
update
update(
other
)
Updates this entity's properties from the values in other.
If any property name is the empty string or not a string, raises
BadPropertyError
. If any value is not a supported type, raises
BadValueError
.
values
values()
D.values() -> an object providing a view on D's values
__contains__
__contains__(
key, /
)
True if the dictionary has the specified key, else False.
__eq__
__eq__(
value, /
)
Return self==value.
__ge__
__ge__(
value, /
)
Return self>=value.
__getitem__
__getitem__()
x.getitem(y) <==> x[y]
__gt__
__gt__(
value, /
)
Return self>value.
__iter__
__iter__()
Implement iter(self).
__le__
__le__(
value, /
)
Return self<=value.
__len__
__len__()
Return len(self).
__lt__
__lt__(
value, /
)
Return self<value.
__ne__
__ne__(
value, /
)
Return self!=value.
__or__
__or__(
value, /
)
Return self|value.
__ror__
__ror__(
value, /
)
Return value|self.