<commit_before><%def name="render(templateUrl)">
  <% import urllib2 %>
  <% from django.conf import settings %>
  %if templateUrl:
    %if settings.APPSEMBLER_FEATURES.get('ENVIRONMENT', '') == "staging":
      ${urllib2.urlopen('https://staging.gymcms.xyz/static/' + templateUrl).read()}
    %elif settings.APPSEMBLER_FEATURES.get('ENVIRONMENT', '') == "production":
      ${urllib2.urlopen('https://gymcms.xyz/static/' + templateUrl).read()}
    %endif
  %endif
</%def><commit_msg>make sure CMS templates don’t crash site<commit_after><%def name="render(templateUrl)">
  <%
    import urllib2
    from django.conf import settings

    # turn the partial url passed in into a fully GET-able url
    # based on which environment we're in
    if templateUrl:
      if settings.APPSEMBLER_FEATURES.get('ENVIRONMENT', 'staging') == "staging":
        fullUrl = 'https://staging.gymcms.xyz/static/' + templateUrl
      elif settings.APPSEMBLER_FEATURES.get('ENVIRONMENT', '') == "production":
        fullUrl = 'https://gymcms.xyz/static/' + templateUrl

      # provided the last step worked, use a try block to pull that data from the web
      # render a hidden div if it fails, so it doesn't crash the rest of the page.
      if fullUrl:
        try:
          renderedContent = urllib2.urlopen(fullUrl).read()
        except:
          renderedContent = '<div hidden>error loading ' + fullUrl + '</div>'
  %>

  %if renderedContent:
    ${renderedContent}
  %endif
</%def>
{'fraction_non_alphanumeric': 0.1383989145183175, 'fraction_numerical': 0.0033921302578018998, 'mean_word_length': 3.376854599406528, 'pattern_counts': {'":': 4, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4601406', 'n_tokens_mistral': 481, 'n_tokens_neox': 460, 'n_words': 117}