POST /topics
 POST /topics.xml
483331
def create
      @topic = Topic.new(topic_params)
      @topic.user_id = current_user.id

      if @topic.save
        redirect_to(topic_path(@topic.id), notice: t('homeland.topic_created'))
      else
        render action: "new"
      end
    end
677834
def post(path, doc = nil, options = {}, &block)
      execute('POST', path, options, doc, &block)
    end
1206684
def new_topic(self, title, content):
        
        data = {
            'title': title,
            'body': content,
            'csrfmiddlewaretoken': self._request.cookies.get('csrftoken')
        }
        url = 'http://www.shanbay.com/api/v1/forum/%s/thread/' % self.forum_id()
        r = self.request(url, 'post', data=data)
        j = r.json()
        if j['status_code'] == 0:
            return j['data']['thread']['id']
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)
		])
1305297
function posts (content, contentType) {
  let output = {}
  const allFiles = content.filter(each => each.dir.includes(`/${contentType}`))
  const index = allFiles.filter(each => each.base === 'index.md')[0]
  index.attr.forEach(each => {
    allFiles.forEach(file => {
      if (file.name === each) {
        output[each] = file
      }
    })
  })
  return output
}
1298563
public function get_mark_post_as_read_url_from_post(post_entity $post, int $displaymode = FORUM_MODE_THREADED) : moodle_url {
        $params = [
            'd' => $post->get_discussion_id(),
            'postid' => $post->get_id(),
            'mark' => 'read'
        ];

        $url = new moodle_url('/mod/forum/discuss.php', $params);

        if ($displaymode == FORUM_MODE_THREADED) {
            $url->param('parent', $post->get_parent_id());
        } else {
            $url->set_anchor('p' . $post->get_id());
        }

        return $url;
    }
259842
function post(logStore, topic, source, keyContents) {
  return AliyunLog && AliyunLog.postAliyunLog && AliyunLog.postAliyunLog(logStore, topic, source, keyContents);
}
1318346
def post(path, headers: {}, query: {}, payload: {})
      @parent.post("/#{@segment}/#{path}".gsub(%r{/+}, '/'),
                   headers: @default_headers.merge(headers), query: query, payload: payload)
    end
921447
def add_topic(request, forum_slug=None):
    
    forum = Forum.objects.get(slug=forum_slug)
    form  = AddTopicForm(request.POST or None, request.FILES or None, initial={'forum': forum})

    current_time   = time.time()
    user           = request.user

    if form.is_valid():
        instance = form.save(commit=False)
        instance.forum           = forum
        instance.name            = strip_tags(instance.name)
        instance.slug            = slugify(instance.name)
        instance.user            = user
        instance.author          = user.display_name
        instance.lastpost_author = user.display_name
        instance.created_int     = current_time
        instance.modified_int    = current_time
        instance.save()

        # and now add the child post
        post = Post(
            topic            = instance,
            text             = request.POST['text'],
            user             = user,
            post_date_int    = current_time
        )
        if request.FILES:
            post.image = request.FILES['image']
        post.save()

        return HttpResponseRedirect("/forum/%s/?new_topic=%s" % (forum_slug, instance.id))

    return render(request, 'fretboard/add_edit.html', {
        'form': form,
        'form_title': 'Add a topic',
        'FORUM_BASE_NAME': FORUM_BASE_NAME
    })
750761
def topics(self):
        
        from .topic import Topic

        for topic in self.soup.find_all('a', class_='zm-item-tag'):
            yield Topic(Zhihu_URL + topic['href'], topic.text.replace('\n', ''),
                        session=self._session)
555751
public function Discussions() {
      // Setup head
      $this->AddCssFile('vanilla.css');
      $this->Menu->HighlightRoute('/discussions');
      $this->AddJsFile('discussions.js');
      $Title = C('Garden.HomepageTitle');
      if ($Title)
         $this->Title($Title, '');
      else
         $this->Title(T('All Categories'));
      $this->Description(C('Garden.Description', NULL));
      Gdn_Theme::Section('CategoryDiscussionList');
      
      // Set the category follow toggle before we load category data so that it affects the category query appropriately.
      $CategoryFollowToggleModule = new CategoryFollowToggleModule($this);
      $CategoryFollowToggleModule->SetToggle();
      
      // Get category data and discussions
      $this->DiscussionsPerCategory = C('Vanilla.Discussions.PerCategory', 5);
      $DiscussionModel = new DiscussionModel();
      $this->CategoryModel->Watching = !Gdn::Session()->GetPreference('ShowAllCategories');
      $this->CategoryData = $this->CategoryModel->GetFull();
      $this->SetData('Categories', $this->CategoryData);
      $this->CategoryDiscussionData = array();
      foreach ($this->CategoryData->Result() as $Category) {
         if ($Category->CategoryID > 0)
            $this->CategoryDiscussionData[$Category->CategoryID] = $DiscussionModel->Get(0, $this->DiscussionsPerCategory, array('d.CategoryID' => $Category->CategoryID, 'Announce' => 'all'));
      }
      
      // Add modules
      $this->AddModule('NewDiscussionModule');
      $this->AddModule('DiscussionFilterModule');
      $this->AddModule('CategoriesModule');
      $this->AddModule('BookmarkedModule');
      $this->AddModule($CategoryFollowToggleModule);
      
      // Set view and render
      $this->View = 'discussions';

      $this->CanonicalUrl(Url('/categories', TRUE));
      $Path = $this->FetchViewLocation('helper_functions', 'discussions', FALSE, FALSE);
      if ($Path)
         include_once $Path;
      $this->Render();
   }
724343
def prefix_topic(self, topics):
        
        if not self.topic_prefix or not topics:
            return topics

        if not isinstance(topics, str) and isinstance(topics, collections.Iterable):
            return [self.topic_prefix + topic for topic in topics]

        return self.topic_prefix + topics
1257830
def topic_metadata(topic_names)
      ensure_connected
      req = MetadataRequest.new( request_common(:metadata),
                                 topic_names)
      send_request(req)
      read_response(MetadataResponse)
    end
963669
function Route(topic, fns, options) {
  options = options || {};
  this.topic = topic;
  this.fns = fns;
  this.regexp = pattern.parse(topic
    , this.keys = []
    , options.sensitive
    , options.strict);
}
524009
def topics(self):
        
        topics = self.interface.publishers.copy()
        topics.update(self.interface.subscribers)
        return topics
1294783
def topic(self, channel, new_topic=None, tags=None):
        """"""
        params = [channel]
        if new_topic:
            params += new_topic
        self.send('TOPIC', params=params, source=self.nick, tags=tags)
765782
def tombstone_topic(self, topic, node):
        """"""
        nsq.assert_valid_topic_name(topic)
        return self._request('POST', '/topic/tombstone',
                             fields={'topic': topic, 'node': node})