本文整理汇总了Python中mcfw.properties.azzert函数的典型用法代码示例。如果您正苦于以下问题:Python azzert函数的具体用法?Python azzert怎么用?Python azzert使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了azzert函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: run_local_services
def run_local_services(app_user, ipaddress, auto_connected_service, service_helper):
logging.debug("Checking if %s (ip: %s) is in %s for %s",
app_user, ipaddress, auto_connected_service.local, auto_connected_service.service_identity_email)
profile = get_user_profile(app_user)
if not profile.language:
logging.info("Can't connect %s to %s. User has no language set.",
app_user, auto_connected_service.service_identity_email)
return
if profile.country:
country_code = profile.country
elif ipaddress:
country_code = get_country_code_by_ipaddress(ipaddress)
azzert(country_code)
else:
logging.info("Can't connect %s to %s if there is no ip address, and no country in UserProfile.",
app_user, auto_connected_service.service_identity_email)
return
local_service_map_key = "%s-%s" % (profile.language, country_code.lower())
if local_service_map_key in auto_connected_service.local:
deferred.defer(hookup, app_user, auto_connected_service, service_helper, _queue=HIGH_LOAD_WORKER_QUEUE)
else:
logging.info("Not connecting to %s. There is no entry for local key %s",
auto_connected_service.service_identity_email, local_service_map_key)
开发者ID:rogerthat-platform,项目名称:rogerthat-backend,代码行数:27,代码来源:hookup_with_default_services.py
示例2: trans
def trans(): # Operates on 2 entity groups
hookup_with_default_services.schedule(mobile_user, ipaddress)
deferred.defer(sync_payment_database, mobile_user, _transactional=True)
if invitor_code and invitor_secret:
pp = ProfilePointer.get(invitor_code)
if not pp:
logging.error("User with userCode %s not found!" % invitor_code)
else:
deferred.defer(ack_invitation_by_invitation_secret, mobile_user, pp.user, invitor_secret,
_transactional=True, _countdown=10)
elif invitor_code:
for ysaaa_hash, static_email in chunks(server_settings.ysaaaMapping, 2):
if invitor_code == ysaaa_hash:
service_user = users.User(static_email)
makeFriends(service_user, mobile_user, original_invitee=None, servicetag=None, origin=ORIGIN_YSAAA)
break
else:
azzert(False, u"ysaaa registration received but not found mapping")
for _, static_email in chunks(server_settings.staticPinCodes, 2):
if mobile_user.email() == static_email:
break
else:
deferred.defer(send_messages_after_registration, mobile_key, _transactional=True)
开发者ID:our-city-app,项目名称:mobicage-backend,代码行数:26,代码来源:registration.py
示例3: get
def get(self, info):
try:
padding = ""
while True:
try:
data = base64.b64decode(info + padding)
break
except TypeError:
if len(padding) < 2:
padding += "="
else:
raise
json_params = json.loads(data)
parent_message_key = json_params['parent_message_key']
message_key = json_params['message_key']
azzert(message_key, "message_key is required")
if parent_message_key == "":
parent_message_key = None
except:
logging.exception("Error in ServiceDownloadPhotoHandler")
self.error(404)
return
logging.debug("Download photo %s %s" % (parent_message_key, message_key))
photo_upload_result = get_transfer_result(parent_message_key, message_key)
if not photo_upload_result:
self.error(404)
return
azzert(photo_upload_result.status == photo_upload_result.STATUS_VERIFIED)
self.response.headers['Content-Type'] = "image/jpeg" if photo_upload_result.content_type == None else str(photo_upload_result.content_type)
self.response.out.write(assemble_transfer_from_chunks(photo_upload_result.key()))
开发者ID:rogerthat-platform,项目名称:rogerthat-backend,代码行数:35,代码来源:photo.py
示例4: parse_data
def parse_data(self, email, data):
user = users.User(email)
data = base64.decodestring(data)
data = decrypt(user, data)
data = json.loads(data)
azzert(data["d"] == calculate_secure_url_digest(data))
return data, user
开发者ID:rogerthat-platform,项目名称:rogerthat-backend,代码行数:7,代码来源:unsubscribe_reminder_service.py
示例5: get
def get(self):
service_user = users.get_current_user()
azzert(get_service_profile(service_user)) # must exist
message_flow_designs = get_service_message_flow_designs(service_user)
result = []
for wiring in message_flow_designs:
if wiring.deleted or not wiring.definition:
continue
wiringDefinition = json.loads(wiring.definition)
for k in wiringDefinition.iterkeys():
if k == u"modules":
for m in wiringDefinition[k]:
if m["value"]:
m["config"]["formMessageDef"] = m["value"]
result.append({"name": wiring.name, "language": wiring.language, "working": json.dumps(wiringDefinition)})
if not result:
wiring_id = "Sample message flow"
language = "MessageFlow"
result.append({"name": wiring_id, "language": language, "working": SAMPLE_MF})
message_flow_design = MessageFlowDesign(parent=parent_key(service_user), key_name=wiring_id)
message_flow_design.definition = SAMPLE_MF
message_flow_design.name = wiring_id
message_flow_design.language = language
message_flow_design.design_timestamp = now()
message_flow_design.status = MessageFlowDesign.STATUS_VALID
message_flow_design.js_flow_definitions = JsFlowDefinitions()
message_flow_design.put()
self.response.out.write(json.dumps(result))
开发者ID:rogerthat-platform,项目名称:rogerthat-backend,代码行数:32,代码来源:mfd.py
示例6: get_friend_service_identity_connections_keys_of_app_user_query
def get_friend_service_identity_connections_keys_of_app_user_query(app_user):
app_user_email = app_user.email()
azzert('/' not in app_user_email, 'no slash expected in %s' % app_user_email)
qry = db.GqlQuery("SELECT __key__ FROM FriendServiceIdentityConnection"
" WHERE ANCESTOR IS :ancestor AND deleted = False")
qry.bind(ancestor=parent_key(app_user))
return qry
开发者ID:our-city-app,项目名称:mobicage-backend,代码行数:7,代码来源:service.py
示例7: get_child_messages
def get_child_messages(app_user, parent_messages):
child_messages = list()
for m in parent_messages:
azzert(app_user in m.members)
for key in m.childMessages:
child_messages.append(key)
return db.get(child_messages)
开发者ID:our-city-app,项目名称:mobicage-backend,代码行数:7,代码来源:messaging.py
示例8: get_friend_service_identity_connections_of_service_identity_keys_query
def get_friend_service_identity_connections_of_service_identity_keys_query(service_identity_user):
azzert('/' in service_identity_user.email(), 'no slash in %s' % service_identity_user.email())
qry = db.GqlQuery("SELECT __key__ FROM FriendServiceIdentityConnection "
"WHERE deleted = False AND service_identity_email = :service_identity_email "
"ORDER BY friend_name ASC")
qry.bind(service_identity_email=service_identity_user.email())
return qry
开发者ID:our-city-app,项目名称:mobicage-backend,代码行数:7,代码来源:service.py
示例9: trans_create
def trans_create(avatar, image, share_sid_key):
azzert(not get_service_profile(service_user, cached=False))
azzert(not get_default_service_identity_not_cached(service_user))
profile = ServiceProfile(parent=parent_key(service_user), key_name=service_user.email())
profile.avatarId = avatar.key().id()
_calculateAndSetAvatarHash(profile, image)
service_identity_user = create_service_identity_user(service_user, ServiceIdentity.DEFAULT)
service_identity = ServiceIdentity(key=ServiceIdentity.keyFromUser(service_identity_user))
service_identity.inheritanceFlags = 0
service_identity.name = name
service_identity.description = "%s (%s)" % (name, service_user.email())
service_identity.shareSIDKey = share_sid_key
service_identity.shareEnabled = False
service_identity.creationTimestamp = now()
service_identity.defaultAppId = supported_app_ids[0]
service_identity.appIds = supported_app_ids
update_result = update_func(profile, service_identity) if update_func else None
put_and_invalidate_cache(profile, service_identity,
ProfilePointer.create(service_user),
ProfileHashIndex.create(service_user))
deferred.defer(create_default_qr_templates, service_user, _transactional=True)
deferred.defer(create_default_news_settings, service_user, profile.organizationType, _transactional=True)
return profile, service_identity, update_result
开发者ID:our-city-app,项目名称:mobicage-backend,代码行数:29,代码来源:profile.py
示例10: get_message_flow_design_keys_by_sub_flow_key
def get_message_flow_design_keys_by_sub_flow_key(flow_key):
kind = MessageFlowDesign.kind()
azzert(flow_key.kind() == kind)
qry = MessageFlowDesign.gql("WHERE sub_flows = :flow AND ANCESTOR IS :ancestor AND deleted = false")
qry.bind(flow=flow_key, ancestor=flow_key.parent())
for mfd in qry.run():
yield mfd.key()
开发者ID:our-city-app,项目名称:mobicage-backend,代码行数:7,代码来源:mfd.py
示例11: get_service_identity_details
def get_service_identity_details(identifier):
azzert(identifier)
service_user = users.get_current_user()
service_identity_user = create_service_identity_user(service_user, identifier)
service_identity = get_service_identity_not_cached(service_identity_user)
service_profile = get_service_profile(service_user, cached=False)
return ServiceIdentityDetailsTO.fromServiceIdentity(service_identity, service_profile)
开发者ID:our-city-app,项目名称:mobicage-backend,代码行数:7,代码来源:service_panel.py
示例12: _perform_call
def _perform_call(callId, request_json, timestamp):
api_version, callid, function, parameters = parse_and_validate_request(request_json)
if not function:
result = {
CALL_ID: callId,
API_VERSION: api_version,
ERROR: "Unknown function call!",
STATUS: STATUS_FAIL,
CALL_TIMESTAMP: timestamp}
return json.dumps(result), result
azzert(callid == callId)
result = dict()
result[CALL_ID] = callid
result[API_VERSION] = api_version
result[CALL_TIMESTAMP] = timestamp
try:
check_function_metadata(function)
kwarg_types = get_parameter_types(function)
kwargs = get_parameters(parameters, kwarg_types)
for key in set(kwarg_types.keys()) - set(kwargs.keys()):
kwargs[key] = MISSING
result[RESULT] = run(function, [], kwargs)
result[STATUS] = STATUS_SUCCESS
return json.dumps(result), result
except Exception, e:
result[ERROR] = unicode(e)
result[STATUS] = STATUS_FAIL
from rogerthat.rpc.service import ServiceApiException, ApiWarning
if isinstance(e, (ServiceApiException, ApiWarning)):
loglevel = logging.WARNING
else:
loglevel = logging.ERROR
logging.log(loglevel, "Error while executing %s: %s" % (function.__name__, traceback.format_exc()))
return json.dumps(result), result
开发者ID:rogerthat-platform,项目名称:rogerthat-backend,代码行数:34,代码来源:rpc.py
示例13: get_full_language_string
def get_full_language_string(short_language):
""" Map short language ('en', 'fr') to long language str ('English', 'French (Français)') """
language = OFFICIALLY_SUPPORTED_ISO_LANGUAGES.get(short_language)
if language is None:
language = OFFICIALLY_SUPPORTED_LANGUAGES.get(short_language)
azzert(language)
return language
开发者ID:rogerthat-platform,项目名称:rogerthat-backend,代码行数:7,代码来源:__init__.py
示例14: update_profile_from_profile_discovery
def update_profile_from_profile_discovery(app_user, discovery):
azzert(discovery.user == app_user)
changed_properties = []
user_profile = get_user_profile(app_user)
new_name = discovery.name.strip()
if user_profile.name != new_name:
changed_properties.append(u"name")
user_profile.name = new_name
if discovery.avatar:
img = images.Image(str(discovery.avatar))
img.resize(150, 150)
avatar = get_avatar_by_id(user_profile.avatarId)
if not avatar:
avatar = Avatar(user=app_user)
image = img.execute_transforms(images.PNG, 100)
avatar.picture = db.Blob(image)
avatar.put()
user_profile.avatarId = avatar.key().id()
_calculateAndSetAvatarHash(user_profile, image)
changed_properties.append(u"avatar")
user_profile.version += 1
user_profile.put()
update_mobiles(app_user, user_profile)
update_friends(user_profile, changed_properties)
开发者ID:our-city-app,项目名称:mobicage-backend,代码行数:25,代码来源:profile.py
示例15: get
def get(self):
data_dict, app_user = self.get_user_info()
if not data_dict or not app_user:
return
azzert(data_dict['a'] == "unsubscribe broadcast")
broadcast_type = data_dict['bt']
si_user = users.User(data_dict['e'])
_, user_profile, si, fsic = run_in_xg_transaction(self._un_subscribe, app_user, si_user, broadcast_type)
if fsic or not si:
message = '%s,<br><br>%s' % (xml_escape(localize(user_profile.language, u'dear_name',
name=user_profile.name)),
xml_escape(localize(user_profile.language,
u'successfully_unsubscribed_broadcast_type',
notification_type=broadcast_type,
service=si.name if si else data_dict['n'])))
else:
language = get_languages_from_request(self.request)[0]
if not user_profile:
# User already deactivated his account
human_user, app_id = get_app_user_tuple(app_user)
message = localize(language, u'account_already_deactivated',
account=human_user.email(), app_name=get_app_name_by_id(app_id))
else:
# User is not connected anymore to this service identity
message = localize(language, u'account_already_disconnected_from_service',
service_name=si.name)
jinja_template = self.get_jinja_environment().get_template('unsubscribe_broadcast_type.html')
self.response.out.write(jinja_template.render(dict(message=message)))
开发者ID:rogerthat-platform,项目名称:rogerthat-backend,代码行数:32,代码来源:unsubscribe_reminder_service.py
示例16: _must_continue_with_update_service
def _must_continue_with_update_service(service_profile_or_user, bump_service_version=False,
clear_broadcast_settings_cache=False):
def trans(service_profile):
azzert(service_profile)
service_profile_updated = False
if not service_profile.autoUpdating and not service_profile.updatesPending:
service_profile.updatesPending = True
service_profile_updated = True
if bump_service_version:
service_profile.version += 1
service_profile_updated = True
if clear_broadcast_settings_cache:
service_profile.addFlag(ServiceProfile.FLAG_CLEAR_BROADCAST_SETTINGS_CACHE)
service_profile_updated = True
if service_profile_updated:
channel.send_message(service_profile.user, 'rogerthat.service.updatesPendingChanged',
updatesPending=service_profile.updatesPending)
service_profile.put()
return service_profile.autoUpdating
is_user = not isinstance(service_profile_or_user, ServiceProfile)
if db.is_in_transaction():
azzert(not is_user)
service_profile = service_profile_or_user
auto_updating = trans(service_profile_or_user)
else:
service_profile = get_service_profile(service_profile_or_user, False) if is_user else service_profile_or_user
auto_updating = db.run_in_transaction(trans, service_profile)
if not auto_updating:
logging.info("Auto-updates for %s are suspended." % service_profile.user.email())
return auto_updating
开发者ID:our-city-app,项目名称:mobicage-backend,代码行数:34,代码来源:update_friends.py
示例17: from_string
def from_string(cls, settings_string):
to = cls()
parts = settings_string.split(":")
part_ip = [int(p) for p in parts[0].split('.')]
azzert(len(part_ip) == 4)
to.ip = parts[0].decode('unicode-escape')
to.port = int(parts[1])
return to
开发者ID:our-city-app,项目名称:mobicage-backend,代码行数:8,代码来源:news.py
示例18: bizz_check
def bizz_check(condition, error_message='', error_class=None):
if not condition:
from rogerthat.rpc.service import BusinessException
if error_class is None:
error_class = BusinessException
else:
azzert(issubclass(error_class, BusinessException))
raise error_class(error_message)
开发者ID:rogerthat-platform,项目名称:rogerthat-backend,代码行数:8,代码来源:__init__.py
示例19: press_menu_item
def press_menu_item(service, coords, generation, context):
# generation is service identity menuGeneration
from rogerthat.bizz.service import press_menu_item as press_menu_item_bizz
user = users.get_current_user()
service_identity_user = add_slash_default(users.User(service))
azzert(get_friend_serviceidentity_connection(user, service_identity_user),
"%s tried to press menu item of service %s" % (user.email(), service))
press_menu_item_bizz(user, service_identity_user, coords, context, generation, timestamp=now())
开发者ID:rogerthat-platform,项目名称:rogerthat-backend,代码行数:8,代码来源:services.py
示例20: fromFormMessage
def fromFormMessage(fm):
from rogerthat.models import FormMessage
azzert(isinstance(fm, FormMessage))
rm = RootFormMessageTO()
rm.__dict__.update(WebFormMessageTO.fromMessage(fm).__dict__)
rm.messages = list()
rm.message_type = fm.TYPE
return rm
开发者ID:rogerthat-platform,项目名称:rogerthat-backend,代码行数:8,代码来源:forms.py
注:本文中的mcfw.properties.azzert函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论