Createas a new Session for +user+ (String, an existing
 Specify::Model::User#name) in +collection+ (String, an existing
 Specify::Model::Collection#name) and adds it to the #sessions pool.

 Returns the new Session.
179793
def start_session(user, collection)
      connect
      session = Session.new user, collection
      self << session
      session
    end
690304
def session(self, session=None):
        '''
        '''
        if self.related_instance:
            session = self.related_instance.session
        # we have a session, we either create a new one return the same session
        if session is None:
            raise QuerySetError('Related manager can be accessed only from\
 a loaded instance of its related model.')
        return session
1111885
function create(req, res, next) {
  var body = req.body;
  body.user_id = req.session.user.id;

  db.posts.create(req.body, function(err, post) {
    if(err) { return next(err); }

    res.json(201, post);
    signals.emit('post:create', post);
  });
}
1042271
function createMeta (args) {
    // add session if not set
    if (!args.session) {
        args.session = this.session
    }
    // return original method call
    return this.model.createMeta(args)
}
108426
def create
      group = Group.find_by(id: membership_params[:group_id])

      Group::Services::Join.new(group: group, person: current_user).call

      redirect_to group
    end
17496
def add(self, session):
        
        self._items[session.session_id] = session

        if session.expiry is not None:
            heappush(self._queue, session)
265326
def create
      if @membershipable.present?
        @membership = @membershipable.memberships.new(membership_params)
      else
        @membership = Membership.new(membership_params)
      end

      @membership.save
      respond_with(@membership, location: location)
    end
305060
def create(cls, community, record, user=None, expires_at=None,
               notify=True):
        
        if expires_at and expires_at < datetime.utcnow():
            raise InclusionRequestExpiryTimeError(
                community=community, record=record)

        if community.has_record(record):
            raise InclusionRequestObsoleteError(
                community=community, record=record)

        try:
            # Create inclusion request
            with db.session.begin_nested():
                obj = cls(
                    id_community=community.id,
                    id_record=record.id,
                    user=user,
                    expires_at=expires_at
                )
                db.session.add(obj)
        except (IntegrityError, FlushError):
            raise InclusionRequestExistsError(
                community=community, record=record)

        # Send signal
        inclusion_request_created.send(
            current_app._get_current_object(),
            request=obj,
            notify=notify
        )

        return obj
51051
protected Session createSession() throws Exception {
        Config config = configBean.getConfig();
        DataSource dataSource = InitialContext.doLookup(config.getDataSourceJNDI());
        return new Session(dataSource, config.getDialect());
    }
1236798
def user=(user)
      session[:user] = nil && return if user.nil?
      session[:user] = store_user(user)
      @user = session[:user] ? user : session[:user]  
    end
857249
def create(options = {})
      query = { 
        query: {
          username: options[:username],
          password: options[:password],
          attributes: hash_to_base64_json(options[:attributes])
          }
        }
      new_options = default_options_to_merge_with.merge(query)
      self.class.post("/#{@api_ver}/users", new_options)
    end
718237
def addFriend(user)
      method = 'addFriend'
      type = true
      args = {:user=>user}
      return_object type,method,args,true
    end
114607
function createSession(config, cb) {
  cb = utils.callOnce(cb)

  DEBUG("create", utils.JS(config))

  var channel = channels.createChannel(config.url)
  var session = new Session(channel, config, cb)
}
867939
def add_user(
        self,
        name, 
        **attrs
        ):
        """"""
        if self.user_exists(name):
            raise KubeConfError("user with the given name already exists.")

        users = self.get_users()
        
        # Add parameters.
        new_user = {'name': name, 'user':{}}
        attrs_ = new_user['user']
        attrs_.update(attrs)
        users.append(new_user)
814843
def _create_session(self):
        
        self.driver = requests.Session(**self.driver_args)
        # Set default headers
        self.update_headers(self.current_headers)
        self.update_cookies(self.current_cookies)
        self.set_proxy(self.current_proxy)
676744
public StandardSession createSession(Properties defaultUserSettings) {
		StandardSession session = new StandardSession(this, sessionTimeout, defaultUserSettings);
		synchronized (sessions) {
			synchronized (sessionsMirror) {
				sessions.put(session.getToken(), session);
				sessionsMirror.put(session.getToken(), session);
			}
		}
		System.out.println(new LogEntry("session " + session + " created"));
		return session;
	}
574099
def ormSessionCreator(self) -> DbSessionCreator:
        
        assert self._dbConnectString

        if self._ScopedSession:
            return self._ScopedSession

        self._dbEngine = create_engine(
            self._dbConnectString,
            **self._dbEngineArgs
        )

        self._ScopedSession = scoped_session(
            sessionmaker(bind=self._dbEngine))

        return self._ScopedSession