create the post.
348429
def create_post(post_uid, post_data):
        '''
        
        '''
        title = post_data['title'].strip()
        if len(title) < 2:
            return False


        cur_rec = MPost.get_by_uid(post_uid)
        if cur_rec:
            return False

        entry = TabPost.create(
            title=title,
            date=datetime.now(),
            cnt_md=tornado.escape.xhtml_escape(post_data['cnt_md'].strip()),
            cnt_html=tools.markdown2html(post_data['cnt_md']),
            uid=post_uid,
            time_create=post_data.get('time_create', tools.timestamp()),
            time_update=post_data.get('time_update', tools.timestamp()),
            user_name=post_data['user_name'],
            view_count=post_data['view_count'] if 'view_count' in post_data else 1,
            logo=post_data['logo'],
            memo=post_data['memo'] if 'memo' in post_data else '',
            order=post_data['order'] if 'order' in post_data else '',
            keywords=post_data['keywords'] if 'keywords' in post_data else '',
            extinfo=post_data['extinfo'] if 'extinfo' in post_data else {},
            kind=post_data['kind'] if 'kind' in post_data else '1',
            valid=post_data.get('valid', 1)
        )
        return entry.uid
579636
def create(self, filename, filedata):
        """"""
        attributes = {'filename': filename,
                      'source': filedata}
        return self.transport.POST(url='/file/v2/', body=attributes, type='multipart/form-data')
829878
public function actionCreate()
    {
        $data = [
            'f1' => $this->getContext()->getInput()->post('p1'),
            'f2' => $this->getContext()->getInput()->post('p2'),
        ];

        $this->outputJson($data);
        //$this->outputJson(null, 'shibaile', 403);
    }
1240374
def _post(self, *args, **kwargs):
        
        if 'data' in kwargs:
            kwargs['data'] = json.dumps(kwargs['data'])
        response = requests.post(*args, **kwargs)
        response.raise_for_status()
1343822
def post(self):
        
        self._construct_post_data()

        post_args = {"json": self.post_data}
        self.http_method_args.update(post_args)

        return self.http_method("POST")
1018789
def post(self, resource, data=None, json=None):
        
        return self.do(resource, 'POST', data=data, json=json)
544992
def post(request):
    """"""
    data = request.POST or json.loads(request.body)['body']
    guid = data.get('guid', None)
    res = Result()

    if guid:
        obj = getObjectsFromGuids([guid,])[0]
        comment = Comment()
        comment.comment = data.get('comment', 'No comment')
        comment.user = request.user
        comment.user_name = request.user.get_full_name()
        comment.user_email = request.user.email
        comment.content_object = obj
        # For our purposes, we never have more than one site
        comment.site_id = 1
        comment.save()

        obj.comment_count += 1
        obj.save()

        emailComment(comment, obj, request)

        res.append(commentToJson(comment))

    return JsonResponse(res.asDict())
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)
1134641
def create(self, destination, mask, next_hops=[]):
        """"""
        payload = {
            "rib": self._build_payload(destination, mask, next_hops)
        }

        return self._post(self.url_prefix, payload)
1256392
async def post(self, request):
        """"""
        form = await self.get_form(request)
        if not form.validate():
            raise muffin.HTTPBadRequest(
                text=json.dumps(form.errors), content_type='application/json')
        await self.save_form(form, request)
        raise muffin.HTTPFound(self.url)
335964
def post(self):
        
        # type(data) = dict
        data = json.loads(self.request.body.decode())
        # type(method) = str
        method = data["method"]
        # type(params) = dict
        params = data["params"]
        if method == "sendmail":
            response = dispatch([sendmail],{'jsonrpc': '2.0', 'method': 'sendmail', 'params': [params], 'id': 1})
            #self.write(response)
        else:
            pass
7750
def create_new_post(params)      
      post_title = params['post']['title']
      post_date  = (Time.now).strftime("%Y-%m-%d")

      content    = yaml_data(post_title).to_yaml + "---\n" + params[:post][:content]
      post_file  = (post_date + " " + post_title).to_url + '.md'
      file       = File.join(jekyll_site.source, *%w[_posts], post_file)
      File.open(file, 'w') { |file| file.write(content)}
      post_file
    end
912405
def post(ctx, odm):
    """"""
    try:
        ctx.obj['RWS'].send_request(PostDataRequest(odm.read()))
        if ctx.obj['RAW']:
            click.echo(ctx.obj['RWS'].last_result.text)
    except RWSException as e:
        click.echo(e.message)
660254
def add_post(request, t_slug, t_id, p_id = False):  # topic slug, topic id, post id
    
    topic     = get_object_or_404(Topic, id=t_id)
    topic_url = '{0}page{1}/'.format(topic.get_short_url(), topic.page_count)
    user      = request.user
    current_time = time.time()
    form_title = 'Add a post'

    if topic.is_locked:  # If we mistakenly allowed reply on locked topic, bail with error msg.
        messages.error(request, 'Sorry, but this topic is closed')
        return HttpResponseRedirect(topic_url)

    q = None
    if p_id:  # if there's a post id, it's a quote
        q = Post.objects.get(id=p_id)
        form_title = "Respond to post"

    form = PostForm(request.POST or None, request.FILES or None)

    if form.is_valid():
        # we're going to save this inital data now,
        # rather than on the model save()
        # because we only want to bother with this stuff one time
        # and it will never update or change.

        instance = form.save(commit=False)
        instance.topic  = topic
        instance.user = user
        instance.author_name = user.display_name
        instance.avatar = user.avatar
        instance.post_date_int = current_time
        instance.quote = q
        instance.save()

        update_post_relations(user, topic)

        return HttpResponseRedirect('%s?new_post=%s#post-%s' % (topic_url, t_id, instance.id))
    return render(request, 'fretboard/add_edit.html', {
        'form': form,
        'form_title': form_title,
        'quote': q,
        'FORUM_BASE_NAME': FORUM_BASE_NAME
    })
924260
public function actionCreate()
	{
		$post=new Post;
		if(Yii::app()->request->isPostRequest)
		{
			if(isset($_POST['Post']))
				$post->setAttributes($_POST['Post']);
			if($post->save())
				$this->redirect(array('show','id'=>$post->id));
		}
		$this->render('create',array('post'=>$post));
	}
1241669
def create_response(self, request, image, content_type):
        """"""

        return HttpResponse(content=image, content_type=content_type)
1308665
def post(url, data=None, json=None, **kwargs):
    """"""
    _set_content_type(kwargs)
    if _content_type_is_json(kwargs) and data is not None:
        data = dumps(data)
    _log_request('POST', url, kwargs, data)
    response = requests.post(url, data, json, **kwargs)
    _log_response(response)
    return response