**uid**: :code:`{jurisdiction.uid}_body:{slug}`
962693
def save(self, *args, **kwargs):
        
        stripped_name = ' '.join(
            w for w in self.organization.name.split()
            if w not in STOPWORDS
        )

        if not self.slug:
            self.slug = uuslug(
                stripped_name,
                instance=self,
                max_length=100,
                separator='-',
                start_no=2
            )
        self.uid = '{}_body:{}'.format(
            self.jurisdiction.uid, slugify(stripped_name))

        super(Body, self).save(*args, **kwargs)
304574
def slug_with_level(self, language=None):
        """"""
        level = ''
        if self.level:
            for n in range(0, self.level):
                level += '&nbsp;&nbsp;&nbsp;'
        return mark_safe(level + self.slug(language))
1209175
def get(self, uid):
        
        r = requests.get(self.apiurl + "/users/{}".format(uid), headers=self.header)

        if r.status_code != 200:
            raise ServerError

        jsd = r.json()

        if jsd['data']:
            return jsd['data']
        else:
            return None
578441
function (err, body) {
          if (!err) {
            var val = body.GET
            if (val) {
              /*
              {
                "GET": "[resource]@[id]"
              }
              */
              val = val.split('@')
              // overwrite body
              body = {
                'resource': val[0],
                '_id': val[1]
              }

              // success, pass the object
              callback(null, body)
            } else {
              // Redis key not found
              body = {
                'status': 404,
                'error_code': -44,
                'message': 'Page not found, invalid slug or store ID'
              }
              var msg = body.message
              errorHandling(callback, msg, body)
            }
          } else {
            // just pass the error
            callback(err, body)
          }
        }
433880
def link_detail(slug)
      slug = slug.slug if slug.instance_of? Instamojo::Link
      get("links/#{slug}")
      @response.success? ? Instamojo::Link.new(@response.body[:link], self) : @response
    end
334508
def return! request = nil, result = nil, & block
      if (200..207).include? code
        self
      elsif [301, 302, 307].include? code
        unless [:get, :head].include? args[:method]
          raise Exceptions::EXCEPTIONS_MAP[code].new(self, code)
        else
          follow_redirection(request, result, & block)
        end
      elsif code == 303
        args[:method] = :get
        args.delete :payload
        follow_redirection(request, result, & block)
      elsif Exceptions::EXCEPTIONS_MAP[code]
        raise Exceptions::EXCEPTIONS_MAP[code].new(self, code)
      else
        raise RequestFailed.new(self, code)
      end
    end
693509
def human_id(self):
        
        if self.NAME_ATTR in self.__dict__ and self.HUMAN_ID:
            return utils.to_slug(getattr(self, self.NAME_ATTR))
        return None
693145
function parseBODYSTRUCTURE(node, path = []) {
  let curNode = {};
  let i = 0;
  let part = 0;

  if (path.length) {
    curNode.part = path.join('.');
  }

  // multipart
  if (Array.isArray(node[0])) {
    curNode.childNodes = [];
    while (Array.isArray(node[i])) {
      curNode.childNodes.push(parseBODYSTRUCTURE(node[i], path.concat(++part)));
      i++;
    }

    // multipart type
    curNode.type = 'multipart/' + ((node[i++] || {}).value || '').toString().toLowerCase();

    // extension data (not available for BODY requests)

    // body parameter parenthesized list
    if (i < node.length - 1) {
      if (node[i]) {
        curNode.parameters = attributesToObject(node[i]);
      }
      i++;
    }
  } else {
    // content type
    curNode.type = [((node[i++] || {}).value || '').toString().toLowerCase(), ((node[i++] || {}).value || '').toString().toLowerCase()].join('/');

    // body parameter parenthesized list
    if (node[i]) {
      curNode.parameters = attributesToObject(node[i]);
    }
    i++;

    // id
    if (node[i]) {
      curNode.id = ((node[i] || {}).value || '').toString();
    }
    i++;

    // description
    if (node[i]) {
      curNode.description = ((node[i] || {}).value || '').toString();
    }
    i++;

    // encoding
    if (node[i]) {
      curNode.encoding = ((node[i] || {}).value || '').toString().toLowerCase();
    }
    i++;

    // size
    if (node[i]) {
      curNode.size = Number((node[i] || {}).value || 0) || 0;
    }
    i++;

    if (curNode.type === 'message/rfc822') {
      // message/rfc adds additional envelope, bodystructure and line count values

      // envelope
      if (node[i]) {
        curNode.envelope = parseENVELOPE([].concat(node[i] || []));
      }
      i++;

      if (node[i]) {
        curNode.childNodes = [
        // rfc822 bodyparts share the same path, difference is between MIME and HEADER
        // path.MIME returns message/rfc822 header
        // path.HEADER returns inlined message header
        parseBODYSTRUCTURE(node[i], path)];
      }
      i++;

      // line count
      if (node[i]) {
        curNode.lineCount = Number((node[i] || {}).value || 0) || 0;
      }
      i++;
    } else if (/^text\//.test(curNode.type)) {
      // text/* adds additional line count values

      // line count
      if (node[i]) {
        curNode.lineCount = Number((node[i] || {}).value || 0) || 0;
      }
      i++;
    }

    // extension data (not available for BODY requests)

    // md5
    if (i < node.length - 1) {
      if (node[i]) {
        curNode.md5 = ((node[i] || {}).value || '').toString().toLowerCase();
      }
      i++;
    }
  }

  // the following are shared extension values (for both multipart and non-multipart parts)
  // not available for BODY requests

  // body disposition
  if (i < node.length - 1) {
    if (Array.isArray(node[i]) && node[i].length) {
      curNode.disposition = ((node[i][0] || {}).value || '').toString().toLowerCase();
      if (Array.isArray(node[i][1])) {
        curNode.dispositionParameters = attributesToObject(node[i][1]);
      }
    }
    i++;
  }

  // body language
  if (i < node.length - 1) {
    if (node[i]) {
      curNode.language = [].concat(node[i]).map(val => (0, _ramda.propOr)('', 'value', val).toLowerCase());
    }
    i++;
  }

  // body location
  // NB! defined as a "string list" in RFC3501 but replaced in errata document with "string"
  // Errata: http://www.rfc-editor.org/errata_search.php?rfc=3501
  if (i < node.length - 1) {
    if (node[i]) {
      curNode.location = ((node[i] || {}).value || '').toString();
    }
    i++;
  }

  return curNode;
}
14979
def query_pager_by_slug(slug, current_page_num=1, tag='', order=False):
        '''
        
        '''
        cat_rec = MCategory.get_by_slug(slug)
        if cat_rec:
            cat_id = cat_rec.uid
        else:
            return None

        # The flowing code is valid.
        if cat_id.endswith('00'):
            # The first level category, using the code bellow.
            cat_con = TabPost2Tag.par_id == cat_id
        else:
            cat_con = TabPost2Tag.tag_id == cat_id

        if tag:
            condition = {
                'def_tag_arr': [tag]
            }
            recs = TabPost.select().join(
                TabPost2Tag,
                on=((TabPost.uid == TabPost2Tag.post_id) & (TabPost.valid == 1))
            ).where(
                cat_con & TabPost.extinfo.contains(condition)
            ).order_by(
                TabPost.time_update.desc()
            ).paginate(current_page_num, CMS_CFG['list_num'])
        elif order:
            recs = TabPost.select().join(
                TabPost2Tag,
                on=((TabPost.uid == TabPost2Tag.post_id) & (TabPost.valid == 1))
            ).where(
                cat_con
            ).order_by(
                TabPost.order.asc()
            )
        else:
            recs = TabPost.select().join(
                TabPost2Tag,
                on=((TabPost.uid == TabPost2Tag.post_id) & (TabPost.valid == 1))
            ).where(
                cat_con
            ).order_by(
                TabPost.time_update.desc()
            ).paginate(current_page_num, CMS_CFG['list_num'])

        return recs
