def has_reached_plugin_limit(placeholder, plugin_type, language, template=None):
 limits = get_placeholder_conf('limits', placeholder.slot, template)
 if limits:
  global_limit = limits.get('global')
  type_limit = limits.get(plugin_type)
  count = placeholder.get_plugins(language=language).count()
  if (global_limit and (count >= global_limit)):
   raise PluginLimitReached(_(('This placeholder already has the maximum number of plugins (%s).' % count)))
  elif type_limit:
   type_count = placeholder.get_plugins(language=language).filter(plugin_type=plugin_type).count()
   if (type_count >= type_limit):
    plugin_name = force_text(plugin_pool.get_plugin(plugin_type).name)
    raise PluginLimitReached((_('This placeholder already has the maximum number (%(limit)s) of allowed %(plugin_name)s plugins.') % {'limit': type_limit, 'plugin_name': plugin_name}))
 return False

def has_reached_plugin_limit ( placeholder , plugin_type , language , template = None ) : limits = get_placeholder_conf ( 'limits' , placeholder . slot , template ) if limits : global_limit = limits . get ( 'global' ) type_limit = limits . get ( plugin_type ) count = placeholder . get_plugins ( language = language ) . count ( ) if ( global_limit and ( count >= global_limit ) ) : raise PluginLimitReached ( _ ( ( 'This placeholder already has the maximum number of plugins (%s).' % count ) ) ) elif type_limit : type_count = placeholder . get_plugins ( language = language ) . filter ( plugin_type = plugin_type ) . count ( ) if ( type_count >= type_limit ) : plugin_name = force_text ( plugin_pool . get_plugin ( plugin_type ) . name ) raise PluginLimitReached ( ( _ ( 'This placeholder already has the maximum number (%(limit)s) of allowed %(plugin_name)s plugins.' ) % { 'limit' : type_limit , 'plugin_name' : plugin_name } ) ) return False
checks if placeholder has reached its global plugin limit .