Add or update the post.
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)
825435
def add_or_update(user_id, post_id, kind):
        '''
        
        '''

        rec = MUsage.query_by_signature(user_id, post_id)
        cate_rec = MInfor2Catalog.get_first_category(post_id)
        if cate_rec:
            cat_id = cate_rec.tag_id
        else:
            return False

        if rec.count() > 0:
            logger.info('Usage update: {uid}'.format(uid=post_id))
            rec = rec.get()
            query = TabUsage.update(kind=kind).where(TabUsage.uid == rec.uid)
            query.execute()
            MUsage.count_increate(rec.uid, cat_id, rec.count)
        else:
            logger.info('Usage create: {uid}'.format(uid=post_id))
            TabUsage.create(
                uid=tools.get_uuid(),
                post_id=post_id,
                user_id=user_id,
                count=1,
                tag_id=cat_id,
                timestamp=int(time.time()),
                kind=kind,
            )
1127017
protected function submitAddCurrency()
    {
        $this->setSubmitted(null, $this->getParam());
        $this->validateComponent('currency');
        $this->addCurrency();
    }
359414
protected function addAddCart()
    {
        if (!$this->isError()) {
            $id = $this->cart->add($this->getSubmitted());
            if (empty($id)) {
                $this->errorAndExit($this->text('Unexpected result'));
            }
            $this->line($id);
        }
    }
1115918
def add(self, post_id):
        '''
        
        '''
        post_data = self.get_post_data()

        post_data['user_name'] = self.userinfo.user_name
        post_data['user_id'] = self.userinfo.uid
        post_data['post_id'] = post_id
        replyid = MReply.create_reply(post_data)
        if replyid:
            out_dic = {'pinglun': post_data['cnt_reply'],
                       'uid': replyid}
            logger.info('add reply result dic: {0}'.format(out_dic))
            return json.dump(out_dic, self)
168087
def _post(self, *args, **kwargs):
        
        data = self._default_data()
        data.update(kwargs.get('data') or {})
        kwargs['data'] = data
        return self._request(requests.post, *args, **kwargs)
556102
def update(self):
        
        params = {}
        return self.send(
            url=self._base_url + 'update',
            method='POST',
            json=params
        )
305013
public function update($value, \WP_Post $post = null){
        if( $this->validate($value) ){
            $this->save($value, $post);
        }
    }
896400
public function add()
    {
        $this->request->allowMethod(['get', 'post']);

        $menu = $this->Menus->newEntity();
        if ($this->request->is('post') && !empty($this->request->data)) {
            $this->Menus->patchEntity($menu, $this->request->data);
            if ($this->Menus->save($menu)) {
                $this->Flash->success(__d('wasabi_core', 'The menu <strong>{0}</strong> has been created.', $this->request->data['name']));
                $this->redirect(['action' => 'index']);
                return;
            } else {
                $this->Flash->error($this->formErrorMessage);
            }
        }
        $this->set('menu', $menu);
    }
284338
public function update(Post $post, UpdatePostRequest $request)
    {
        $this->authorize(PostsPolicy::PERMISSION_UPDATE);

        $post->updateOne($request->getValidatedData());

        $this->transNotification('updated', ['title' => $post->title], $post->toArray());

        return redirect()->route('admin::blog.posts.show', [$post]);
    }
878509
def add_posts(self, path='posts'):
		
		path = os.path.join(self.root_path, path)
		self.cm.add_posts([
			self.cm.Post.from_file(file)
			for file in _listfiles(path)
		])
822479
def post(self, *args, **kwargs):
        """"""
        if self.upload_allowed():
            form = self.get_upload_form()
            result = {}
            if form.is_valid():
                storage = self.get_storage()
                result['is_valid'] = True
                info = form.stash(storage, self.request.path)
                result.update(info)
            else:
                result.update({
                    'is_valid': False,
                    'errors': form.errors,
                })
            return HttpResponse(json.dumps(result), content_type='application/json')
        else:
            return HttpResponseForbidden()
177817
public function add()
    {
        $group = $this->Groups->newEntity();
        if ($this->request->is('post') && !empty($this->request->data)) {
            $this->Groups->patchEntity($group, $this->request->data);
            if ($this->Groups->save($group)) {
                $this->Flash->success(__d('wasabi_core', 'The group <strong>{0}</strong> has been created.', $this->request->data['name']));
                $this->redirect(['action' => 'index']);
                return;
            } else {
                $this->Flash->error($this->formErrorMessage);
            }
        }
        $this->set('group', $group);
    }
875125
def post(self, request, *args, **kwargs):
        
        return self.lock(request, *args, **kwargs)
164080
protected function submitAddUser()
    {
        $this->setSubmitted(null, $this->getParam());
        $this->setSubmittedJson('data');

        $this->validateComponent('user');
        $this->addUser();
    }
308098
def _post(self, url, data={}):
        """"""
        r = requests.post(self._api_prefix + url,
            data=json.dumps(data),
            headers=self.headers,
            auth=self.auth,
            allow_redirects=False,
        )
        return self._action(r)
220958
public function save ($post_ID)
    {
        if (!$this->doSave())
            return;
        if ($post_ID === self::SITE)
            update_option($this->identifier, $this->getPostValue());
        else
            update_post_meta($post_ID, $this->identifier, $this->getPostValue());
    }