989983
def _slugify_internal_collection_name(self, json_repr):
        """"""
        collection = self._coerce_json_to_collection(json_repr)
        if collection is None:
            return None
        internal_name = collection['name']
        return slugify(internal_name)
145383
def emit_body(body = body())
      unless body
        buffer.indent
        nl
        buffer.unindent
        return
      end
      visit_indented(body)
    end
531594
function(apiKey, contactList, fromAddress,
        toAddress, ccAddresses, bccAddresses, contentType, subject, htmlBody,
        textBody, _templateId) {}
300875
def derive_single_object_url_pattern(slug_url_kwarg, path, action):
    
    if slug_url_kwarg:
        return r'^%s/%s/(?P<%s>[^/]+)/$' % (path, action, slug_url_kwarg)
    else:
        return r'^%s/%s/(?P<pk>\d+)/$' % (path, action)
1316156
def auto_slug(self):
        
        slug = self.name
        if slug is not None:
            slug = slugify(slug, separator=self.SLUG_SEPARATOR)
            session = sa.orm.object_session(self)
            if not session:
                return None
            query = session.query(Entity.slug).filter(
                Entity._entity_type == self.object_type
            )
            if self.id is not None:
                query = query.filter(Entity.id != self.id)
            slug_re = re.compile(re.escape(slug) + r"-?(-\d+)?")
            results = [
                int(m.group(1) or 0)  # 0: for the unnumbered slug
                for m in (slug_re.match(s.slug) for s in query.all() if s.slug)
                if m
            ]

            max_id = max(-1, -1, *results) + 1
            if max_id:
                slug = f"{slug}-{max_id}"
        return slug
157272
def luid(self):
        
        p_elem = self.parent_pipeline.get('name')
        if not p_elem:
            p_elem = self.parent_pipeline['uid']

        s_elem = self.name
        if not s_elem:
            s_elem = self.uid

        return '%s.%s' % (p_elem, s_elem)
1354930
def post_generate_identifier(request):
    """"""
    d1_gmn.app.views.assert_db.post_has_mime_parts(request, (('field', 'scheme'),))
    if request.POST['scheme'] != 'UUID':
        raise d1_common.types.exceptions.InvalidRequest(
            0, 'Only the UUID scheme is currently supported'
        )
    fragment = request.POST.get('fragment', None)
    while True:
        pid = (fragment if fragment else '') + uuid.uuid4().hex
        if not d1_gmn.app.models.ScienceObject.objects.filter(pid__did=pid).exists():
            return pid
812972
def guid(self):
        '''
        
        '''
        iden = hashlib.md5()
        props = {'size': self.size}

        for name, item in self.hashes:
            iden.update(item.digest())
            props[name] = item.hexdigest()

        return iden.hexdigest(), props