Function to copy notes (requires login).

        Parameters:
            post_id (int):
            other_post_id (int): The id of the post to copy notes to.
503829
def post_copy_notes(self, post_id, other_post_id):
        
        return self._get('posts/{0}/copy_notes.json'.format(post_id),
                         {'other_post_id': other_post_id}, 'PUT', auth=True)
197826
def update(uid, post_data, update_time=False):
        '''
        
        '''

        title = post_data['title'].strip()
        if len(title) < 2:
            return False
        cnt_html = tools.markdown2html(post_data['cnt_md'])
        try:
            if update_time:
                entry2 = TabPost.update(
                    date=datetime.now(),
                    time_create=tools.timestamp()
                ).where(TabPost.uid == uid)
                entry2.execute()
        except:
            pass
        cur_rec = MPost.get_by_uid(uid)

        entry = TabPost.update(
            title=title,
            user_name=post_data['user_name'],
            cnt_md=tornado.escape.xhtml_escape(post_data['cnt_md'].strip()),
            memo=post_data['memo'] if 'memo' in post_data else '',
            cnt_html=cnt_html,
            logo=post_data['logo'],
            order=post_data['order'] if 'order' in post_data else '',
            keywords=post_data['keywords'] if 'keywords' in post_data else '',
            kind=post_data['kind'] if 'kind' in post_data else 1,
            extinfo=post_data['extinfo'] if 'extinfo' in post_data else cur_rec.extinfo,
            time_update=tools.timestamp(),
            valid=post_data.get('valid', 1)
        ).where(TabPost.uid == uid)
        entry.execute()
83765
public static function updateNote(
        int $object_id, int $note_id, string $title = null, string $note = null)
    {

        $note_record = Note::where('object_type', __CLASS__)
            ->where('object_id', $object_id)
            ->where('id', $note_id)
            ->first();

        if (! is_null($title))
            $note_record->title = $title;

        if (! is_null($note))
            $note_record->note = $note;

        $note_record->save();

    }
45700
def save_related(self, request, form, *args, **kwargs):
        
        result = super(PublishingAdmin, self) \
            .save_related(request, form, *args, **kwargs)
        # Send signal that draft has been saved and all relationships created
        if form.instance:
            publishing_signals.publishing_post_save_related.send(
                sender=type(self), instance=form.instance)
        return result
429136
def add_or_update(uid, post_data):
        '''
        
        '''
        cur_rec = MPost.get_by_uid(uid)
        if cur_rec:
            MPost.update(uid, post_data)
        else:
            MPost.create_post(uid, post_data)
1289786
def post_note(self):
        
        if self.args.note_title:
            note_title = self.args.note_title
        else:
            note_title = None

        note_content = self.args.note_content
        mynote = self.pump.Note(display_name=note_title, content=note_content)
        mynote.to = self.pump.me.followers
        mynote.cc = self.pump.Public
        mynote.send()

        return mynote.id or None
392356
def generate_notes(notes):
        
        new_notes = []

        for note in notes:
            tmp_note = {}
            for note_item in notes[note]:
                tmp_note[note_item] = notes[note][note_item]

            new_notes.append(tmp_note)

        return new_notes
1343259
def createissuewallnote(self, project_id, issue_id, content):
        
        data = {'body': content}
        request = requests.post(
            '{0}/{1}/issues/{2}/notes'.format(self.projects_url, project_id, issue_id),
            verify=self.verify_ssl, auth=self.auth, headers=self.headers, data=data, timeout=self.timeout)

        if request.status_code == 201:
            return request.json()
        else:
            return False
693514
def copy_doc(doc, dest)
      raise ArgumentError, "_id is required for copying" unless doc['_id']
      slug = escape_docid(doc['_id'])
      destination = if dest.respond_to?(:has_key?) && dest['_id'] && dest['_rev']
        "#{dest['_id']}?rev=#{dest['_rev']}"
      else
        dest
      end
      connection.copy "#{path}/#{slug}", destination
    end
