thirdparty/google_appengine/google/appengine/api/datastore_types.py
changeset 2273 e4cb9c53db3e
parent 1278 a7766286a7be
child 2413 d0b7dac5325c
equal deleted inserted replaced
2272:26491ee91e33 2273:e4cb9c53db3e
  1169   pbvalue.mutable_uservalue().set_email(value.email().encode('utf-8'))
  1169   pbvalue.mutable_uservalue().set_email(value.email().encode('utf-8'))
  1170   pbvalue.mutable_uservalue().set_auth_domain(
  1170   pbvalue.mutable_uservalue().set_auth_domain(
  1171       value.auth_domain().encode('utf-8'))
  1171       value.auth_domain().encode('utf-8'))
  1172   pbvalue.mutable_uservalue().set_gaiaid(0)
  1172   pbvalue.mutable_uservalue().set_gaiaid(0)
  1173 
  1173 
       
  1174   if value.user_id() is not None:
       
  1175     pbvalue.mutable_uservalue().set_obfuscated_gaiaid(
       
  1176         value.user_id().encode('utf-8'))
       
  1177 
  1174 
  1178 
  1175 def PackKey(name, value, pbvalue):
  1179 def PackKey(name, value, pbvalue):
  1176   """Packs a reference property into a entity_pb.PropertyValue.
  1180   """Packs a reference property into a entity_pb.PropertyValue.
  1177 
  1181 
  1178   Args:
  1182   Args:
  1366   elif pbval.has_pointvalue():
  1370   elif pbval.has_pointvalue():
  1367     value = (pbval.pointvalue().x(), pbval.pointvalue().y())
  1371     value = (pbval.pointvalue().x(), pbval.pointvalue().y())
  1368   elif pbval.has_uservalue():
  1372   elif pbval.has_uservalue():
  1369     email = unicode(pbval.uservalue().email().decode('utf-8'))
  1373     email = unicode(pbval.uservalue().email().decode('utf-8'))
  1370     auth_domain = unicode(pbval.uservalue().auth_domain().decode('utf-8'))
  1374     auth_domain = unicode(pbval.uservalue().auth_domain().decode('utf-8'))
  1371     value = users.User(email=email, _auth_domain=auth_domain)
  1375     obfuscated_gaiaid = pbval.uservalue().obfuscated_gaiaid().decode('utf-8')
       
  1376     obfuscated_gaiaid = unicode(obfuscated_gaiaid)
       
  1377     value = users.User(email=email,
       
  1378                        _auth_domain=auth_domain,
       
  1379                        _user_id=obfuscated_gaiaid)
  1372   else:
  1380   else:
  1373     value = None
  1381     value = None
  1374 
  1382 
  1375   try:
  1383   try:
  1376     if pb.has_meaning():
  1384     if pb.has_meaning():
  1442     A python type.
  1450     A python type.
  1443   """
  1451   """
  1444   return _PROPERTY_TYPE_STRINGS[type_name]
  1452   return _PROPERTY_TYPE_STRINGS[type_name]
  1445 
  1453 
  1446 
  1454 
  1447 def PropertyValueFromString(type_, value_string, _auth_domain=None):
  1455 def PropertyValueFromString(type_,
       
  1456                             value_string,
       
  1457                             _auth_domain=None):
  1448   """Returns an instance of a property value given a type and string value.
  1458   """Returns an instance of a property value given a type and string value.
  1449 
  1459 
  1450   The reverse of this method is just str() and type() of the python value.
  1460   The reverse of this method is just str() and type() of the python value.
  1451 
  1461 
  1452   Note that this does *not* support non-UTC offsets in ISO 8601-formatted
  1462   Note that this does *not* support non-UTC offsets in ISO 8601-formatted