443421
function post() {

		var slideElement = Reveal.getCurrentSlide(),
			notesElement = slideElement.querySelector( 'aside.notes' );

		var messageData = {
			notes: '',
			markdown: false,
			socketId: socketId,
			state: Reveal.getState()
		};

		// Look for notes defined in a slide attribute
		if( slideElement.hasAttribute( 'data-notes' ) ) {
			messageData.notes = slideElement.getAttribute( 'data-notes' );
		}

		// Look for notes defined in an aside element
		if( notesElement ) {
			messageData.notes = notesElement.innerHTML;
			messageData.markdown = typeof notesElement.getAttribute( 'data-markdown' ) === 'string';
		}

		socket.emit( 'statechanged', messageData );

	}
1063437
def _sync_notes(self, notes_json):
        """""""
        for note_json in notes_json:
            note_id = note_json['id']
            task_id = note_json['item_id']
            if task_id not in self.tasks:
                # ignore orphan notes
                continue
            task = self.tasks[task_id]
            self.notes[note_id] = Note(note_json, task)
318386
def get_note(self, noteid):

        

        if self.standard_grant_type is not "authorization_code":
            raise DeviantartError("Authentication through Authorization Code (Grant Type) is required in order to connect to this endpoint.")

        response = self._req('/notes/{}'.format(noteid))

        return response
792321
def get_notes(self, folderid="", offset=0, limit=10):

        

        if self.standard_grant_type is not "authorization_code":
            raise DeviantartError("Authentication through Authorization Code (Grant Type) is required in order to connect to this endpoint.")

        response = self._req('/notes', {
            'folderid' : folderid,
            'offset' : offset,
            'limit' : limit
        })

        notes = []

        for item in response['results']:
            n = {}

            n['noteid'] = item['noteid']
            n['ts'] = item['ts']
            n['unread'] = item['unread']
            n['starred'] = item['starred']
            n['sent'] = item['sent']
            n['subject'] = item['subject']
            n['preview'] = item['preview']
            n['body'] = item['body']
            n['user'] = User()
            n['user'].from_dict(item['user'])
            n['recipients'] = []

            for recipient_item in item['recipients']:
                u = User()
                u.from_dict(recipient_item)
                n['recipients'].append(u)

            notes.append(n)

        return {
            "results" : notes,
            "has_more" : response['has_more'],
            "next_offset" : response['next_offset']
        }
977414
function postSetTags(post_id, tags, cb) {
  var ids = _.pluck(tags, 'id')
    , q1 = 'DELETE FROM posts_tags WHERE post_id = $1'
    , q2 = 'INSERT INTO posts_tags (post_id, tag_id) VALUES ' +
    ids.map(function(id) {
      return '(' + post_id + ',' + id + ')';
    }).join(', ');

  db.getClient(function(err, client, done) {
    client.query(q1, [post_id], function(err, r) {
      if(err) { return cb(err); }
      client.query(q2, function(err, r) {
        if(err) {
          cb(err);
          done(err);
        } else {
          cb(null, r.rowCount);
          done();
        }
      });
    });
  });
}
840614
def copy(self):
        '''

        '''
        return type(self)(self.anneal, self.tm, overhang=self.overhang,
                          name=self.name, note=self.note)
76653
def load_post(wp_post_id):
    

    # wait a bit to give WordPress REST API a chance to catch up
    time.sleep(1)

    loader = WPAPILoader()
    post = loader.load_post(wp_post_id)

    if post:
        logger.info("Successfully loaded post wp_post_id=%s, pk=%s", wp_post_id, post.pk)
    else:
        logger.warning("Error loading post wp_post_id=%s", wp_post_id)
240427
def _steal_content(self, other_page):
        
        other_doc = other_page.doc
        other_doc_pages = other_doc.pages[:]
        other_doc_nb_pages = other_doc.nb_pages
        other_page_nb = other_page.page_nb

        to_move = [
            (other_page.__get_box_path(), self.__get_box_path()),
            (other_page.__get_img_path(), self.__get_img_path()),
            (other_page._get_thumb_path(), self._get_thumb_path())
        ]
        for (src, dst) in to_move:
            # sanity check
            if self.fs.exists(dst):
                logger.error("Error, file already exists: %s" % dst)
                assert(0)
        for (src, dst) in to_move:
            logger.info("%s --> %s" % (src, dst))
            self.fs.rename(src, dst)

        if (other_doc_nb_pages <= 1):
            other_doc.destroy()
        else:
            for page_nb in range(other_page_nb + 1, other_doc_nb_pages):
                page = other_doc_pages[page_nb]
                page.change_index(offset=-1)